Skip to content
Reference > Classes

Image

Definition

Image var = .... ;

Extends

Extended By

None

Method Summary

Owner Name Return Type Description
Image constructor(imageData) Image Creates a new image, using supplied data. Note that an image can only be declared in Custom Methods (Dashboard --> Custom Methods...).
Image constructor(width, height, hasTransparency) Image Creates a new image with the given width and height and transparency options. Note that an image can only be declared in Custom Methods (Dashboard --> Custom Methods...).
Image dispose() Boolean Disposes of this graphics and releases any system resources that it is using. This object cannot be used after dispose has been called.
Image drawArc(x, y, width, height, startAngle, arcAngle) Boolean Draws a circular or elliptical arc covering the rectangle created using x, y, width, height, start angle and arc angle.
Image drawImage(sourceimage, x, y, newWidth, newHeight, bgColor, method) Boolean Draws the specified image on top of the THIS image.
Image drawLine(x1, y1, x2, y2) Boolean Draws a line between the points (x1, y1) and (x2, y2).
Image drawOval(x, y, width, height) Boolean Draws an oval bounded by the rectangle using (x, y, width, height).
Image drawPolygon(xPoints, yPoints) Boolean Draws a closed polygon defined by lists of x and y coordinates. Closes the polygon if the last coordinate does not match the first.
Image drawPolyline(xPoints, yPoints) Boolean Draws an outline of a polygon defined by lists of x and y coordinates. Does not close the polygon if the the last coordinate does not match the first.
Image drawRect(x, y, width, height) Boolean Draws the outline of the specified rectangle. The left and right edges are at x and width. The top and bottom edges are at y and height.
Image drawRoundRect(x, y, width, height, arcWidth, arcHeight) Boolean Draws the outline of a specified rounded rectangle. The left and right edges are at x and width. The top and bottom edges are at y and height.
Image drawString(str, x, y) Boolean Draws the text given by the specified string. The baseline of the left most character is at position (x, y).
Image fillArc(x, y, width, height, startAngle, arcAngle) Boolean Fills circular or elliptical arc covering the rectangle created using x, y, width, height, start angle and arc angle.
Image fillOval(x, y, width, height) Boolean Fills an oval bounded by the rectangle using x, y, width, height. Ex: Image i = new Image(100, 100, true);
i.setColor("#ff0000");
i.drawOval(0,0, 55, 50);
i.fillOval(0,0,55, 50);
Image fillPolygon(xPoints, yPoints) Boolean Fills the outline of a polygon defined by x and y coordinates.
Image fillRect(x, y, width, height) Boolean Fills the outline of a specified rectangle. The left and right edges are at x and width. The top and bottom edges are at y and height.
Image fillRoundRect(x, y, width, height, arcWidth, arcHeight) Boolean Fills the outline of a specified rounded rectangle. The left and right edges are at x and width. The top and bottom edges are at y and height.
Object getClassName() String Returns the string name of this object's class type.
Image getClip() Rectangle Returns the current clipping area.
Image getColor() String Get this graphics context's current color in hexadecimal format (i.e #ff0000).
Image getFont() String Returns the font associated with the graphics.
Image getHeight() Integer Returns an Integer that is the height in pixels.
Image getPixel(x, y) String Returns the color value of a specific pixel in the form #RRGGBB or #RRGGBBAA if there is an alpha component.
Image getPixelRgb(x, y) String Returns the color value of a specific pixel in the form #RRGGBB
Image getPixelRgba(x, y) String Returns the color value of a specific pixel in the form #RRGGBBAA.
Image getPixelsRgb(x, y, w, h) String Returns the color value of a specific pixel in the form #RRGGBB or #RRGGBBAA if there is an alpha component.
Image getWidth() Integer Returns an Integer that is the width in pixels.
Image setClip(x, y, width, height) Boolean Sets the current clip to the rectangle specified by the given coordinates(x,y). Returns true if successful, false otherwise.
Image setColor(color) Boolean Sets this graphics context's color to specified color. NUll is ignored. Returns true if successful, false otherwise.
Image setFont(fontName, fontStyle, fontSize) Boolean Sets this graphic context's font to specified font. Returns true if successful, false otherwise.
Image toBinary(format) Binary Returns a binary representation of the image.
Image toImage(x, y, width, height, newWidth, newHeight, method) Image Converts THIS image to another image with the specified properties.
Object toJson() String Returns a json representation of this object.
Image translate(x, y) Boolean Translates the origin of the graphic context to the point (x,y) in the current coordinate system. Returns true if operation is successful, false otherwise.

