TexturePaintclass provides a way to fill a
Shapewith a texture that is specified as a
BufferedImage. The size of the
BufferedImageobject should be small because the
BufferedImagedata is copied by the
TexturePaintobject. At construction time, the texture is anchored to the upper left corner of a
Rectangle2Dthat is specified in user space. Texture is computed for locations in the device space by conceptually replicating the specified
Rectangle2Dinfinitely in all directions in user space and mapping the
BufferedImageto each replicated
|Constructor and Description|
|Modifier and Type||Method and Description|
Creates and returns a
Returns a copy of the anchor rectangle which positions and sizes the textured image.
Returns the transparency mode for this
public BufferedImage getImage()
BufferedImagetexture used to fill the shapes.
public Rectangle2D getAnchorRect()
Rectangle2Dused to anchor and size this
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints)
PaintContextused to generate a tiled image pattern. See the
specificationof the method in the
Paintinterface for information on null parameter handling.
cm- the preferred
ColorModelwhich represents the most convenient format for the caller to receive the pixel data, or
nullif there is no preference.
deviceBounds- the device space bounding box of the graphics primitive being rendered.
userBounds- the user space bounding box of the graphics primitive being rendered.
AffineTransformfrom user space into device space.
hints- the set of hints that the context object can use to choose between rendering alternatives.
PaintContextfor generating color patterns.
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.