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.
|
ZebraCardImageI |
createImage(String colorProfileName)
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,
java.awt.Color lineColor,
java.awt.Color fillColor)
Draws an ellipse at the specified coordinates
|
void |
drawImage(byte[] imageData,
ImagePosition position,
int width,
int height,
float transparency,
RotationType rotation)
Draws the image at the specified image position in the rectangle.
|
void |
drawImage(byte[] imageData,
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(int x1,
int y1,
int x2,
int y2,
float lineThickness,
java.awt.Color lineColor)
Draws a Line from the specified coordinates.
|
void |
drawRectangle(int x,
int y,
int width,
int height,
float lineThickness,
java.awt.Color lineColor,
java.awt.Color fillColor)
Draws a rectangle at the specified coordinates
|
void |
drawRoundedRectangle(int x,
int y,
int width,
int height,
float radius,
float lineThickness,
java.awt.Color lineColor,
java.awt.Color fillColor)
Draws a round-cornered rectangle at the specified coordinates.
|
void |
drawText(String text,
int x,
int y,
java.awt.Color textColor)
Draws the text at the specified x and y coordinates.
|
void |
drawText(String text,
int x,
int y,
int angle,
java.awt.Color 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,
java.awt.Color textColor)
Draws the text into the specified rectangle.
|
void |
drawText(String text,
int x,
int y,
int width,
int height,
int angle,
java.awt.Color 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,
java.awt.Color 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,
java.awt.Color 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.
|
java.awt.Graphics2D |
getGraphics2D()
Returns the awt Graphics2D class
|
PrinterModel |
getPrinterModel()
Returns the printer model.
|
PrintType |
getPrintType()
Returns the type of print to be performed for the given image data.
|
java.awt.image.BufferedImage |
imageDataToImage(byte[] imageData)
Creates a BufferedImage object from the raw bitmap data.
|
byte[] |
imageToImageData(java.awt.image.BufferedImage image)
Converts a BufferedImage into it's raw image data
|
void |
initialize(int maxWidth,
int maxHeight,
OrientationType orientation,
PrintType printType,
java.awt.Color 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(java.awt.Font 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 |
setPrinterModel(PrinterModel model)
Sets the printer model.
|
void |
setRenderingHints(java.awt.RenderingHints renderingHints)
Adds to the RenderingHints to be used during draw operations.
|
void |
setSaturationLevel(int level)
Sets the saturation correction level to be applied during
ZebraGraphicsI.createImage() |
public ZebraCardGraphics(ZebraCardPrinter genericPrinter) throws ConnectionException, ZebraCardException
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()
public java.awt.Graphics2D getGraphics2D()
public PrintType getPrintType()
public void setPrinterModel(PrinterModel model)
ZebraGraphicsI
setPrinterModel
in interface ZebraGraphicsI
model
- the printer model type.ZebraGraphicsI.setPrinterModel(PrinterModel)
public void setFont(java.awt.Font font)
ZebraGraphics
setFont
in interface ZebraGraphics
font
- the font of the text to be drawn.ZebraGraphics.setFont(Font)
public void setRenderingHints(java.awt.RenderingHints renderingHints)
ZebraGraphics
setRenderingHints
in interface ZebraGraphics
renderingHints
- the rendering hints.ZebraGraphics.setRenderingHints(RenderingHints)
public void initialize(int maxWidth, int maxHeight, OrientationType orientation, PrintType printType, Integer fillColor)
ZebraGraphicsI
maxWidth
or maxHeight
is 0 then the maximum values for the specified printer model will be usedinitialize
in interface ZebraGraphicsI
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.fillColor
- the RGB background fill color.ZebraGraphicsI.initialize(int, int, OrientationType, PrintType, Integer)
public void initialize(int maxWidth, int maxHeight, OrientationType orientation, PrintType printType, java.awt.Color fillColor)
ZebraGraphics
maxWidth
or maxHeight
is 0 then the maximum values for the specified printer model will be used.initialize
in interface ZebraGraphics
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(int, int, OrientationType, PrintType, Color)
public void close()
ZebraGraphicsI
close
in interface ZebraGraphicsI
ZebraGraphicsI.close()
public void clear()
ZebraGraphicsI
clear
in interface ZebraGraphicsI
ZebraGraphicsI.clear()
public ZebraCardImageI createImage() throws java.io.IOException
ZebraGraphicsI
createImage
in interface ZebraGraphicsI
java.io.IOException
- if an error occurs during reading/writing.ZebraGraphicsI.createImage()
public ZebraCardImageI createImage(String colorProfileName) throws java.io.IOException
ZebraGraphics
createImage
in interface ZebraGraphics
colorProfileName
- ICC profile to apply to the image.
java.io.IOException
- if an error occurs creating the image.ZebraGraphics.createImage(String)
public byte[] convertImageToRGB(byte[] imageData) throws java.io.IOException
ZebraGraphicsI
convertImageToRGB
in interface ZebraGraphicsI
imageData
- the source image data.java.io.IOException
- if an error occurs during reading/writing.ZebraGraphicsI.convertImageToRGB(byte[])
public byte[] rotateImage(byte[] imageData, RotationType type) throws java.io.IOException
ZebraGraphicsI
rotateImage
in interface ZebraGraphicsI
imageData
- 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
ZebraGraphicsI
rotateImage
in interface ZebraGraphicsI
imageData
- 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 byte[] cropImage(byte[] imageData, int x, int y, int width, int height) throws java.io.IOException
ZebraGraphicsI
cropImage
in interface ZebraGraphicsI
imageData
- 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 void setBrightnessLevel(int level)
ZebraGraphicsI
ZebraGraphicsI.createImage()
setBrightnessLevel
in interface ZebraGraphicsI
level
- the brightness level.
ZebraGraphicsI.setBrightnessLevel(int)
public void setContrastLevel(int level)
ZebraGraphicsI
ZebraGraphicsI.createImage()
setContrastLevel
in interface ZebraGraphicsI
level
- the contrast level.
ZebraGraphicsI.setContrastLevel(int)
public void setGammaLevel(int level)
ZebraGraphicsI
ZebraGraphicsI.createImage()
setGammaLevel
in interface ZebraGraphicsI
level
- the gamma level.
ZebraGraphicsI.setGammaLevel(int)
public void setSaturationLevel(int level)
ZebraGraphicsI
ZebraGraphicsI.createImage()
setSaturationLevel
in interface ZebraGraphicsI
level
- the saturation correction level.
ZebraGraphicsI.setSaturationLevel(int)
public void setColorScale(int red, int green, int blue)
ZebraGraphicsI
ZebraGraphicsI.createImage()
setColorScale
in interface ZebraGraphicsI
red
- 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)
ZebraGraphicsI
ZebraGraphicsI.createImage()
.
monochromeConversionType
in interface ZebraGraphicsI
type
- the type of monochrome conversion to perform.ZebraGraphicsI.monochromeConversionType(MonochromeConversion)
public void drawImage(byte[] imageData, int x, int y, int width, int height, RotationType rotation) throws java.io.IOException, IllegalArgumentException
ZebraGraphicsI
drawImage
in interface ZebraGraphicsI
imageData
- 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.java.io.IOException
- if an error occurs during reading/writing.IllegalArgumentException
- if an argument passed in is not valid.ZebraGraphicsI.drawImage(byte[], int, int, int, int, RotationType)
public void drawImage(byte[] imageData, int x, int y, int width, int height, float transparency, RotationType rotation) throws java.io.IOException, IllegalArgumentException
ZebraGraphics
drawImage
in interface ZebraGraphics
imageData
- 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.java.io.IOException
- if an error occurs reading the image data.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[] imageData, ImagePosition position, int width, int height, float transparency, RotationType rotation) throws IllegalArgumentException, java.io.IOException
ZebraGraphics
drawImage
in interface ZebraGraphics
imageData
- 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.java.io.IOException
- if an error occurs reading the image data.ZebraGraphics.drawImage(byte[], ImagePosition, int, int, float, RotationType)
public void drawText(String text, int x, int y, java.awt.Color textColor)
ZebraGraphics
drawText
in interface ZebraGraphics
text
- the text to be drawn.x
- the x coordinate.y
- the y coordinate.textColor
- the RGB color of the text to be drawn.ZebraGraphics.drawText(String, int, int, Color)
public void drawText(String text, int x, int y, int angle, java.awt.Color textColor)
ZebraGraphics
drawText
in interface ZebraGraphics
text
- 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).textColor
- the RGB color of the text to be drawn.ZebraGraphics.drawText(String, int, int, int, Color)
public void drawText(String text, int x, int y, int width, int height, int angle, java.awt.Color textColor) throws IllegalArgumentException
ZebraGraphics
drawText
in interface ZebraGraphics
text
- 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 (center rotated).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, Color)
public void drawText(String text, int x, int y, int width, int height, int angle, java.awt.Color textColor, boolean shrinkToFit) throws IllegalArgumentException
ZebraGraphics
drawText
in interface ZebraGraphics
text
- 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.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, Color, boolean)
public void drawText(String text, int x, int y, int width, int height, int angle, TextAlignment horizontal, TextAlignment vertical, java.awt.Color textColor) throws IllegalArgumentException
ZebraGraphics
drawText
in interface ZebraGraphics
text
- 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.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, Color)
public void drawText(String text, int x, int y, int width, int height, int angle, TextAlignment horizontal, TextAlignment vertical, java.awt.Color textColor, boolean shrinkToFit) throws IllegalArgumentException
ZebraGraphics
drawText
in interface ZebraGraphics
text
- 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.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, Color, boolean)
public void drawLine(int x1, int y1, int x2, int y2, float lineThickness, java.awt.Color lineColor)
ZebraGraphics
drawLine
in interface ZebraGraphics
x1
- the X coordinate of the start pointy1
- the Y coordinate of the start pointx2
- the X coordinate of the end pointy2
- the Y coordinate of the end pointlineThickness
- the thickness of the line.lineColor
- the RGB line color.ZebraGraphics.drawLine(int, int, int, int, float, Color)
public void drawRectangle(int x, int y, int width, int height, float lineThickness, java.awt.Color lineColor, java.awt.Color fillColor)
ZebraGraphics
drawRectangle
in interface ZebraGraphics
x
- 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, Color, Color)
public void drawRoundedRectangle(int x, int y, int width, int height, float radius, float lineThickness, java.awt.Color lineColor, java.awt.Color fillColor)
ZebraGraphics
drawRoundedRectangle
in interface ZebraGraphics
x
- 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, Color, Color)
public void drawEllipse(int x, int y, int width, int height, int lineThickness, java.awt.Color lineColor, java.awt.Color fillColor)
ZebraGraphics
drawEllipse
in interface ZebraGraphics
x
- 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, Color, Color)
public ExtractedImages extractBlackImageData(byte[] imageData, int redThreshold, int greenThreshold, int blueThreshold) throws IllegalArgumentException, java.io.IOException
ZebraGraphicsI
extractBlackImageData
in interface ZebraGraphicsI
imageData
- 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
ZebraGraphicsI
extractHalfPanelImageData
in interface ZebraGraphicsI
imageData
- 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 java.awt.image.BufferedImage imageDataToImage(byte[] imageData) throws IllegalArgumentException, java.io.IOException
ZebraGraphics
imageDataToImage
in interface ZebraGraphics
imageData
- 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(java.awt.image.BufferedImage image) throws IllegalArgumentException, java.io.IOException
ZebraGraphics
imageToImageData
in interface ZebraGraphics
image
- the BufferedImage.IllegalArgumentException
- if the image
is invalid.java.io.IOException
- if an error occurs reading the image data.ZebraGraphics.imageToImageData(BufferedImage)
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
Object.clone()
© 2016 ZIH Corp. All Rights Reserved.