Method Definitions


constructor(imageData)

Image image = new Image(Binary imageData)

Description

Creates a new image, using supplied data. Note that an image can only be declared in Custom Methods (Dashboard --> Custom Methods...).

Parameter Definition

Name Type Description
imageData Binary 

constructor(width,height,hasTransparency)

Image image = new Image(Integer width, Integer height, Boolean hasTransparency)

Description

Creates a new image with the given width and height and transparency options. Note that an image can only be declared in Custom Methods (Dashboard --> Custom Methods...).

Parameter Definition

Name Type Description
width Integer  width in px
height Integer  height in px
hasTransparency Boolean  has Transparency, or known as alpha

dispose()

Boolean Image::dispose()

Description

Disposes of this graphics and releases any system resources that it is using. This object cannot be used after dispose has been called.


drawArc(x,y,width,height,startAngle,arcAngle)

Boolean Image::drawArc(Integer x, Integer y, Integer width, Integer height, Integer startAngle, Integer arcAngle)

Description

Draws a circular or elliptical arc covering the rectangle created using x, y, width, height, start angle and arc angle.

Parameter Definition

Name Type Description
x Integer  x coordinate of the upper-left corner of the arc
y Integer  y coordinate of the upper-left corner of the arc
width Integer  wdith of the arc
height Integer  height of the arc
startAngle Integer  the beginning angle
arcAngle Integer  the angular extent of the arc, relative to the start angle

drawImage(sourceimage,x,y,newWidth,newHeight,bgColor,method)

Boolean Image::drawImage(Image sourceimage, Integer x, Integer y, Integer newWidth, Integer newHeight, String bgColor, Integer method)

Description

Draws the specified image on top of the THIS image.

Parameter Definition

Name Type Description
sourceimage Image  Source Image to draw on this image
x Integer  x (default is 0)
y Integer  y (default is 0)
newWidth Integer  width (default is soure image width)
newHeight Integer  height (default is source image height)
bgColor String 
method Integer  1 = STRETCH, 2 = CROP, 3 = PAD, 4 = SCALE_USING_HEIGHT or 5 = SCALE_USING_WIDTH

drawLine(x1,y1,x2,y2)

Boolean Image::drawLine(Integer x1, Integer y1, Integer x2, Integer y2)

Description

Draws a line between the points (x1, y1) and (x2, y2).

Parameter Definition

Name Type Description
x1 Integer  x1 coordinate
y1 Integer  y1 coordinate
x2 Integer  x2 coordinate
y2 Integer  y2 coordinate

drawOval(x,y,width,height)

Boolean Image::drawOval(Integer x, Integer y, Integer width, Integer height)

Description

Draws an oval bounded by the rectangle using (x, y, width, height).

Parameter Definition

Name Type Description
x Integer  x coordinate of the upper-left corner of the oval
y Integer  y coordinate of the upper-left corner of the oval
width Integer  wdith of the oval
height Integer  height of the oval

drawPolygon(xPoints,yPoints)

Boolean Image::drawPolygon(List xPoints, List yPoints)

Description

Draws a closed polygon defined by lists of x and y coordinates. Closes the polygon if the last coordinate does not match the first.

Parameter Definition

Name Type Description
xPoints List  list of x coordinates
yPoints List  list of y coordinates

drawPolyline(xPoints,yPoints)

Boolean Image::drawPolyline(List xPoints, List yPoints)

Description

