-
-
Save gohanman/fdb68ad573bfa48b7c15cbe3c9378248 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use COREPOS\pos\lib\Bitmap; | |
$bmp = new Bitmap(320, 240); | |
$data = '0,65535^23,16^23,13^22,16^22,19^23,22^23,26^23,29^23,32^23,35^24,39^24,42^25,45^28,46^32,44^35,43^38,40^41,39^44,36^0,65535^78,2^75,3^72,6^69,9^68,13^65,16^64,19^63,22^62,26^62,29^62,32^63,35^64,39^67,42^70,44^73,45^76,44^80,42^82,39^83,35^84,32^86,29^87,26^88,22^89,19^89,16^88,13^88,9^87,6^85,3^0,65535^110,0^110,4^109,7^109,10^108,13^108,17^108,20^108,23^108,26^108,30^108,33^110,36^112,39^115,41^118,42^121,43^124,43^128,42^131,41^134,40^137,39^140,39^144,37^~'; | |
$points = explode('^', $data); | |
for ($i=0; $i<count($points)-1; $i++) { | |
if ($points[$i] == '0,65535') continue; | |
list($x1,$y1) = explode(',' $points[$i]); | |
list($x2,$y2) = explode(',' $points[$i+1]); | |
$bmp->drawLine(array($x1,$y1), array($x2,$y2), 1); | |
} | |
$tempfile = tempnam(sys_get_temp_dir(), 'SIG'); | |
$bmp->save($tempfile); | |
$rawbmp = file_get_contents($tempfile); | |
unlink($tempfile); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment