public class ZebraCardGraphics extends Object implements ZebraGraphics, Cloneable
| Constructor and Description |
|---|
ZebraCardGraphics(ZebraCardPrinter genericPrinter)
Public Constructor to construct the ZebraCardGraphics object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears user set parameters.
|
Object |
clone() |
void |
close()
Releases all the resources.
|
byte[] |
convertImageToRGB(byte[] imageData)
Converts the image to RGB format.
|
ZebraCardImageI |
createImage()
Generates the final bitmap image.
|
byte[] |
cropImage(byte[] imageData,
int x,
int y,
int width,
int height)
Crops an image to supplied dimensions and returns the cropped image data.
|
void |
drawEllipse(int x,
int y,
int width,
int height,
int lineThickness,
Integer lineColor,
Integer fillColor)
Draws an ellipse at the specified coordinates
|
void |
drawImage(byte[] bitmapData,
ImagePosition position,
int width,
int height,
float transparency,
RotationType rotation)
Draws the image at the specified image position in the rectangle.
|
void |
drawImage(byte[] bitmapData,
int x,
int y,
int width,
int height,
float transparency,
RotationType rotation)
Draws the image into the specified rectangle.
|
void |
drawImage(byte[] imageData,
int x,
int y,
int width,
int height,
RotationType rotation)
Draws the image into the specified rectangle
|
void |
drawLine(android.graphics.PointF start,
android.graphics.PointF end,
float lineThickness,
int lineColor)
Draws a Line from the specified coordinates.
|
void |
drawRectangle(int x,
int y,
int width,
int height,
float lineThickness,
Integer lineColor,
Integer fillColor)
Draws a rectangle at the specified coordinates
|
void |
drawRoundedRectangle(int x,
int y,
int width,
int height,
float radius,
float lineThickness,
Integer lineColor,
Integer fillColor)
Draws a round-cornered rectangle at the specified coordinates.
|
void |
drawText(String text,
int x,
int y,
float textSize,
int textColor)
Draws the text at the specified x and y coordinates.
|
void |
drawText(String text,
int x,
int y,
int angle,
float textSize,
int textColor)
Draws the text at the specified x and y coordinates and center rotates the text to the specified angle.
|
void |
drawText(String text,
int x,
int y,
int width,
int height,
int angle,
float textSize,
int textColor)
Draws the text into the specified rectangle.
|
void |
drawText(String text,
int x,
int y,
int width,
int height,
int angle,
float textSize,
int textColor,
boolean shrinkToFit)
Draws the text into the specified rectangle.
|
void |
drawText(String text,
int x,
int y,
int width,
int height,
int angle,
TextAlignment horizontal,
TextAlignment vertical,
float textSize,
int textColor)
Draws the text into the specified rectangle.
|
void |
drawText(String text,
int x,
int y,
int width,
int height,
int angle,
TextAlignment horizontal,
TextAlignment vertical,
float textSize,
int textColor,
boolean shrinkToFit)
Draws the text into the specified rectangle.
|
ExtractedImages |
extractBlackImageData(byte[] imageData,
int redThreshold,
int greenThreshold,
int blueThreshold)
Separates the monochrome and color data from the specified image data using the specified threshold values.
|
byte[] |
extractHalfPanelImageData(byte[] imageData)
Attempts to identify and extract the color and non-color half panel regions of the source image.
|
android.graphics.Canvas |
getCanvas()
Returns the Android Canvas object.
|
android.content.Context |
getContext()
Returns the
Context associated with this instance. |
android.graphics.Typeface |
getFont()
Returns the current font type used during drawText operations.
|
Integer |
getPaintFlags()
Gets the current Paint flag bits used during draw operations.
|
PrinterModel |
getPrinterModel()
Returns the printer model.
|
PrintType |
getPrintType()
Returns the type of print to be performed for the given image data.
|
android.graphics.Bitmap |
imageDataToImage(byte[] imageData)
Creates a Bitmap object from the raw bitmap data.
|
byte[] |
imageToImageData(android.graphics.Bitmap image)
Converts a Bitmap into it's raw image data.
|
void |
initialize(android.content.Context context,
int maxWidth,
int maxHeight,
OrientationType orientation,
PrintType printType,
Integer fillColor)
Initializes the drawing surface.
|
void |
initialize(int maxWidth,
int maxHeight,
OrientationType orientation,
PrintType printType,
Integer fillColor)
Initializes the drawing surface
if the specified
maxWidth or maxHeight is 0 then the maximum values for the specified printer model will be used
|
void |
monochromeConversionType(MonochromeConversion type)
Sets the monochrome conversion type to be used during
ZebraGraphicsI.createImage(). |
byte[] |
rotateImage(byte[] imageData,
int width,
int height,
RotationType type)
Rotates the image and then resizes the image.
|
byte[] |
rotateImage(byte[] imageData,
RotationType type)
Rotates the image.
|
void |
setBrightnessLevel(int level)
Sets the brightness correction level to be applied during
ZebraGraphicsI.createImage() |
void |
setColorScale(int red,
int green,
int blue)
Sets the color scale correction values for red, green, and blue pixel values during
ZebraGraphicsI.createImage() |
void |
setContrastLevel(int level)
Sets the contrast correction level to be applied during
ZebraGraphicsI.createImage() |
void |
setFont(android.graphics.Typeface font)
Sets the font type to be used during drawText operations.
|
void |
setGammaLevel(int level)
Sets the gamma correction level to be applied during
ZebraGraphicsI.createImage() |
void |
setPaintFlags(Integer paintFlags)
Sets the Paint flag bits to be used during draw operations.
|
void |
setPrinterModel(PrinterModel model)
Sets the printer model.
|
void |
setSaturationLevel(int level)
Sets the saturation correction level to be applied during
ZebraGraphicsI.createImage() |
public ZebraCardGraphics(ZebraCardPrinter genericPrinter) throws ZebraCardException, ConnectionException
genericPrinter - An instance of a zebra card printer.ConnectionException - If the device is busy or an error occurs communicating with the printer.ZebraCardException - If a printer error occurs.public PrinterModel getPrinterModel()
PrinterModel.public android.graphics.Canvas getCanvas()
Canvas object.public PrintType getPrintType()
public void setPrinterModel(PrinterModel model)
ZebraGraphicsIsetPrinterModel in interface ZebraGraphicsImodel - the printer model type.ZebraGraphicsI.setPrinterModel(PrinterModel)public android.graphics.Typeface getFont()
ZebraGraphicsgetFont in interface ZebraGraphicsZebraGraphics.getFont()public void setFont(android.graphics.Typeface font)
ZebraGraphicssetFont in interface ZebraGraphicsfont - The font of the text to be drawn.ZebraGraphics.setFont(Typeface)public void setPaintFlags(Integer paintFlags)
ZebraGraphicssetPaintFlags in interface ZebraGraphicspaintFlags - The Paint flag bits.ZebraGraphics.setPaintFlags(Integer)public Integer getPaintFlags()
ZebraGraphicsgetPaintFlags in interface ZebraGraphicsZebraGraphics.getPaintFlags()public android.content.Context getContext()
Context associated with this instance.public void initialize(int maxWidth,
int maxHeight,
OrientationType orientation,
PrintType printType,
Integer fillColor)
ZebraGraphicsImaxWidth or maxHeight is 0 then the maximum values for the specified printer model will be usedinitialize in interface ZebraGraphicsImaxWidth - the maximum width of the image (limited based on printer model).maxHeight - the maximum height of the image (limited based on printer model).orientation - the orientation of the image.printType - the type of print to be performed.fillColor - the RGB background fill color.ZebraGraphicsI.initialize(int, int, OrientationType, PrintType, Integer)public void initialize(android.content.Context context,
int maxWidth,
int maxHeight,
OrientationType orientation,
PrintType printType,
Integer fillColor)
ZebraGraphicsmaxWidth or maxHeight is 0 then the maximum values for the specified printer model will be used.initialize in interface ZebraGraphicscontext - Android application context.maxWidth - The maximum width of the image. (limited based on printer model)maxHeight - The maximum height of the image. (limited based on printer model)orientation - The orientation of the image.printType - The type of print to be performed for the given image data.fillColor - The RGB background fill color.ZebraGraphics.initialize(Context, int, int, OrientationType, PrintType, Integer)public void close()
ZebraGraphicsIclose in interface ZebraGraphicsIZebraGraphicsI.close()public void clear()
ZebraGraphicsIclear in interface ZebraGraphicsIZebraGraphicsI.clear()public void setBrightnessLevel(int level)
ZebraGraphicsIZebraGraphicsI.createImage()setBrightnessLevel in interface ZebraGraphicsIlevel - the brightness level.
ZebraGraphicsI.setBrightnessLevel(int)public void setContrastLevel(int level)
ZebraGraphicsIZebraGraphicsI.createImage()setContrastLevel in interface ZebraGraphicsIlevel - the contrast level.
ZebraGraphicsI.setContrastLevel(int)public void setGammaLevel(int level)
ZebraGraphicsIZebraGraphicsI.createImage()setGammaLevel in interface ZebraGraphicsIlevel - the gamma level.
ZebraGraphicsI.setGammaLevel(int)public void setSaturationLevel(int level)
ZebraGraphicsIZebraGraphicsI.createImage()setSaturationLevel in interface ZebraGraphicsIlevel - the saturation correction level.
ZebraGraphicsI.setSaturationLevel(int)public void setColorScale(int red,
int green,
int blue)
ZebraGraphicsIZebraGraphicsI.createImage()setColorScale in interface ZebraGraphicsIred - the red pixel correction value.green - the green pixel correction value.blue - the blue pixel correction value.
ZebraGraphicsI.setColorScale(int, int, int)public void monochromeConversionType(MonochromeConversion type)
ZebraGraphicsIZebraGraphicsI.createImage().
monochromeConversionType in interface ZebraGraphicsItype - the type of monochrome conversion to perform.ZebraGraphicsI.monochromeConversionType(MonochromeConversion)public ZebraCardImageI createImage() throws java.io.IOException
ZebraGraphicsIcreateImage in interface ZebraGraphicsIjava.io.IOException - if an error occurs during reading/writing.ZebraGraphicsI.createImage()public void drawImage(byte[] imageData,
int x,
int y,
int width,
int height,
RotationType rotation)
throws IllegalArgumentException
ZebraGraphicsIdrawImage in interface ZebraGraphicsIimageData - the bitmap image datax - the x coordinate.y - the y coordinate.width - the width of the rectangle.
height - the height of the rectangle.
rotation - the rotation of the image.IllegalArgumentException - if an argument passed in is not valid.ZebraGraphicsI.drawImage(byte[], int, int, int, int, RotationType)public void drawImage(byte[] bitmapData,
int x,
int y,
int width,
int height,
float transparency,
RotationType rotation)
throws IllegalArgumentException
ZebraGraphicsdrawImage in interface ZebraGraphicsbitmapData - The bitmap image data.x - The x coordinate.y - The y coordinate.width - The width of the rectangle.
width is 0 then the width of the specified image will be used.height - The height of the rectangle.
height is 0 then the height of the specified image will be usedtransparency - The transparency level.
rotation - The rotation type for the image.IllegalArgumentException - If the specified transparency level is outside of the valid range.ZebraGraphics.drawImage(byte[], int, int, int, int, float, RotationType)public void drawImage(byte[] bitmapData,
ImagePosition position,
int width,
int height,
float transparency,
RotationType rotation)
throws IllegalArgumentException
ZebraGraphicsdrawImage in interface ZebraGraphicsbitmapData - The bitmap image data.position - The position of the image in the rectangle.width - the width of the rectangle.
width is 0 then the width of the specified image will be used.height - the height of the rectangle.
height is 0 then the height of the specified image will be used.transparency - The transparency level.
rotation - The rotation type.IllegalArgumentException - If the specified transparency level is outside of the valid range.ZebraGraphics.drawImage(byte[], ImagePosition, int, int, float, RotationType)public void drawText(String text,
int x,
int y,
float textSize,
int textColor)
ZebraGraphicsdrawText in interface ZebraGraphicstext - The text to be drawn.x - The x coordinate.y - The y coordinate.textSize - The size of the text.textColor - The RGB color of the text to be drawn.ZebraGraphics.drawText(String, int, int, float, int)public void drawText(String text,
int x,
int y,
int angle,
float textSize,
int textColor)
ZebraGraphicsdrawText in interface ZebraGraphicstext - The text to be drawn.x - The x coordinate.y - The y coordinate.angle - The angle of the the text to be drawn (center rotated).
textSize - The size of the text.textColor - The RGB color of the text to be drawn.ZebraGraphics.drawText(String, int, int, int, float, int)public void drawText(String text,
int x,
int y,
int width,
int height,
int angle,
float textSize,
int textColor)
throws IllegalArgumentException
ZebraGraphicsdrawText in interface ZebraGraphicstext - The text to be drawn.x - The x coordinate.y - The y coordinate.width - The width of the rectangle.height - The height of the rectangle.angle - The angle of the the text to be drawn.
textSize - The size of the text.textColor - The RGB color of the text to be drawn.IllegalArgumentException - If the specified width and height are not large enough to contain the text.ZebraGraphics.drawText(String, int, int, int, int, int, float, int)public void drawText(String text,
int x,
int y,
int width,
int height,
int angle,
float textSize,
int textColor,
boolean shrinkToFit)
throws IllegalArgumentException
ZebraGraphicsdrawText in interface ZebraGraphicstext - The text to be drawn.x - The x coordinate.y - The y coordinate.width - The width of the rectangle.height - The height of the rectangle.angle - The angle of the the text to be drawn.
textSize - The size of the text.textColor - The RGB color of the text to be drawn.shrinkToFit - True to adjust the font size to fit the specified width and height.IllegalArgumentException - If the specified width and height are not large enough to contain the text and
shrinkToFit is false.ZebraGraphics.drawText(String, int, int, int, int, int, float, int, boolean)public void drawText(String text,
int x,
int y,
int width,
int height,
int angle,
TextAlignment horizontal,
TextAlignment vertical,
float textSize,
int textColor)
throws IllegalArgumentException
ZebraGraphicsdrawText in interface ZebraGraphicstext - The text to be drawn.x - The x coordinate.y - The y coordinate.width - The width of the rectangle.height - The height of the rectangle.angle - The angle of the the text to be drawn.
horizontal - The horizontal alignment of the text.vertical - The vertical alignment of the text.textSize - The size of the text.textColor - The RGB color of the text to be drawn.IllegalArgumentException - If the specified width and height are not large enough to contain the text.ZebraGraphics.drawText(String, int, int, int, int, int, TextAlignment, TextAlignment, float, int)public void drawText(String text,
int x,
int y,
int width,
int height,
int angle,
TextAlignment horizontal,
TextAlignment vertical,
float textSize,
int textColor,
boolean shrinkToFit)
throws IllegalArgumentException
ZebraGraphicsdrawText in interface ZebraGraphicstext - The text to be drawn.x - The x coordinate.y - The y coordinate.width - The width of the rectangle.height - The height of the rectangle.angle - The angle of the the text to be drawn.
horizontal - The horizontal alignment of the text.vertical - The vertical alignment of the text.textSize - The size of the text.textColor - The RGB color of the text to be drawn.shrinkToFit - True to adjust the font size to fit the specified width and height.IllegalArgumentException - If the specified width and height are not large enough to contain the text and
shrinkToFit is false.ZebraGraphics.drawText(String, int, int, int, int, int, TextAlignment, TextAlignment, float, int, boolean)public void drawLine(android.graphics.PointF start,
android.graphics.PointF end,
float lineThickness,
int lineColor)
ZebraGraphicsdrawLine in interface ZebraGraphicsstart - PointF instance holding the x and y coordinates of the start point.end - PointF instance holding the x and y coordinates of the end point.lineThickness - The thickness of the line.lineColor - The RGB line color.ZebraGraphics.drawLine(PointF, PointF, float, int)public void drawRectangle(int x,
int y,
int width,
int height,
float lineThickness,
Integer lineColor,
Integer fillColor)
ZebraGraphicsdrawRectangle in interface ZebraGraphicsx - The x coordinate.y - The y coordinate.width - The width of the rectangle.height - The height of the rectangle.lineThickness - The line thickness of the rectangle.
lineThickness will be ignored if the lineColor is null.lineColor - the RGB line color of the rectangle.
lineColor will be ignored if null.fillColor - the RGB fill color of the rectangle.
fillColor will be ignored if null.ZebraGraphics.drawRectangle(int, int, int, int, float, Integer, Integer)public void drawRoundedRectangle(int x,
int y,
int width,
int height,
float radius,
float lineThickness,
Integer lineColor,
Integer fillColor)
ZebraGraphicsdrawRoundedRectangle in interface ZebraGraphicsx - The x coordinate.y - The y coordinate.width - The width of the rectangle.height - The height of the rectangle.radius - The corner radius of the rectangle.lineThickness - The line thickness of the rectangle.
lineThickness will be ignored if the lineColor is null.lineColor - the RGB line color of the rectangle.
lineColor will be ignored if null.fillColor - the RGB fill color of the rectangle.
fillColor will be ignored if null.ZebraGraphics.drawRoundedRectangle(int, int, int, int, float, float, Integer, Integer)public void drawEllipse(int x,
int y,
int width,
int height,
int lineThickness,
Integer lineColor,
Integer fillColor)
ZebraGraphicsdrawEllipse in interface ZebraGraphicsx - The x coordinate of the upper left corner of the ellipse.y - The y coordinate of the upper left corner of the ellipse.width - The width of the ellipse.height - The height of the ellipse.lineThickness - The line thickness of the rectangle.
lineThickness will be ignored if the lineColor is null.lineColor - the RGB line color of the rectangle.
lineColor will be ignored if null.fillColor - the RGB fill color of the rectangle.
fillColor will be ignored if null.ZebraGraphics.drawEllipse(int, int, int, int, int, Integer, Integer)public ExtractedImages extractBlackImageData(byte[] imageData, int redThreshold, int greenThreshold, int blueThreshold) throws IllegalArgumentException, java.io.IOException
ZebraGraphicsIextractBlackImageData in interface ZebraGraphicsIimageData - the 24bpp bitmap color image data.redThreshold - the red pixel threshold value.
greenThreshold - the green pixel threshold value.
blueThreshold - the blue pixel threshold value.
IllegalArgumentException - if the redThreshold, greenThreshold, or blueThreshold level is outside of the valid
range.java.io.IOException - if an error occurs while reading the image data.ZebraGraphicsI.extractBlackImageData(byte[], int, int, int)public byte[] extractHalfPanelImageData(byte[] imageData)
throws IllegalArgumentException,
java.io.IOException
ZebraGraphicsIextractHalfPanelImageData in interface ZebraGraphicsIimageData - the 24bpp bitmap color image data.IllegalArgumentException - If imageData is invalid or the printer model is not supported.java.io.IOException - if an error occurs while reading the image data.ZebraGraphicsI.extractHalfPanelImageData(byte[])public byte[] rotateImage(byte[] imageData,
RotationType type)
throws java.io.IOException
ZebraGraphicsIrotateImage in interface ZebraGraphicsIimageData - the source image data.type - the rotation type.java.io.IOException - if an error occurs during reading/writing.ZebraGraphicsI.rotateImage(byte[], RotationType)public byte[] rotateImage(byte[] imageData,
int width,
int height,
RotationType type)
throws java.io.IOException
ZebraGraphicsIrotateImage in interface ZebraGraphicsIimageData - the source image data.width - the rotated image width.height - the rotated image height.type - the rotation type.java.io.IOException - if an error occurs during reading/writing.ZebraGraphicsI.rotateImage(byte[], int, int, RotationType)public android.graphics.Bitmap imageDataToImage(byte[] imageData)
throws IllegalArgumentException,
java.io.IOException
ZebraGraphicsimageDataToImage in interface ZebraGraphicsimageData - The raw bitmap data.IllegalArgumentException - If the imageData is invalid.java.io.IOException - If an error occurs reading the image data.ZebraGraphics.imageDataToImage(byte[])public byte[] imageToImageData(android.graphics.Bitmap image)
throws IllegalArgumentException,
java.io.IOException
ZebraGraphicsimageToImageData in interface ZebraGraphicsimage - The Bitmap.IllegalArgumentException - If the image is invalid.java.io.IOException - If an error occurs reading the image data.ZebraGraphics.imageToImageData(Bitmap)public byte[] cropImage(byte[] imageData,
int x,
int y,
int width,
int height)
throws java.io.IOException
ZebraGraphicsIcropImage in interface ZebraGraphicsIimageData - byte[] containing the raw bitmap data.x - the x-offset of new image.y - the y-offset of new image.width - the width of the cropped image.height - the height of the cropped image.java.io.IOException - if an error occurs reading the image data.ZebraGraphicsI.cropImage(byte[], int, int, int, int)public byte[] convertImageToRGB(byte[] imageData)
throws java.io.IOException
ZebraGraphicsIconvertImageToRGB in interface ZebraGraphicsIimageData - the source image data.java.io.IOException - if an error occurs during reading/writing.ZebraGraphicsI.convertImageToRGB(byte[])public Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionObject.clone()
© 2017 ZIH Corp. All Rights Reserved.