Draws an outline of a polygon defined by lists of x and y coordinates. Does not close the polygon if the the last coordinate does not match the first.

Parameter Definition

Name Type Description
xPoints List  list of x coordinates
yPoints List  list of y coordinates

drawRect(x,y,width,height)

Boolean Image::drawRect(Integer x, Integer y, Integer width, Integer height)

Description

Draws the outline of the specified rectangle. The left and right edges are at x and width. The top and bottom edges are at y and height.

Parameter Definition

Name Type Description
x Integer  x coordinate
y Integer  y coordinate
width Integer  width of the rectangle
height Integer  height of the rectangle

drawRoundRect(x,y,width,height,arcWidth,arcHeight)

Boolean Image::drawRoundRect(Integer x, Integer y, Integer width, Integer height, Integer arcWidth, Integer arcHeight)

Description

Draws the outline of a specified rounded rectangle. The left and right edges are at x and width. The top and bottom edges are at y and height.

Parameter Definition

Name Type Description
x Integer  x coordinate
y Integer  y coordinate
width Integer  width of the rectangle
height Integer  height of the rectangle
arcWidth Integer  the horizontal diameter of the arc at the four corners
arcHeight Integer  the vertical diameter of the arc at the four corners

drawString(str,x,y)

Boolean Image::drawString(String str, Integer x, Integer y)

Description

Draws the text given by the specified string. The baseline of the left most character is at position (x, y).

Parameter Definition

Name Type Description
str String  string to be drawn
x Integer  x coordinate of the baseline
y Integer  y coordinate of the baseline

fillArc(x,y,width,height,startAngle,arcAngle)

Boolean Image::fillArc(Integer x, Integer y, Integer width, Integer height, Integer startAngle, Integer arcAngle)

Description

Fills circular or elliptical arc covering the rectangle created using x, y, width, height, start angle and arc angle.

Parameter Definition

Name Type Description
x Integer  x coordinate of the upper-left corner of the arc
y Integer  y coordinate of the upper-left corner of the arc
width Integer  wdith of the arc
height Integer  height of the arc
startAngle Integer  the beginning angle
arcAngle Integer  the angular extent of the arc, relative to the start angle

fillOval(x,y,width,height)

Boolean Image::fillOval(Integer x, Integer y, Integer width, Integer height)

Description

Fills an oval bounded by the rectangle using x, y, width, height. Ex: Image i = new Image(100, 100, true); i.setColor("#ff0000"); i.drawOval(0,0, 55, 50); i.fillOval(0,0,55, 50);

Parameter Definition

Name Type Description
x Integer  x coordinate of the upper-left corner of the oval
y Integer  y coordinate of the upper-left corner of the oval
width Integer  wdith of the oval
height Integer  height of the oval

fillPolygon(xPoints,yPoints)

Boolean Image::fillPolygon(List xPoints, List yPoints)

Description

Fills the outline of a polygon defined by x and y coordinates.

Parameter Definition

Name Type Description
xPoints List  list of x coordinates
yPoints List  list of y coordinates

fillRect(x,y,width,height)

Boolean Image::fillRect(Integer x, Integer y, Integer width, Integer height)

Description

Fills the outline of a specified rectangle. The left and right edges are at x and width. The top and bottom edges are at y and height.

Parameter Definition

Name Type Description
x Integer  x coordinate
y Integer  y coordinate
width Integer  width of the rectangle
height Integer  height of the rectangle

fillRoundRect(x,y,width,height,arcWidth,arcHeight)

Boolean Image::fillRoundRect(Integer x, Integer y, Integer width, Integer height, Integer arcWidth, Integer arcHeight)

Description

Fills the outline of a specified rounded rectangle. The left and right edges are at x and width. The top and bottom edges are at y and height.

Parameter Definition

Name Type Description
x Integer  x coordinate
y Integer  y coordinate
width Integer  width of the rectangle
height Integer  height of the rectangle
arcWidth Integer  the horizontal diameter of the arc at the four corners
arcHeight Integer  the vertical diameter of the arc at the four corners

