Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class ImagePaint
Fills with an image, stretched or tiled.
The image’s pixel grid is placed in paint space by getTransform; one image pixel is one
unit before that transform.
Constructors
public ImagePaint(Raster image) | Creates an image paint. |
Methods
public ArtPaint copy() | A deep copy. |
public Raster getImage() | The image. |
public Matrix getTransform() | The image transform. |
public void setTransform(Matrix transform) | Sets the image transform. |
public boolean isTiled() | True when the image repeats. |
public void setTiled(boolean tiled) | Sets whether the image repeats. |
public boolean isObjectBoundingBox() | True when the transform maps the unit square onto the bounding box first, so a transform of scale(1/w, 1/h) stretches the image over the shape. |
public void setObjectBoundingBox(boolean objectBoundingBox) | Sets whether the transform is relative to the bounding box. |
public void fit(double x, double y, double w, double h) | Stretches the image over a rectangle. |
public int colorAt(double x, double y, double[] bbox) | The color at a point of paint space. |
Inherited methods
Constructor details
ImagePaint
public ImagePaint(Raster image)Creates an image paint.
Parameters
imageRaster- the pixels
Method details
copy
public ArtPaint copy()A deep copy.
getImage
public Raster getImage()The image.
getTransform
public Matrix getTransform()The image transform.
setTransform
public void setTransform(Matrix transform)Sets the image transform.
Parameters
transformMatrix- places the image in paint space
isTiled
public boolean isTiled()True when the image repeats.
setTiled
public void setTiled(boolean tiled)Sets whether the image repeats.
Parameters
tiledboolean- true to repeat
isObjectBoundingBox
public boolean isObjectBoundingBox()True when the transform maps the unit square onto the bounding box first, so a
transform of
scale(1/w, 1/h) stretches the image over the shape.setObjectBoundingBox
public void setObjectBoundingBox(boolean objectBoundingBox)Sets whether the transform is relative to the bounding box.
Parameters
objectBoundingBoxboolean- true to stretch over the shape’s bounds
fit
public void fit(double x, double y, double w, double h)Stretches the image over a rectangle.
Parameters
xdouble- left
ydouble- top
wdouble- width
hdouble- height
colorAt
public int colorAt(double x, double y, double[] bbox)The color at a point of paint space.
Parameters
xdouble- x in the space of the shape that is painted
ydouble- y in that space
bboxdouble[]- the shape’s bounding box as
x, y, w, h, for paints relative to it