Class ImagePaint
java.lang.Object
com.codename1.art.ArtPaint
com.codename1.art.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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcolorAt(double x, double y, double[] bbox) The color at a point of paint space.copy()A deep copy.voidfit(double x, double y, double w, double h) Stretches the image over a rectangle.getImage()The image.The image transform.booleanTrue when the transform maps the unit square onto the bounding box first, so a transform ofscale(1/w, 1/h)stretches the image over the shape.booleanisTiled()True when the image repeats.voidsetObjectBoundingBox(boolean objectBoundingBox) Sets whether the transform is relative to the bounding box.voidsetTiled(boolean tiled) Sets whether the image repeats.voidsetTransform(Matrix transform) Sets the image transform.Methods inherited from class ArtPaint
copyBase, getBlendMode, getOpacity, isEnabled, setBlendMode, setEnabled, setOpacity
-
Constructor Details
-
ImagePaint
Creates an image paint.
Parameters
image: the pixels
-
-
Method Details
-
copy
-
getImage
The image. -
getTransform
The image transform. -
setTransform
Sets the image transform.
Parameters
transform: 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
tiled: true to repeat
-
isObjectBoundingBox
public boolean isObjectBoundingBox()True when the transform maps the unit square onto the bounding box first, so a transform ofscale(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
objectBoundingBox: 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
x: lefty: topw: widthh: height
-
colorAt
public int colorAt(double x, double y, double[] bbox) Description copied from class:ArtPaintThe color at a point of paint space.
Parameters
x: x in the space of the shape that is paintedy: y in that spacebbox: the shape's bounding box asx, y, w, h, for paints relative to it
-