getClip()

Rectangle Image::getClip()

Description

Returns the current clipping area.


getColor()

String Image::getColor()

Description

Get this graphics context's current color in hexadecimal format (i.e #ff0000).


getFont()

String Image::getFont()

Description

Returns the font associated with the graphics.


getHeight()

Integer Image::getHeight()

Description

Returns an Integer that is the height in pixels.


getPixel(x,y)

String Image::getPixel(Integer x, Integer y)

Description

Returns the color value of a specific pixel in the form #RRGGBB or #RRGGBBAA if there is an alpha component.

Parameter Definition

Name Type Description
x Integer  x position where left most is 0
y Integer  y position where top most is 0

getPixelRgb(x,y)

String Image::getPixelRgb(Integer x, Integer y)

Description

Returns the color value of a specific pixel in the form #RRGGBB

Parameter Definition

Name Type Description
x Integer  x position where left most is 0
y Integer  y position where top most is 0

getPixelRgba(x,y)

String Image::getPixelRgba(Integer x, Integer y)

Description

Returns the color value of a specific pixel in the form #RRGGBBAA.

Parameter Definition

Name Type Description
x Integer  x position where left most is 0
y Integer  y position where top most is 0

getPixelsRgb(x,y,w,h)

String Image::getPixelsRgb(Integer x, Integer y, Integer w, Integer h)

Description

Returns the color value of a specific pixel in the form #RRGGBB or #RRGGBBAA if there is an alpha component.

Parameter Definition

Name Type Description
x Integer  x position where left most is 0
y Integer  y position where top most is 0
w Integer  widht in px
h Integer  height in px

getWidth()

Integer Image::getWidth()

Description

Returns an Integer that is the width in pixels.


setClip(x,y,width,height)

Boolean Image::setClip(Integer x, Integer y, Integer width, Integer height)

Description

Sets the current clip to the rectangle specified by the given coordinates(x,y). Returns true if successful, false otherwise.

Parameter Definition

Name Type Description
x Integer  x coordinate
y Integer  y coordinate
width Integer  width of the clip
height Integer  height of the clip

setColor(color)

Boolean Image::setColor(String color)

Description

Sets this graphics context's color to specified color. NUll is ignored. Returns true if successful, false otherwise.

Parameter Definition

Name Type Description
color String  hexadecimal color code (i.e. #ff00ff)

setFont(fontName,fontStyle,fontSize)

Boolean Image::setFont(String fontName, String fontStyle, Integer fontSize)

Description

Sets this graphic context's font to specified font. Returns true if successful, false otherwise.

Parameter Definition

Name Type Description
fontName String  name of the font (i.e. serif, monospaced, verdana)
fontStyle String  PLAIN, ITALIC, BOLD (can also be used in combination with a pipe delimiter)
fontSize Integer  size of the font

toBinary(format)

Binary Image::toBinary(String format)

Description

Returns a binary representation of the image.

Parameter Definition

Name Type Description
format String  format: JPEG,PNG, GIF, BMP, WBMP

toImage(x,y,width,height,newWidth,newHeight,method)

Image Image::toImage(Integer x, Integer y, Integer width, Integer height, Integer newWidth, Integer newHeight, Integer method)

Description

Converts THIS image to another image with the specified properties.

Parameter Definition

Name Type Description
x Integer  x coordinate of the upper-left corner of the new image
y Integer  y coordinate of the upper-left corner of the new image
width Integer 
height Integer 
newWidth Integer  width of the new image
newHeight Integer  height of the new image
method Integer  1 = STRETCH, 2 = CROP, 3 = PAD, 4 = SCALE_USING_HEIGHT or 5 = SCALE_USING_WIDTH

translate(x,y)

Boolean Image::translate(Number x, Number y)

Description

Translates the origin of the graphic context to the point (x,y) in the current coordinate system. Returns true if operation is successful, false otherwise.

Parameter Definition

Name Type Description
x Number  x coordinate
y Number  y coordinate