public class BBXImage
BBXImage
utility provides an object-oriented way to manipulate an image in a variety of ways.
Obtain the BBXImage
from a BBjImage, from a file on the server, or from a URL such as an HTTP URL that retrieves an image from the Internet.
You can then modify the BBXImage
in a number of ways and affect its scale (as a percentage or proportional to width or height),
rotation, and opacity. It is also possible to add borders, drop shadows, reflections, and even crop the corners of the image.
After manipulating the BBXImage
, the class offers methods to save it in a variety of image formats such as a PNG or JPG file with a configurable compression percentage.
In BBj 15.0 and higher, the
BBXImage
Utility provides filtering methods to
In BBj 16.0 and higher, the BBXImage
Utility provides methods to
In BBj 17.0 and higher, the BBXImage
Utility provides a method to
In BBj 18.0 and higher, the BBXImage
Utility provides methods to
In BBj 19.0 and higher, the BBXImage
Utility provides methods to
In BBj 21.12 and higher, the BBXImage
Utility has been updated with the following features:
BBXImage
. This makes it possible to chain multiple method calls, as in:
xImage!.scale(100, 100).rotate(90).saveAsPNG("myScaledAndRotatedeImage.png")
drawText()
method allows you to draw single or multiline text on the BBXImage
providing values for foreground/background color, font, alignment, and offsets.
<bbjhome>/utils/
directory is in your prefix. The BBXImage.bbj
source program is located there,
so if that directory is in your prefix then the utility will be accessible in your applications.USE
statement for the utility so that your application can reference the custom class and provide code completion for its methods.
The USE
statement should look like this:USE ::BBXImage.bbj::BBXImage
BBXImage
class in your application, the process goes something like this:
BBXImage
object from something like a BBjImage, a Java Image or ImageIcon, URL, etc:
declare BBXImage xImage!
xImage! = new BBXImage(mySource!)
xImage!.scaleProportionally(maxWidth, maxHeight)
myImageCtrl!.setImage(xImage!.getBBjImage())
xImage!.saveAsJPG(fullPathToJpgFile$, compressionLevel75)
313
: Invalid color specified. The specified string for a hex color description was invalid. It should in a format like #fafbfc
or #f0c
.400
: Invalid image source provided or missing file.Constructor and Description |
---|
BBXImage(BBXImage p_bbximage!) BBXImage Constructor specifying another BBXImage for the source image |
BBXImage(javax.swing.ImageIcon p_imageIcon!) BBXImage Constructor specifying an ImageIcon for the source image |
BBXImage(Image p_image!) BBXImage Constructor specifying a Java Image object for the source image |
BBXImage(URL p_imageURL!) BBXImage Constructor specifying a Java URL object for the source image |
BBXImage(File p_imageFile!) BBXImage Constructor specifying a Java File object for the source image's file path |
BBXImage(BBjString p_imageFile!) BBXImage Constructor specifying a string for the source image's file path |
BBXImage(BBjImage p_image!) BBXImage Constructor specifying a BBjImage for the source image |
BBXImage(BBjString p_text$, BBjString p_foreColor$, BBjNumber p_foreOpacity, BBjString p_backColor$, BBjNumber p_backOpacity, Font p_font!, BBjNumber p_width, BBjNumber p_height, BBjNumber p_hAlign, BBjNumber p_vAlign, BBjNumber p_hPadding, BBjNumber p_vPadding) BBXImage Constructor that creates a BBXImage object by drawing text on a graphics context. Multi-line strings are denoted by including a linebreak ($0A$) between the lines of text. |
Modifier and Type | Method and Description |
---|---|
Image | addColorOverlay(BBjColor p_color!) Method to overlay the BBXImage with a BBjColor (which usually has an alpha component) |
Image | addColorOverlay(BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity) Method to overlay the BBXImage with a color (which usually has an alpha component) |
static BBjNumber | ALIGN_BOTTOM() A constant value that's used to denote bottom vertical alignment |
static BBjNumber | ALIGN_CENTER() A constant value that's used to denote center horizontal alignment |
static BBjNumber | ALIGN_LEFT() A constant value that's used to denote left horizontal alignment |
static BBjNumber | ALIGN_MIDDLE() A constant value that's used to denote middle vertical alignment |
static BBjNumber | ALIGN_RIGHT() A constant value that's used to denote right horizontal alignment |
static BBjNumber | ALIGN_TOP() A constant value that's used to denote top vertical alignment |
Image | clone() Method to get a copy of the BBXImage |
Image | crop(BBjNumber p_x, BBjNumber p_y, BBjNumber p_w, BBjNumber p_h) Method to crop the BBXImage to a specified rectangular region |
Image | cropBackground() Method to return the smallest image possible by cropping out the background of the original image using the top left pixel's color as the base background color to crop out. |
Image | cropTransparent() Method to return the smallest image possible by cropping out the transparent edges of the original image |
Image | drawFilledOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, Color p_outlineColor!, Color p_fillColor!) Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. Note that specifying the same value for the width and height results in a circle. |
Image | drawFilledOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjColor p_outlineColor!, BBjColor p_fillColor!, BBjNumber p_rotation) Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. Note that specifying the same value for the width and height results in a circle. |
Image | drawFilledOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, Color p_outlineColor!, Color p_fillColor!, BBjNumber p_rotation) Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. Note that specifying the same value for the width and height results in a circle. |
Image | drawFilledRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, Color p_outlineColor!, Color p_fillColor!) Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. |
Image | drawFilledRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjColor p_outlineColor!, BBjColor p_fillColor!, BBjNumber p_rotation) Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. |
Image | drawFilledRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, Color p_outlineColor!, Color p_fillColor!, BBjNumber p_rotation) Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. |
Image | drawOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, Color p_color!) Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. Note that specifying the same value for the width and height results in a circle. |
Image | drawOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjColor p_color!) Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. Note that specifying the same value for the width and height results in a circle. |
Image | drawOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity) Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. Note that specifying the same value for the width and height results in a circle. |
Image | drawOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity, BBjNumber p_rotation) Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. Note that specifying the same value for the width and height results in a circle. |
Image | drawRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjColor p_color!) Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. |
Image | drawRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, Color p_color!) Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. |
Image | drawRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity) Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. |
Image | drawRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity, BBjNumber p_rotation) Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line. |
Image | drawText(BBjString p_text$, BBjString p_foreColorHexString$, BBjString p_backColorHexString$, Font p_javaFont!, BBjNumber p_offsetX, BBjNumber p_offsetY, BBjNumber p_hAlign, BBjNumber p_vAlign) Draws the specified text on the current BBXImage object. Multi-line strings are denoted by including a linebreak ($0A$) between the lines of text. |
BBjNumber | exists() Method to determine whether the BBXImage exists or not |
Image | flipHorizontally() Method to flip the BBXImage horizontally |
Image | flipVertically() Method to flip the BBXImage vertically |
BBjString | getBase64() Method to return the BBXImage out to an Image Output Stream 32-bit converted to a Base64 ASCII Stream |
BBjImage | getBBjImage() Method to get a BBjImage for the BBXImage |
Image | getBufferedImage() Method to get a BufferedImage of type BufferedImage.TYPE_INT_ARGB from the BBXImage |
Image | getBufferedImage(BBjNumber p_bufferedImageType!) Method to get a BufferedImage from the BBXImage |
static Color | getColorFromHexString(BBjString p_colorHexString$) Method to create a Java Color from a hex string. As of BBj 21.12, this method supports hex color string with an alpha channel. |
static Color | getColorWithAlphaFromHexString(BBjString p_colorHexString$, BBjNumber p_opacity) Method to create a Java Color with an alpha channel from a hex string |
static BBjNumber | getDecimalFromHex(BBjString p_hexValue$) Method to convert 2-digit hexadecimal number to a decimal number in the range from 0-255 |
BBjString | getDescription() Method to get the description of the BBXImage |
BBjNumber | getHeight() Method to get the height of the BBXImage |
static BBjString | getHexStringFromColor(Color p_color!) Method to get a hex representation of a Java Color with an alpha channel |
Image | getImage() Method to get an ImageIcon from the BBXImage |
Image | getImageIcon() Method to get an ImageIcon from the BBXImage |
Image | getSubimage(BBjNumber p_x, BBjNumber p_y, BBjNumber p_w, BBjNumber p_h) Method to return a BBXImage that is a subimage defined by a specified rectangular region |
BBjNumber | getWidth() Method to get the width of the BBXImage |
Image | rotate(BBjNumber p_degrees) Method to rotate the BBXImage The image will be rotated around the center point, and a positive rotation angle corresponds to rotating the image in a clockwise fashion. Note that the new image will be larger than the original image to avoid truncating rotated edges. |
Image | roundBottomCorners(BBjNumber arcWidth, BBjNumber arcHeight) Method to round the bottom corners (knockout) of the BBXImage given a cornerRadius |
Image | roundCorners(BBjNumber arcWidth, BBjNumber arcHeight) Method to round the corners (knockout) of the BBXImage given a cornerRadius |
Image | roundTopCorners(BBjNumber arcWidth, BBjNumber arcHeight) Method to round the top corners (knockout) of the BBXImage given a cornerRadius |
void | saveAsBMP(BBjString p_imageFile$) Method to save the BBXImage out to a .bmp file |
void | saveAsGIF(BBjString p_imageFile$) Method to save the BBXImage out to a .gif file |
void | saveAsJPG(BBjString p_imageFile$, BBjNumber p_compressionLevelPercentage) Method to save the BBXImage out to a .jpg file |
void | saveAsPNG(BBjString p_imageFile$) Method to save the BBXImage out to a 32-bit .png file with transparency |
void | saveAsTIFF(BBjString p_imageFile$) Method to save the BBXImage out to a .tiff file |
Image | scale(BBjNumber p_width, BBjNumber p_height) Method to scale the BBXImage given a width and height Note: This method of scaling uses the java.awt.Image::getScaledInstance() method with the Image.SCALE_AREA_AVERAGING rendering hint. |
Image | scale(BBjNumber p_percentage) Method to scale the BBXImage given a percentage |
Image | scaleHeight(BBjNumber p_width) Method to scale the BBXImage preserving the aspect ratio given the width |
Image | scaleProportionally(BBjNumber p_maxDimension) Method to scale the BBXImage preserving the aspect ratio given the maximum width or height dimension. This method is useful in the case where you'd like to resize the source image ensuring that it will maintain its original proportions and will fit within a square of a particular size. |
Image | scaleProportionally(BBjNumber p_maxWidth, BBjNumber p_maxHeight) Method to scale the BBXImage preserving the aspect ratio given the maximum width and height dimensions. This method is useful in the case where you'd like to resize the source image ensuring that it will maintain its original proportions and will fit within a rectangle of a particular size. |
Image | scaleProportionallyAndResizeCanvas(BBjNumber p_maxWidth, BBjNumber p_maxHeight) Method to scale the BBXImage preserving the aspect ratio given the maximum width and height dimensions, and then resize the canvas so that the image will be resized to the specified width and height. The original image will be centered in the final image and any extra space will be transparent. This method is useful in the case where you'd like to resize the source image ensuring that it will maintain its original proportions and will fit within a rectangle of a particular size. |
Image | scaleProportionallyResizeCanvasAndSetImage(BBjNumber p_maxWidth, BBjNumber p_maxHeight, BBjImageCtrl p_imgCtrl!) Method to scale the BBXImage preserving the aspect ratio given the maximum width and height dimensions, then resize the canvas so that the image will be resized to the specified width and height. The original image will be centered in the final image and any extra space will be transparent. The final image will then be used to set the contents of the specified BBjImageCtrl This method is useful in the case where you'd like to resize the an image ensuring that it will maintain its original proportions and will fit within a BBjImageCtrl of a particular size. |
Image | scaleWidth(BBjNumber p_height) Method to scale the BBXImage preserving the aspect ratio given the height |
Image | scaleWithHints(BBjNumber p_width, BBjNumber p_height, HashMap p_renderingHintsMap!) Method to scale the BBXImage given a width and height and HashMap of Graphics2D rendering hints Java's RenderingHints allow you to specify the interpolation method used when scaling the image. The possible values are:
Generally speaking, the interpolations values shown above range from quickest with poorest quality (VALUE_INTERPOLATION_NEAREST_NEIGHBOR) to slowest with best quality (VALUE_INTERPOLATION_BICUBIC). In practice, bilinear and bicubic interpolation produce results that are very similar. Bicubic will be slightly sharper than bilinear, with a bit more emphasis on edges. That translates to bicubic often being a better choice for image reduction, whereas blinear is usually better for image enlargement. Following is a short example showing how to use this method:
|
Image | setBorder(BBjNumber borderSize, BBjColor color!) Method to add a border to the BBXImage |
Image | setBorder(BBjNumber borderSize, BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity) Method to add a border to the BBXImage |
Image | setCanvasSize(BBjNumber p_width, BBjNumber p_height) Method to resize the BBXImage's canvas, specifying transparent for the fill color. |
Image | setCanvasSize(BBjNumber p_width, BBjNumber p_height, BBjColor p_color!) Method to resize the BBXImage's canvas. If the canvas size is larger than the BBXImage's size, then the extra space will be filled with the specified color and the original image will be centered in the new canvas. If the canvas is smaller than the BBXImage then it will be centered and cropped to fit, resulting in the removal of the edges. |
Image | setCanvasSize(BBjNumber p_width, BBjNumber p_height, BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity) Method to resize the BBXImage's canvas. If the canvas size is larger than the BBXImage's size, then the extra space will be filled with the specified color and the original image will be centered in the new canvas. If the canvas is smaller than the BBXImage then it will be centered and cropped to fit, resulting in the removal of the edges. |
Image | setCornerWaterMark(BBXImage watermarkImage!, BBjNumber opacity, BBjNumber width, BBjNumber height, BBjNumber anchorPoint) Method to add a watermark logo to the BBXImage |
Image | setDescription(BBjString p_description$) Method to set the description of the BBXImage |
Image | setDropShadow(BBjNumber shadowSize, BBjNumber shadowOpacity, BBjNumber xOffset, BBjNumber yOffset) Method to add a drop shadow to the BBXImage |
Image | setFilterBlur(BBjNumber p_blurAmount) Method to filter the BBXImage and increase the blurriness |
Image | setFilterBrightness(BBjNumber p_fraction) Method to adjust the brightness of the BBXImage |
Image | setFilterContrast(BBjNumber p_fraction) Method to adjust the contrast of the BBXImage |
Image | setFilterGrayscale() Method to filter the BBXImage and convert it to grayscale (completely desaturated) |
Image | setFilterSharpen(BBjNumber p_sharpenAmount) Method to filter the BBXImage and increase the sharpness |
Image | setImageIcon(javax.swing.ImageIcon p_imageIcon!) Method to set the ImageIcon for the BBXImage |
Image | setOpacity(BBjNumber p_percentTransparent) Method to set the transparency of the BBXImage |
Image | setReflection(BBjNumber reflectionLength, BBjNumber reflectionOpacity, BBjNumber blurred, BBjNumber verticalSpace) Method to add a reflection to the BBXImage |
public BBXImage(BBXImage p_bbximage!)
BBXImage Constructor specifying another BBXImage for the source image
In BBj 15.10 and higher
public BBXImage(javax.swing.ImageIcon p_imageIcon!)
BBXImage Constructor specifying an ImageIcon for the source image
public BBXImage(Image p_image!)
BBXImage Constructor specifying a Java Image object for the source image
http://docs.oracle.com/javase/8/docs/api/java/awt/Image.html
public BBXImage(URL p_imageURL!)
BBXImage Constructor specifying a Java URL object for the source image
http://docs.oracle.com/javase/8/docs/api/java/net/URL.html
public BBXImage(File p_imageFile!)
BBXImage Constructor specifying a Java File object for the source image's file path
http://docs.oracle.com/javase/8/docs/api/java/io/File.html
public BBXImage(BBjString p_imageFile!)
BBXImage Constructor specifying a string for the source image's file path
public BBXImage(BBjImage p_image!)
BBXImage Constructor specifying a BBjImage for the source image
public BBXImage(BBjString p_text$, BBjString p_foreColor$, BBjNumber p_foreOpacity, BBjString p_backColor$, BBjNumber p_backOpacity, Font p_font!, BBjNumber p_width, BBjNumber p_height, BBjNumber p_hAlign, BBjNumber p_vAlign, BBjNumber p_hPadding, BBjNumber p_vPadding)
BBXImage Constructor that creates a BBXImage object by drawing text on a graphics context. Multi-line strings are denoted by including a linebreak ($0A$) between the lines of text.
p_text$
The text string to drawp_foreColor$
The foreground color of the resultant text specified as a hex color string. An example would be "#ff00cc"p_foreOpacity
The desired opacity value (0-1) of the foreground color. 0=Fully Transparent, 1=Fully Opaque.p_backColor$
The background color of the resultant text specified as a hex color string. An example would be "#ff00cc"p_backOpacity
The desired opacity value (0-1) of the background color. 0=Fully Transparent, 1=Fully Opaque.p_font!
The Java Font used to draw the textp_width
The width of the resultant Image (0 to automatically determine the width)p_height
The height of the resultant Image (0 to automatically determine the height)p_hAlign
The horizontal text alignment: 0=Left, 1=Center, 2=Right or constants like BBXImage.ALIGN_LEFT()
, BBXImage.ALIGN_CENTER()
, BBXImage.ALIGN_RIGHT()
p_vAlign
The vertical text alignment: 0=Top, 1=Middle, 2=Bottom or constants like BBXImage.ALIGN_TOP()
, BBXImage.ALIGN_MIDDLE()
, BBXImage.ALIGN_BOTTOM()
p_hPadding
The number of pixels of padding to be added horizontally (added to the left and right sides)p_vPadding
The number of pixels of padding to be added vertically (added to the top and bottom sides) In BBj 15.10 and higher
public Image addColorOverlay(BBjColor p_color!)
Method to overlay the BBXImage with a BBjColor (which usually has an alpha component)
BBjColor
The BBjColor to place over the BBXImagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 18.10 and higher
public Image addColorOverlay(BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity)
Method to overlay the BBXImage with a color (which usually has an alpha component)
red
The red component of the color (0 - 1) to place over the BBXImagegreen
The green component of the color (0 - 1) to place over the BBXImageblue
The blue component of the color (0 - 1) to place over the BBXImageopacity
The opacity component of the color (0 - 1) to place over the BBXImagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 18.10 and higher
public static BBjNumber ALIGN_BOTTOM()
A constant value that's used to denote bottom vertical alignment
BBj 21.12
public static BBjNumber ALIGN_CENTER()
A constant value that's used to denote center horizontal alignment
BBj 21.12
public static BBjNumber ALIGN_LEFT()
A constant value that's used to denote left horizontal alignment
BBj 21.12
public static BBjNumber ALIGN_MIDDLE()
A constant value that's used to denote middle vertical alignment
BBj 21.12
public static BBjNumber ALIGN_RIGHT()
A constant value that's used to denote right horizontal alignment
BBj 21.12
public static BBjNumber ALIGN_TOP()
A constant value that's used to denote top vertical alignment
BBj 21.12
public Image clone()
Method to get a copy of the BBXImage
In BBj 15.0 and higher
public Image crop(BBjNumber p_x, BBjNumber p_y, BBjNumber p_w, BBjNumber p_h)
Method to crop the BBXImage to a specified rectangular region
p_x
The X coordinate of the upper-left corner of the specified rectangular regionp_y
The Y coordinate of the upper-left corner of the specified rectangular regionp_w
The width of the specified rectangular regionp_h
height of the specified rectangular regionmyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 18.10 and higher
public Image cropBackground()
Method to return the smallest image possible by cropping out the background of the original image using the top left pixel's color as the base background color to crop out.
myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
cropTransparent()
In BBj 16.20 and higher
public Image cropTransparent()
Method to return the smallest image possible by cropping out the transparent edges of the original image
myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
cropBackground()
In BBj 15.0 and higher
public Image drawFilledOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, Color p_outlineColor!, Color p_fillColor!)
Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
Note that specifying the same value for the width and height results in a circle.
p_x
The desired x coordinate of the rectanglep_y
The desired y coordinate of the rectanglep_width
The desired width of the rectanglep_height
The desired height of the rectanglep_thickness
The desired thickness of the rectanglep_outlineColor!
The Java Color that will be used to draw the shapep_fillColor!
The Java Color that will be used to fill the shapemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.10 and higher
public Image drawFilledOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjColor p_outlineColor!, BBjColor p_fillColor!, BBjNumber p_rotation)
Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
Note that specifying the same value for the width and height results in a circle.
p_x
The desired x coordinate of the rectanglep_y
The desired y coordinate of the rectanglep_width
The desired width of the rectanglep_height
The desired height of the rectanglep_thickness
The desired thickness of the rectanglep_outlineColor!
The BBjColor that will be used to draw the shapep_fillColor!
The BBjColor that will be used to fill the shapep_rotation
The angle in degrees to rotate the shape around its centermyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 18.10 and higher
public Image drawFilledOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, Color p_outlineColor!, Color p_fillColor!, BBjNumber p_rotation)
Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
Note that specifying the same value for the width and height results in a circle.
p_x
The desired x coordinate of the rectanglep_y
The desired y coordinate of the rectanglep_width
The desired width of the rectanglep_height
The desired height of the rectanglep_thickness
The desired thickness of the rectanglep_outlineColor!
The Java Color that will be used to draw the shapep_fillColor!
The Java Color that will be used to fill the shapep_rotation
The angle in degrees to rotate the shape around its centermyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.10 and higher
public Image drawFilledRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, Color p_outlineColor!, Color p_fillColor!)
Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
p_x
The desired x coordinate of the rectanglep_y
The desired y coordinate of the rectanglep_width
The desired width of the rectanglep_height
The desired height of the rectanglep_thickness
The desired thickness of the rectanglep_outlineColor!
The Java Color that will be used to draw the shapep_fillColor!
The Java Color that will be used to fill the shapemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.10 and higher
public Image drawFilledRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjColor p_outlineColor!, BBjColor p_fillColor!, BBjNumber p_rotation)
Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
p_x
The desired x coordinate of the rectanglep_y
The desired y coordinate of the rectanglep_width
The desired width of the rectanglep_height
The desired height of the rectanglep_thickness
The desired thickness of the rectanglep_outlineColor!
The BBjColor that will be used to draw the shapep_fillColor!
The BBjColor that will be used to fill the shapep_rotation
The angle in degrees to rotate the shape around its centermyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 18.10 and higher
public Image drawFilledRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, Color p_outlineColor!, Color p_fillColor!, BBjNumber p_rotation)
Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
p_x
The desired x coordinate of the rectanglep_y
The desired y coordinate of the rectanglep_width
The desired width of the rectanglep_height
The desired height of the rectanglep_thickness
The desired thickness of the rectanglep_outlineColor!
The Java Color that will be used to draw the shapep_fillColor!
The Java Color that will be used to fill the shapep_rotation
The angle in degrees to rotate the shape around its centermyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.10 and higher
public Image drawOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, Color p_color!)
Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
Note that specifying the same value for the width and height results in a circle.
p_x
The desired x coordinate of the ovalp_y
The desired y coordinate of the ovalp_width
The desired width of the ovalp_height
The desired height of the ovalp_thickness
The desired thickness of the ovalp_color
The Java Color that will be used to draw the shapemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.10 and higher
public Image drawOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjColor p_color!)
Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
Note that specifying the same value for the width and height results in a circle.
p_x
The desired x coordinate of the ovalp_y
The desired y coordinate of the ovalp_width
The desired width of the ovalp_height
The desired height of the ovalp_thickness
The desired thickness of the ovalp_color!
The oval's color expressed as a BBjColormyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 18.10 and higher
public Image drawOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity)
Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
Note that specifying the same value for the width and height results in a circle.
p_x
The desired x coordinate of the ovalp_y
The desired y coordinate of the ovalp_width
The desired width of the ovalp_height
The desired height of the ovalp_thickness
The desired thickness of the ovalred
The red component of the oval's color (0 - 1)green
The green component of the oval's color (0 - 1)blue
The blue component of the oval's color (0 - 1)opacity
The opacity component of the oval's color (0 - 1)myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.02 and higher
public Image drawOval(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity, BBjNumber p_rotation)
Method to draw an oval on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
Note that specifying the same value for the width and height results in a circle.
p_x
The desired x coordinate of the ovalp_y
The desired y coordinate of the ovalp_width
The desired width of the ovalp_height
The desired height of the ovalp_thickness
The desired thickness of the ovalred
The red component of the oval's color (0 - 1)green
The green component of the oval's color (0 - 1)blue
The blue component of the oval's color (0 - 1)opacity
The opacity component of the oval's color (0 - 1)p_rotation
The angle in degrees to rotate the shape around its centermyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.02 and higher
public Image drawRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjColor p_color!)
Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
p_x
The desired x coordinate of the rectanglep_y
The desired y coordinate of the rectanglep_width
The desired width of the rectanglep_height
The desired height of the rectanglep_thickness
The desired thickness of the rectanglep_color!
The BBjColor that will be used to draw the shapemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 18.10 and higher
public Image drawRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, Color p_color!)
Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
p_x
The desired x coordinate of the rectanglep_y
The desired y coordinate of the rectanglep_width
The desired width of the rectanglep_height
The desired height of the rectanglep_thickness
The desired thickness of the rectanglep_color!
The Java Color that will be used to draw the shapemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.10 and higher
public Image drawRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity)
Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
p_x
The desired x coordinate of the rectanglep_y
The desired y coordinate of the rectanglep_width
The desired width of the rectanglep_height
The desired height of the rectanglep_thickness
The desired thickness of the rectanglered
The red component of the rectangle's color (0 - 1)green
The green component of the rectangle's color (0 - 1)blue
The blue component of the rectangle's color (0 - 1)opacity
The opacity component of the rectangle's color (0 - 1)myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.10 and higher
public Image drawRect(BBjNumber p_x, BBjNumber p_y, BBjNumber p_width, BBjNumber p_height, BBjNumber p_thickness, BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity, BBjNumber p_rotation)
Method to draw a rectangle on the BBXImage's canvas, specifying the thickness of the line and the color/opacity of the line.
p_x
The desired x coordinate of the rectanglep_y
The desired y coordinate of the rectanglep_width
The desired width of the rectanglep_height
The desired height of the rectanglep_thickness
The desired thickness of the rectanglered
The red component of the rectangle's color (0 - 1)green
The green component of the rectangle's color (0 - 1)blue
The blue component of the rectangle's color (0 - 1)opacity
The opacity component of the rectangle's color (0 - 1)p_rotation
The angle in degrees to rotate the shape around its centermyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.10 and higher
public Image drawText(BBjString p_text$, BBjString p_foreColorHexString$, BBjString p_backColorHexString$, Font p_javaFont!, BBjNumber p_offsetX, BBjNumber p_offsetY, BBjNumber p_hAlign, BBjNumber p_vAlign)
Draws the specified text on the current BBXImage object. Multi-line strings are denoted by including a linebreak ($0A$) between the lines of text.
p_text$
The text string to draw. You can include linebreak ($0A$) characters in the text string to separate it into multiple lines.p_foreColorHexString$
The foreground color of the resultant text specified as a hex color string that may include an alpha channel. Examples include '#ff00cc', '#f0c', '#ff00ccbb', '#f0cb' depending on whether the hex color has an alpha channel.p_backColorHexString$
The background color of the resultant text specified as a hex color string that may include an alpha channel. Examples include '#ff00cc', '#f0c', '#ff00ccbb', '#f0cb' depending on whether the hex color has an alpha channel. By providing a value like '#0000' you can specify that the text background should be transparent.p_javaFont!
The Java Font used to draw the textp_offsetX
The number of pixels to horizontally shift the text, can be negative or positive to offset the text left or right, respectivelyp_offsetY
The number of pixels to vertically shift the text, can be negative or positive to offset the text up or down, respectivelyp_hAlign
The horizontal text alignment relative to the current BBXImage: 0=Left, 1=Center, 2=Right or constants like BBXImage.ALIGN_LEFT()
, BBXImage.ALIGN_CENTER()
, BBXImage.ALIGN_RIGHT()
p_vAlign
The vertical text alignment relative to the current BBXImage: 0=Top, 1=Middle, 2=Bottom or constants like BBXImage.ALIGN_TOP()
, BBXImage.ALIGN_MIDDLE()
, BBXImage.ALIGN_BOTTOM()
In BBj 21.12 and higher
public BBjNumber exists()
Method to determine whether the BBXImage exists or not
public Image flipHorizontally()
Method to flip the BBXImage horizontally
myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.0 and higher
public Image flipVertically()
Method to flip the BBXImage vertically
myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.0 and higher
public BBjString getBase64()
Method to return the BBXImage out to an Image Output Stream 32-bit converted to a Base64 ASCII Stream
In BBj 16.20 and higher
public BBjImage getBBjImage()
Method to get a BBjImage for the BBXImage
BBjImage for more information on the BBjImage control.
public Image getBufferedImage()
Method to get a BufferedImage of type BufferedImage.TYPE_INT_ARGB from the BBXImage
http://docs.oracle.com/javase/8/docs/api/java/awt/image/BufferedImage.html
In BBj 15.0 and higher
public Image getBufferedImage(BBjNumber p_bufferedImageType!)
Method to get a BufferedImage from the BBXImage
p_bufferedImageType!
The type of BufferedImage to return, such as BufferedImage.TYPE_INT_ARGB http://docs.oracle.com/javase/8/docs/api/java/awt/image/BufferedImage.html
public static Color getColorFromHexString(BBjString p_colorHexString$)
Method to create a Java Color from a hex string. As of BBj 21.12, this method supports hex color string with an alpha channel.
p_colorDesc$
A hex color string. Examples would be '#ff00cc', '#f0c', '#ff00ccbb', '#f0cb' depending on whether the hex color has an alpha channel. Color documentation for more information.
public static Color getColorWithAlphaFromHexString(BBjString p_colorHexString$, BBjNumber p_opacity)
Method to create a Java Color with an alpha channel from a hex string
p_colorHexString$
A hex color string. An example would be "#ff00cc"p_opacity
The desired opacity value (0-1). 0=Fully Transparent, 1=Fully Opaque. http://docs.oracle.com/javase/8/docs/api/java/awt/Color.html
public static BBjNumber getDecimalFromHex(BBjString p_hexValue$)
Method to convert 2-digit hexadecimal number to a decimal number in the range from 0-255
p_hexValue$
A BBjString filled with a two-digit hexadecimal number, like 'f0
'public BBjString getDescription()
Method to get the description of the BBXImage
public BBjNumber getHeight()
Method to get the height of the BBXImage
public static BBjString getHexStringFromColor(Color p_color!)
Method to get a hex representation of a Java Color with an alpha channel
p_color!
A Java Color Color documentation for more information.
public Image getImage()
Method to get an ImageIcon from the BBXImage
http://docs.oracle.com/javase/8/docs/api/java/awt/image/package-summary.html
public Image getImageIcon()
Method to get an ImageIcon from the BBXImage
http://docs.oracle.com/javase/8/docs/api/javax/swing/ImageIcon.html
public Image getSubimage(BBjNumber p_x, BBjNumber p_y, BBjNumber p_w, BBjNumber p_h)
Method to return a BBXImage that is a subimage defined by a specified rectangular region
p_x
The X coordinate of the upper-left corner of the specified rectangular regionp_y
The Y coordinate of the upper-left corner of the specified rectangular regionp_w
The width of the specified rectangular regionp_h
height of the specified rectangular region In BBj 18.10 and higher
public BBjNumber getWidth()
Method to get the width of the BBXImage
public Image rotate(BBjNumber p_degrees)
Method to rotate the BBXImage
The image will be rotated around the center point, and a positive rotation angle corresponds to rotating the image in a clockwise fashion. Note that the new image will be larger than the original image to avoid truncating rotated edges.
p_degrees
The number of degrees (-360 to +360) to rotate the BBXImagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
public Image roundBottomCorners(BBjNumber arcWidth, BBjNumber arcHeight)
Method to round the bottom corners (knockout) of the BBXImage given a cornerRadius
arcWidth
The corner radius in the X directionarcHeight
The corner radius in the Y directionmyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
public Image roundCorners(BBjNumber arcWidth, BBjNumber arcHeight)
Method to round the corners (knockout) of the BBXImage given a cornerRadius
arcWidth
The corner radius in the X directionarcHeight
The corner radius in the Y directionmyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
public Image roundTopCorners(BBjNumber arcWidth, BBjNumber arcHeight)
Method to round the top corners (knockout) of the BBXImage given a cornerRadius
arcWidth
The corner radius in the X directionarcHeight
The corner radius in the Y directionmyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
public void saveAsBMP(BBjString p_imageFile$)
Method to save the BBXImage out to a .bmp file
p_imageFile$
The path and filename for the resultant .bmp image BBj 19.02
public void saveAsGIF(BBjString p_imageFile$)
Method to save the BBXImage out to a .gif file
p_imageFile$
The path and filename for the resultant .gif image BBj 18.20
public void saveAsJPG(BBjString p_imageFile$, BBjNumber p_compressionLevelPercentage)
Method to save the BBXImage out to a .jpg file
p_imageFile$
The path and filename for the resultant .jpg imagep_compressionLevelPercentage
The amount (0 - 100) to compress the resultant .jpg imagepublic void saveAsPNG(BBjString p_imageFile$)
Method to save the BBXImage out to a 32-bit .png file with transparency
p_imageFile$
The path and filename for the resultant .png imagepublic void saveAsTIFF(BBjString p_imageFile$)
Method to save the BBXImage out to a .tiff file
p_imageFile$
The path and filename for the resultant .tiff image BBj 19.02
public Image scale(BBjNumber p_width, BBjNumber p_height)
Method to scale the BBXImage given a width and height Note: This method of scaling uses the java.awt.Image::getScaledInstance() method with the Image.SCALE_AREA_AVERAGING rendering hint.
p_width
The desired width of the BBXImagep_height
The desired height of the BBXImagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/java/awt/Image.html
public Image scale(BBjNumber p_percentage)
Method to scale the BBXImage given a percentage
p_percentage
The percentage amount (0 - 100) to scale the BBXImagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
public Image scaleHeight(BBjNumber p_width)
Method to scale the BBXImage preserving the aspect ratio given the width
p_width
The desired width of the BBXImagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
public Image scaleProportionally(BBjNumber p_maxDimension)
Method to scale the BBXImage preserving the aspect ratio given the maximum width or height dimension.
This method is useful in the case where you'd like to resize the source image ensuring that it will maintain its original proportions and will fit within a square of a particular size.
p_maxDimension
The desired maximum width and height of the resultant imagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.01 and higher
public Image scaleProportionally(BBjNumber p_maxWidth, BBjNumber p_maxHeight)
Method to scale the BBXImage preserving the aspect ratio given the maximum width and height dimensions.
This method is useful in the case where you'd like to resize the source image ensuring that it will maintain its original proportions and will fit within a rectangle of a particular size.
p_maxWidth
The desired maximum width of the resultant imagep_maxHeight
The desired maximum height of the resultant imagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.01 and higher
public Image scaleProportionallyAndResizeCanvas(BBjNumber p_maxWidth, BBjNumber p_maxHeight)
Method to scale the BBXImage preserving the aspect ratio given the maximum width and height dimensions, and then resize the canvas so that the image will be resized to the specified width and height. The original image will be centered in the final image and any extra space will be transparent.
This method is useful in the case where you'd like to resize the source image ensuring that it will maintain its original proportions and will fit within a rectangle of a particular size.
p_maxWidth
The desired maximum width of the resultant imagep_maxHeight
The desired maximum height of the resultant imagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.11 and higher
public Image scaleProportionallyResizeCanvasAndSetImage(BBjNumber p_maxWidth, BBjNumber p_maxHeight, BBjImageCtrl p_imgCtrl!)
Method to scale the BBXImage preserving the aspect ratio given the maximum width and height dimensions, then resize the canvas so that the image will be resized to the specified width and height. The original image will be centered in the final image and any extra space will be transparent. The final image will then be used to set the contents of the specified BBjImageCtrl
This method is useful in the case where you'd like to resize the an image ensuring that it will maintain its original proportions and will fit within a BBjImageCtrl of a particular size.
p_maxWidth
The desired maximum width of the resultant image, usually the BBjImageCtrl's widthp_maxHeight
The desired maximum height of the resultant image, usually the BBjImageCtrl's heightp_imgCtrl!
The BBjImageCtrl that will display the resultant imagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.11 and higher
public Image scaleWidth(BBjNumber p_height)
Method to scale the BBXImage preserving the aspect ratio given the height
p_height
The desired height of the BBXImagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
public Image scaleWithHints(BBjNumber p_width, BBjNumber p_height, HashMap p_renderingHintsMap!)
Method to scale the BBXImage given a width and height and HashMap of Graphics2D rendering hints
Java's RenderingHints allow you to specify the interpolation method used when scaling the image. The possible values are:
Generally speaking, the interpolations values shown above range from quickest with poorest quality (VALUE_INTERPOLATION_NEAREST_NEIGHBOR) to slowest with best quality (VALUE_INTERPOLATION_BICUBIC). In practice, bilinear and bicubic interpolation produce results that are very similar. Bicubic will be slightly sharper than bilinear, with a bit more emphasis on edges. That translates to bicubic often being a better choice for image reduction, whereas blinear is usually better for image enlargement.
Following is a short example showing how to use this method:
use java.util.HashMap use java.awt.RenderingHints hintsMap! = new HashMap() hintsMap!.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC) xImage!.scaleWithHints(width, height, hintsMap!)
p_width
The desired width of the BBXImagep_height
The desired height of the BBXImagep_renderingHintsMap!
A HashMap of Graphics2d rendering hintsmyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
http://docs.oracle.com/javase/8/docs/api/java/awt/RenderingHints.html
In BBj 15.0 and higher
public Image setBorder(BBjNumber borderSize, BBjColor color!)
Method to add a border to the BBXImage
borderSize
The width of the bordercolor
The color of the border expressed as a BBjColormyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 18.10 and higher
public Image setBorder(BBjNumber borderSize, BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity)
Method to add a border to the BBXImage
borderSize
The width of the borderred
The red component of the border color (0 - 1)green
The green component of the border color (0 - 1)blue
The blue component of the border color (0 - 1)opacity
The opacity component of the border color (0 - 1)myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
public Image setCanvasSize(BBjNumber p_width, BBjNumber p_height)
Method to resize the BBXImage's canvas, specifying transparent for the fill color.
p_width
The desired width of the BBXImage's canvasp_height
The desired height of the BBXImage's canvasmyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.02 and higher
public Image setCanvasSize(BBjNumber p_width, BBjNumber p_height, BBjColor p_color!)
Method to resize the BBXImage's canvas. If the canvas size is larger than the BBXImage's size, then the extra space will be filled with the specified color and the original image will be centered in the new canvas. If the canvas is smaller than the BBXImage then it will be centered and cropped to fit, resulting in the removal of the edges.
p_width
The desired width of the BBXImage's canvasp_height
The desired height of the BBXImage's canvasp_color!
The background color expressed as a BBjColormyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 18.10 and higher
public Image setCanvasSize(BBjNumber p_width, BBjNumber p_height, BBjNumber red, BBjNumber green, BBjNumber blue, BBjNumber opacity)
Method to resize the BBXImage's canvas. If the canvas size is larger than the BBXImage's size, then the extra space will be filled with the specified color and the original image will be centered in the new canvas. If the canvas is smaller than the BBXImage then it will be centered and cropped to fit, resulting in the removal of the edges.
p_width
The desired width of the BBXImage's canvasp_height
The desired height of the BBXImage's canvasred
The red component of the added color (0 - 1)green
The green component of the added color (0 - 1)blue
The blue component of the added color (0 - 1)opacity
The opacity component of the added color (0 - 1)myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.01 and higher
public Image setCornerWaterMark(BBXImage watermarkImage!, BBjNumber opacity, BBjNumber width, BBjNumber height, BBjNumber anchorPoint)
Method to add a watermark logo to the BBXImage
watermarkImage!
A BBXImage that contains the watermark imageopacity
The desired opacity of the watermark (0 - 1)width
The width of the watermark when placed on the targetheight
The height of the watermark when placed on the targetanchorPoint
The corner of the target image on which to place the watermark. 0 = TopLeft, 1 = TopRight, 2 = BottomRight, 3 = BottomLeftmyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
public Image setDescription(BBjString p_description$)
Method to set the description of the BBXImage
The
description of the BBXImage. This is meant to be a brief textual description of the object. For example, it might be presented to a blind user to give an indication of the purpose of the image.myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
public Image setDropShadow(BBjNumber shadowSize, BBjNumber shadowOpacity, BBjNumber xOffset, BBjNumber yOffset)
Method to add a drop shadow to the BBXImage
shadowSize
The size in pixels of the shadowshadowOpacity
The opacity of the shadow (0 - 1)xOffset
The shadow's offset in the X directionyOffset
The shadow's offset in the Y directionmyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
public Image setFilterBlur(BBjNumber p_blurAmount)
Method to filter the BBXImage and increase the blurriness
p_blurAmount
The amount to increase the blurriness. The amount generally ranges from 1 to about 10 for best results.myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.0 and higher
public Image setFilterBrightness(BBjNumber p_fraction)
Method to adjust the brightness of the BBXImage
p_fraction
The amount to lighten or darken the image. A positive number will lighten the image, a negative number will darken the image. For example, providing a value of 0.5 will make the image 50% brighter. Values range from -1.0 to 1.0.myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.0 and higher
public Image setFilterContrast(BBjNumber p_fraction)
Method to adjust the contrast of the BBXImage
p_fraction
The amount of contrast to add or subtract from the image. A positive number will lighten the image, a negative number will darken the image. For example, providing a value of 0.5 will make the image have 50% more contrast. Values range from -1.0 to 1.0.myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.0 and higher
public Image setFilterGrayscale()
Method to filter the BBXImage and convert it to grayscale (completely desaturated)
myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.0 and higher
public Image setFilterSharpen(BBjNumber p_sharpenAmount)
Method to filter the BBXImage and increase the sharpness
p_sharpenAmount
The amount to increase the sharpness. The amount generally ranges from 1 to about 10 for best results.myXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
In BBj 15.0 and higher
public Image setImageIcon(javax.swing.ImageIcon p_imageIcon!)
Method to set the ImageIcon for the BBXImage
An
ImageIcon containing the desired contents of the BBXImagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
ImageIcon for more information on the ImageIcon control.
public Image setOpacity(BBjNumber p_percentTransparent)
Method to set the transparency of the BBXImage
p_percentTransparent
The percentage (0 - 100) to set the amount of transparency of the BBXImagemyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")
public Image setReflection(BBjNumber reflectionLength, BBjNumber reflectionOpacity, BBjNumber blurred, BBjNumber verticalSpace)
Method to add a reflection to the BBXImage
reflectionLength
The height in pixels of the reflectionreflectionOpacity
The opacity of the reflection (0 - 1)blurred
1 = blur the reflection, 0 = do not blur the reflectionverticalSpace
Spacing in pixels between the original image and the reflectionmyXImage!.scale(100, 100).saveAsPNG("myScaledImage.png")