TexturePaint class provides a way to fill a
Shape with a texture that is specified as
a BufferedImage. The size of the BufferedImage
object should be small because the BufferedImage data
is copied by the TexturePaint object.
At construction time, the texture is anchored to the upper
left corner of a Rectangle2D that is
specified in user space. Texture is computed for
locations in the device space by conceptually replicating the
specified Rectangle2D infinitely in all directions
in user space and mapping the BufferedImage to each
replicated Rectangle2D.
Paint, Graphics2D#setPaint
| Modifier and Type | Field and Description |
|---|---|
| pack-priv BufferedImage | |
| pack-priv double | |
| pack-priv double | |
| pack-priv double | |
| pack-priv double |
| Access | Constructor and Description |
|---|---|
| public | TexturePaint(BufferedImage
the txtr, Rectangle2D BufferedImage object with the texture
used for paintingthe anchor)Rectangle2D in user space used to
anchor and replicate the textureConstructs a |
| Modifier and Type | Method and Description |
|---|---|
| public PaintContext | Returns: thePaintContext for
generating color patterns.the preferred cm, Rectangle ColorModel which represents the most convenient
format for the caller to receive the pixel data, or null
if there is no preference.the device space bounding box
of the graphics primitive being rendered. deviceBounds, Rectangle2D the user space bounding box
of the graphics primitive being rendered. userBounds, AffineTransform the xform, RenderingHints AffineTransform from user
space into device space.the set of hints that the context object can use to
choose between rendering alternatives. hints)Implements java. Creates and returns a |
| public Rectangle2D | Returns: theRectangle2D used to anchor and
size this TexturePaint.Returns a copy of the anchor rectangle which positions and sizes the textured image. |
| public BufferedImage | |
| public int | Returns: the transparency mode for thisTexturePaint
as an integer value.Implements java. Returns the transparency mode for this |
| bufImg | back to summary |
|---|---|
| pack-priv BufferedImage bufImg | |
| sx | back to summary |
|---|---|
| pack-priv double sx | |
| sy | back to summary |
|---|---|
| pack-priv double sy | |
| tx | back to summary |
|---|---|
| pack-priv double tx | |
| ty | back to summary |
|---|---|
| pack-priv double ty | |
| TexturePaint | back to summary |
|---|---|
| public TexturePaint(BufferedImage txtr, Rectangle2D anchor) Constructs a
| |
| createContext | back to summary |
|---|---|
| public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) Implements java. Creates and returns a
| |
| getAnchorRect | back to summary |
|---|---|
| public Rectangle2D getAnchorRect() Returns a copy of the anchor rectangle which positions and sizes the textured image.
| |
| getImage | back to summary |
|---|---|
| public BufferedImage getImage() Returns the
| |
| getTransparency | back to summary |
|---|---|
| public int getTransparency() Implements java. Returns the transparency mode for this
| |