I am writing simple application to print label with Zebra programming language ZPL and Flex. At current stage i want to print graphics and text as graphic. So the steps i need to perform is:
Capture BitmapData (black and white 1 bit per pixel) from spark
component like Label, for example. I think that i have to use BitmapData.draw
function, but i dont know how to make it black and white and 1 bit
per pixel;
Represent data in ASCII hexadecimal string.( For example 32x32 px
black rectangle will look like this
~DG000.GRF,00512,008,
,:::::::::::H07FLF80,:::::::::::::::::::::::::::::::,:::::::::::::::::::
*part of label design, exported by official Zebra Designer label editor)
where
~DG - Command to download graphic;
000.GRF - File Name and extension;
00512 - total number of bytes in graphic;
008 - number of bytes per row;
rest - is The data string defines the image and is an ASCII hexadecimal representation of the image. Each character represents a horizontal nibble of four dots.
I found an answer to step 2 using C# in following post -
How to generate a dynamic GRF image to ZPL ZEBRA print
I need about the same but written in ActionScript.
Thank You.
You are unable to make a BitmapData
be 1 bit per pixel, instead you query it pixel by pixel by using getPixel()
and check if it's dark enough to be called "black", if yes, act as if this "bit" is 0.