57
Chapter 4 API Reference
4
addImage
Adds raster image printing to the command buffer.
Prints the graphic in the android.graphics.Bitmap class.
Of the graphics in the android.graphics.Bitmap class, makes the specified range into binary with the dither
processing, and converts it into raster image data. 1 pixel of the image corresponds to 1 dot of the printer. If
transparent shading is included, it is regarded as white.
Syntax
public void addImage(Bitmap data, int x, int y
, int width, int height, int color)
throws EposException
Parameter
data : Specifies an instance of the android.graphics.Bitmap class.
x : Specifies the horizontal start position in the print area. Specifies an integer from 0 to
65534.
y : Specifies the vertical start position in the print area. Specifies an integer from 0 to 65534.
width : Specifies the width of the print area. Specifies an integer from 1 to 65535.
height : Specifies the height of the print area. Specifies an integer from 1 to 65535.
color : Specifies the color.
To print a raster image at high speed, specify Builder.ALIGN_LEFT for the addTextAlign (p.43),
and specify a multiple of 8 not exceeding the printer's paper width for the width parameter of this
API.
Set value Description
Builder.COLOR_NONE Characters are not printed.
Builder.COLOR_1 First color
Builder.COLOR_2 Second color
Builder.COLOR_3 Third color
Builder.COLOR_4 Fourth color
Builder.PARAM_DEFAULT First color
If the area specified by the x/y parameters and the width/height parameters extends beyond the
image size specified by the data parameter, an EposException with ERR_PARAM contained in its
error status occurs.