3.0+52.10
Image API extensions

The Image API of QF-Test makes use of a technology independent class for image representation ImageRep and it offers an interface to implement an own image compare algorithm.

The ImageRep class

The class de.qfs.apps.qftest.shared.extensions.image.ImageRep is the wrapper class for technology independent images.

The class holds the image representation either as ARGB data, which is an int array or as RGB data, which is a byte array. Besides the image data, you can also specify a name, the width and the height for the ImageRep object.

The ImageRep class also contains an equals method for comparisons. If you want to implement your own image comparison algorithm, you have to implement your own ImageComparator. This implementation has to be registered at the ImageRep object. See subsection 52.10.2 for further information.

 
 
ImageRep ImageRep()

Constructor for the ImageRep class.

 
ImageRep ImageRep(String name, byte[] rgb, boolean png, int width, int height)

Constructor method for the ImageRep class.

Parameters
name The name of the ImageRep object.
rgb A byte array containing RGB data of the image.
png Whether the image is already png encoded.
width The width of the image.
height The height of the image.
 
ImageRep ImageRep(String name, int[] argb, boolean png, int width, int height)

Constructor method for the ImageRep class.

Parameters
name The name of the ImageRep object.
argb An int array containing the ARGB data of the image.
png Whether the image is already png encoded.
width The width of the image.
height The height of the image.
 
void crop(int x, int y, int width, int height)

Crop the image to a specified sub-region.

Parameters
x The X coordinate of the left upper corner of the sub-region.
y The Y coordinate of the left upper corner of the sub-region.
width The width of the sub-region.
height The height of the sub-region.
 
ImageRepDrawer draw()
Creates an ImageRepDrawer object for this image. This image allows drawing lines, rectangles and further figures on the image.
 
ImageRepDrawer draw(Object obj)
Creates an ImageRepDrawer object for this image.
Parameters
obj A lambda object. The lambda object gets a java.awt.Graphics2D object as input which it can use to draw on the image.
 
boolean equals(ImageRep compare)

Return, whether the current object is equal to a given object. It uses the equals method of the current ImageComparator implementation.

Parameters
compare The ImageRep object to compare with.
ReturnsTrue, if images are equal, otherwise false.
 
int[] getARGB()

Get the ARGB data. If no ARGB data is set, the RGB data will be translated into the ARGB data.

ReturnsThe current ARGB data.
 
ImageComparator getComparator()

Get the current ImageComparator implementation.

ReturnsThe current ImageComparator implementation.
 
int getHeight()

Get the height.

ReturnsThe current height.
 
String getName()

Get the name.

ReturnsThe current name.
 
int getPixel(int x, int y)

Get an ARGB pixel value.

Parameters
x The X coordinate of the pixel.
y The Y coordinate of the pixel.
ReturnsThe pixel value.
 
byte[] getPng()

Get the RGB data. If no RGB data is set, the ARGB data will be translated into the RGB data.

ReturnsThe current RGB data.
 
int getWidth()

Get the width.

ReturnsThe current width.
 
void setARGB(int[] argb)

Set the ARGB data.

Parameters
argb The new ARGB data.
 
void setComparator(ImageComparator comparator)

Set ImageComparator implementation, which will be used for comparing images.

Parameters
comparator The new ImageComparator implementation.
 
void setHeight(int height)

Set the height.

Parameters
height The new height.
 
void setName(String name)

Set the name.

Parameters
name The new name.
 
void setPng(byte[] png)

Set the RGB data.

Parameters
png The new RGB data.
 
void setWidth(int width)

Set the width.

Parameters
width The new width.
 
 

The ImageComparator interface

The interface de.qfs.apps.qftest.shared.extensions.image.ImageComparator has to be implemented, if you want to implement your own image comparison algorithm.

The implementation has then to be registered at the used ImageRep objects using the setComparator method.

 
 
boolean equals(ImageRep actual, ImageRep expected)

Return, whether the current object is equal to a given object. It uses the equals method of the current ImageComparator implementation.

Parameters
actual The actual ImageRep object.
expected The expected ImageRep object.
ReturnsTrue, if images are equal, otherwise false.
 
 

The ImageRepDrawer class

The class de.qfs.apps.qftest.shared.extensions.image.ImageRepDrawer provides methods to draw on an ImageRep object.

 
 
ImageRepDrawer arrow(int x1, int y1, int x2, int y2)

Draws an arrow.

Parameters
x1 The x-part of the first coordinate of the arrow.
y1 The y-part of the first coordinate of the arrow.
x2 The x-part of the second coordinate of the arrow.
y2 The y-part of the second coordinate of the arrow.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer arrow(int x1, int y1, int x2, int y2, int arrowStretch)

Draws an arrow.

Parameters
x1 The x-part of the first coordinate of the arrow.
y1 The y-part of the first coordinate of the arrow.
x2 The x-part of the second coordinate of the arrow.
y2 The y-part of the second coordinate of the arrow.
arrowStretch The size of the arrow head.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer arrow(int x1, int y1, int x2, int y2, int arrowStretch, int strokeSize)

Draws an arrow.

Parameters
x1 The x-part of the first coordinate of the arrow.
y1 The y-part of the first coordinate of the arrow.
x2 The x-part of the second coordinate of the arrow.
y2 The y-part of the second coordinate of the arrow.
arrowStretch The size of the arrow head.
strokeSize The size of the stroke.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer arrow(int x1, int y1, int x2, int y2, int arrowStretch, int strokeSize, Color strokeColor)

Draws an arrow.

Parameters
x1 The x-part of the first coordinate of the arrow.
y1 The y-part of the first coordinate of the arrow.
x2 The x-part of the second coordinate of the arrow.
y2 The y-part of the second coordinate of the arrow.
arrowStretch The size of the arrow head.
strokeSize The size of the stroke.
strokeColor The stroke color.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer arrow(int x1, int y1, int x2, int y2, int arrowStretch, int strokeSize, int r, int g, int b)

Draws an arrow.

Parameters
x1 The x-part of the first coordinate of the arrow.
y1 The y-part of the first coordinate of the arrow.
x2 The x-part of the second coordinate of the arrow.
y2 The y-part of the second coordinate of the arrow.
arrowStretch The size of the arrow head.
strokeSize The size of the stroke.
r The red part of the stroke color.
g The green part of the stroke color.
b The blue part of the stroke color.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer arrow(int x1, int y1, int x2, int y2, int arrowStretch, int strokeSize, int r, int g, int b, int a)

Draws an arrow.

Parameters
x1 The x-part of the first coordinate of the arrow.
y1 The y-part of the first coordinate of the arrow.
x2 The x-part of the second coordinate of the arrow.
y2 The y-part of the second coordinate of the arrow.
arrowStretch The size of the arrow head.
strokeSize The size of the stroke.
r The red part of the stroke color.
g The green part of the stroke color.
b The blue part of the stroke color.
a The alpha part of the stroke color.
ReturnsThe ImageRepDrawer object for method concatination.
 
BufferedImage asBufferedImage()

Converts this image to a BufferedImage.

ReturnsThis image as BufferedImage.
 
ImageRepDrawer circle(int x, int y, int r)

Draws a circle.

Parameters
x The x-coordinate of the center of the circle.
y The y-coordinate of the center of the circle.
r The radius of the circle.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer circle(int x, int y, int r, Color color)

Draws a circle.

Parameters
x The x-coordinate of the center of the circle.
y The y-coordinate of the center of the circle.
r The radius of the circle.
color The color of the circle.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer cross(int x, int y)

Draws a cross.

Parameters
x The x-coordinate of the cross to draw.
y The y-coordinate of the cross to draw.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer cross(int x, int y, int size)

Draws a cross.

Parameters
x The x-coordinate of the cross to draw.
y The y-coordinate of the cross to draw.
size The size of the cross to draw.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer draw(Object drawFunction)

Draws on an ImageRep object.

Parameters
drawFunction A lambda object. The lambda object takes a java.awt.Graphics2D object as input which can be used to draw onto the image.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer erase(int x, int y, int w, int h)

"Erases" a particular area in the image.

Parameters
x The x-coordinate of the area that should get erased.
y The y-coordinate of the area that should get erased.
w The width of the area that should get erased.
h The height of the area that should get erased.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer fillRectangle(int x, int y, int w, int h)

Draws a filled rectangle.

Parameters
x The x-coordinate of the rectangle to draw.
y The y-coordinate of the rectangle to draw.
w The width of the rectangle to draw.
h The height of the rectangle to draw.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer fillRectangle(int x, int y, int w, int h, Color color)

Draws a filled rectangle.

Parameters
x The x-coordinate of the rectangle to draw.
y The y-coordinate of the rectangle to draw.
w The width of the rectangle to draw.
h The height of the rectangle to draw.
color The color to use to fill the rectangle.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer image(ImageRep imgToDraw, int x, int y)

Draws an image onto the already existing image.

Parameters
imgToDraw The image to draw.
x The x-coordinate where the image should get drawn.
y The y-coordinate where the image should get drawn.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer image(Image img, int x, int y)

Draws an image onto the already existing image.

Parameters
img The image to draw.
x The x-coordinate where the image should get drawn.
y The y-coordinate where the image should get drawn.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer line(int x1, int y1, int x2, int y2)

Draws a line.

Parameters
x1 The x-part of the first coordinate of the line to draw.
y1 The y-part of the first coordinate of the line to draw.
x2 The x-part of the second coordinate of the line to draw.
y2 The y-part of the second coordinate of the line to draw.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer line(int x1, int y1, int x2, int y2, Color strokeColor)

Draws a line.

Parameters
x1 The x-part of the first coordinate of the line to draw.
y1 The y-part of the first coordinate of the line to draw.
x2 The x-part of the second coordinate of the line to draw.
y2 The y-part of the second coordinate of the line to draw.
strokeColor The color that should get used for stroke drawing.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer line(int x1, int y1, int x2, int y2, int strokeSize)

Draws a line.

Parameters
x1 The x-part of the first coordinate of the line to draw.
y1 The y-part of the first coordinate of the line to draw.
x2 The x-part of the second coordinate of the line to draw.
y2 The y-part of the second coordinate of the line to draw.
strokeSize The stroke thickness.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer line(int x1, int y1, int x2, int y2, int strokeSize, Color strokeColor)

Draws a line.

Parameters
x1 The x-part of the first coordinate of the line to draw.
y1 The y-part of the first coordinate of the line to draw.
x2 The x-part of the second coordinate of the line to draw.
y2 The y-part of the second coordinate of the line to draw.
strokeSize The line thickness of the line to draw.
strokeColor The color to use for line drawing.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer line(int x1, int y1, int x2, int y2, int r, int g, int b)

Draws a line.

Parameters
x1 The x-part of the first coordinate of the line to draw.
y1 The y-part of the first coordinate of the line to draw.
x2 The x-part of the second coordinate of the line to draw.
y2 The y-part of the second coordinate of the line to draw.
r The red value of the color that should get used for stroke drawing.
g The green value of the color that should get used for stroke drawing.
b The blue value of the color that should get used for stroke drawing.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer line(int x1, int y1, int x2, int y2, int r, int g, int b, int a)

Draws a line.

Parameters
x1 The x-part of the first coordinate of the line to draw.
y1 The y-part of the first coordinate of the line to draw.
x2 The x-part of the second coordinate of the line to draw.
y2 The y-part of the second coordinate of the line to draw.
r The red value of the color that should get used for stroke drawing.
g The green value of the color that should get used for stroke drawing.
b The blue value of the color that should get used for stroke drawing.
a The alpha value of the color that should get used for stroke drawing.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer line(int x1, int y1, int x2, int y2, int strokeSize, int r, int g, int b, int a)

Draws a line.

Parameters
x1 The x-part of the first coordinate of the line to draw.
y1 The y-part of the first coordinate of the line to draw.
x2 The x-part of the second coordinate of the line to draw.
y2 The y-part of the second coordinate of the line to draw.
strokeSize The line thickness of the line to draw.
r The red value of the color to use for line drawing.
g The green value of the color to use for line drawing.
b The blue value of the color to use for line drawing.
a The alpha value of the color to use for line drawing.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer pixel(int x, int y)

Colors a particular pixel on the image by using the color previously set via setStrokeColor. In case no color was set previously, the color black will be used.

Parameters
x The x-coordinate of the pixel that should get colored.
y The y-coordinate of the pixel that should get colored.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer pixel(int x, int y, java.awt.Color color)

Colors a particular pixel on the image.

Parameters
x The x-coordinate of the pixel that should get colored.
y The y-coordinate of the pixel that should get colored.
c The color object that should get used to color that particular pixel.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer pixel(int x, int y, int r, int g, int b)

Colors a particular pixel on the image.

Parameters
x The x-coordinate of the pixel that should get colored.
y The y-coordinate of the pixel that should get colored.
r The red value of the color that should get used to color a particular pixel.
g The green value of the color that should get used to color a particular pixel.
b The blue value of the color that should get used to color a particular pixel.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer pixel(int x, int y, int r, int g, int b, int a)

Colors a particular pixel on the image.

Parameters
x The x-coordinate of the pixel that should get colored.
y The y-coordinate of the pixel that should get colored.
r The red value of the color that should get used to color a particular pixel.
g The green value of the color that should get used to color a particular pixel.
b The blue value of the color that should get used to color a particular pixel.
a The alpha value of the color that should get used to color a particular pixel.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer rectangle(int x, int y, int w, int h)

Draws a rectangle.

Parameters
x The x-coordinate where the rectangle should get drawn.
y The y-coordinate where the rectangle should get drawn.
w The width of the rectangle that should get drawn.
h The height of the rectangle that should get drawn.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer rectangle(int x, int y, int w, int h, int b)

Draws a rectangle.

Parameters
x The x-coordinate where the rectangle should get drawn.
y The y-coordinate where the rectangle should get drawn.
w The width of the rectangle that should get drawn.
h The height of the rectangle that should get drawn.
b The width of the stroke of the rectangle.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer rectangle(int x, int y, int w, int h, int b, Color strokeColor)

Draws a rectangle.

Parameters
x The x-coordinate where the rectangle should get drawn.
y The y-coordinate where the rectangle should get drawn.
w The width of the rectangle that should get drawn.
h The height of the rectangle that should get drawn.
b The width of the stroke of the rectangle.
strokeColor The color to use for the rectangle strokes.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer rectangle(int x, int y, int w, int h, int b, Color strokeColor, Color fillColor)

Draws a rectangle.

Parameters
x The x-coordinate where the rectangle should get drawn.
y The y-coordinate where the rectangle should get drawn.
w The width of the rectangle that should get drawn.
h The height of the rectangle that should get drawn.
b The width of the stroke of the rectangle.
strokeColor The color to use for the rectangle strokes.
fillColor The color to use to fill the rectangle.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer rectangle(int x, int y, int w, int h, int b, int strokeCap, Color strokeColor)

Draws a rectangle.

Parameters
x The x-coordinate where the rectangle should get drawn.
y The y-coordinate where the rectangle should get drawn.
w The width of the rectangle that should get drawn.
h The height of the rectangle that should get drawn.
b The width of the stroke of the rectangle.
strokeCap The stroke caps to use.
strokeColor The color to use for the rectangle strokes.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer rectangle(int x, int y, int w, int h, int b, int strokeCap, Color strokeColor, Color fillColor)

Draws a rectangle.

Parameters
x The x-coordinate where the rectangle should get drawn.
y The y-coordinate where the rectangle should get drawn.
w The width of the rectangle that should get drawn.
h The height of the rectangle that should get drawn.
b The width of the stroke of the rectangle.
strokeCap The stroke cap to use for rectangle drawing.
strokeColor The stroke color to use for rectangle drawing.
fillColor The color to use to fill the rectangle.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer rectangle(int x, int y, int w, int h, int b, int strokeCap, int rstroke, int gstroke, int bstroke, int rfill, int gfill, int bfill)

Draws a rectangle.

Parameters
x The x-coordinate where the rectangle should get drawn.
y The y-coordinate where the rectangle should get drawn.
w The width of the rectangle that should get drawn.
h The height of the rectangle that should get drawn.
b The width of the stroke of the rectangle.
strokeCap The stroke cap to use for rectangle drawing.
rstroke The red value of the color to use for the rectangle strokes.
gstroke The green value of the color to use for the rectangle strokes.
bstroke The blue value of the color to use for the rectangle strokes.
rfill The red value of the color to use to fill the rectangle.
gfill The green value of the color to use to fill the rectangle.
bfill The blue value of the color to use to fill the rectangle.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer rectangle(int x, int y, int w, int h, int b, int strokeCap, int rstroke, int gstroke, int bstroke, int astroke, int rfill, int gfill, int bfill, int afill)

Draws a rectangle.

Parameters
x The x-coordinate where the rectangle should get drawn.
y The y-coordinate where the rectangle should get drawn.
w The width of the rectangle that should get drawn.
h The height of the rectangle that should get drawn.
b The width of the stroke of the rectangle.
strokeCap The stroke cap to use for rectangle drawing.
rstroke The red value of the color to use for the rectangle strokes.
gstroke The green value of the color to use for the rectangle strokes.
bstroke The blue value of the color to use for the rectangle strokes.
astroke The alpha value of the color to use for the rectangle strokes.
rfill The red value of the color to use to fill the rectangle.
gfill The green value of the color to use to fill the rectangle.
bfill The blue value of the color to use to fill the rectangle.
afill The alpha value of the color to use to fill the rectangle.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer setFillColor(java.awt.Color color)

Sets the default fill color.

Parameters
color The new fill color.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer setFillColor(int r, int g, int b)

Sets the default fill color.

Parameters
r The red component of the fill color.
g The green component of the fill color.
b The blue component of the fill color.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer setFillColor(int r, int g, int b, int a)

Sets the default fill color.

Parameters
r The red component of the fill color.
g The green component of the fill color.
b The blue component of the fill color.
a The alpha component of the fill color.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer setFont(java.awt.Font font)

Sets the default font.

Parameters
font The default font to use.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer setFont(String fontName)

Sets the default font.

Parameters
fontName Der Name of the default font to use.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer setFont(String fontName, int size)

Sets the default font.

Parameters
fontName The name of the default font to use.
size The size of the default font to use.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer setFont(String fontName, int size, int style)

Sets the default font.

Parameters
fontName The name of the default font to use.
size The size of the default font to use.
style The style of the default font to use.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer setStrokeCap(int cap)

Set the stroke caps.

Parameters
cap Can either be ImageRepDrawer.CAPS_SQUARED for strokes with squared caps or ImageRepDrawer.CAPS_ROUND for strokes with round caps.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer setStrokeColor(java.awt.Color color)

Sets the default stroke color.

Parameters
color The new color.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer setStrokeColor(int r, int g, int b)

Sets the default stroke color.

Parameters
r The red component of the stroke color.
g The green component of the stroke color.
b The blue component of the stroke color.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer setStrokeColor(int r, int g, int b, int a)

Sets the default stroke color.

Parameters
r The red component of the stroke color.
g The green component of the stroke color.
b The blue component of the stroke color.
a The alpha component of the stroke color.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer setStrokeSize(int size)

Sets the default stroke thickness.

Parameters
size The new default stroke thickness.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer text(int x, int y, String text)

Draws a particular text onto the image.

Parameters
x The x-coordinate of the position where the text should get drawn.
y The y-coordinate of the position where the text should get drawn.
text The text that should get drawn.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer text(int x, int y, String text, Color textColor)

Draws a particular text onto the image.

Parameters
x The x-coordinate of the Position where the text should get drawn.
y The y-coordinate of the Position where the text should get drawn.
text The text that should get drawn.
textColor The color that should get used.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer text(int x, int y, String text, String fontName)

Draws a particular text onto the image.

Parameters
x The x-coordinate of the position where the text should get drawn.
y The y-coordinate of the position where the text should get drawn.
text The text that should get drawn.
fontName The name of the font to use.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer text(int x, int y, String text, Color textColor, Font font)

Draws a particular text onto the image.

Parameters
x The x-coordinate of the Position where the text should get drawn.
y The y-coordinate of the Position where the text should get drawn.
text The text that should get drawn.
textColor The color that should get used.
font The font that should get used.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer text(int x, int y, String text, String fontName, int fontSize)

Draws a particular text onto the image.

Parameters
x The x-coordinate of the position where the text should get drawn.
y The y-coordinate of the position where the text should get drawn.
text The text that should get drawn.
fontName The name of the font to use.
fontSize The font size to use.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer text(int x, int y, String text, int r, int g, int b)

Draws a particular text onto the image.

Parameters
x The x-coordinate of the position where the text should get drawn.
y The y-coordinate of the position where the text should get drawn.
text The text that should get drawn.
r The red value of the color that should get used.
g The green value of the color that should get used.
b The blue value of the color that should get used.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer text(int x, int y, String text, String fontName, int fontSize, int fontStyle)

Draws a particular text onto the image.

Parameters
x The x-coordinate of the position where the text should get drawn.
y The y-coordinate of the position where the text should get drawn.
text The text that should get drawn.
fontName The name of the font to use.
fontSize The font size to use.
fontStyle The font style to use.
ReturnsThe ImageRepDrawer object for method concatination.
 
ImageRepDrawer text(int x, int y, String text, int r, int g, int b, int a)

Draws a particular text onto the image.

Parameters
x The x-coordinate of the position where the text should get drawn.
y The y-coordinate of the position where the text should get drawn.
text The text that should get drawn.
r The red value of the color that should get used.
g The green value of the color that should get used.
b The blue value of the color that should get used.
a The alpha value of the color that should get used.
ReturnsThe ImageRepDrawer object for method concatination.
 
 

In the following examples shows how the ImageRepDrawer method can be used to draw onto an ImageRep object:

from imagewrapper import ImageWrapper
from java.awt import Color
iw = ImageWrapper(rc)

img = iw.loadPng(r"C:/temp/foobar.png")
img.draw().setStrokeSize(12).setStrokeColor(Color.RED).line(20, 20, 2000, 3500) \
    .setStrokeColor(Color.GREEN).setStrokeSize(1).rectangle(40, 45, 250, 300)
rc.logImage(img)
Example 52.53:  Using the ImageRepDrawer object to draw a red line and a green rectangle on an image.