All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.TexturePaint
java.lang.Object
|
+----java.awt.TexturePaint
- public class TexturePaint
- extends Object
- implements Paint
This class provides a way to fill a shape with a given texture.
The texture used in the filling process is given as a BufferedImage.
The size of the texture BufferedImage object should be small because
the BufferedImage data is copied by the TexturePaint object.
The texture is anchored at construction time to the upper left corner
of a Rectangle2D specified in user space. Texture is computed for
locations in the device space by conceptually replicating the given
Rectangle2D infinitely in all directions in user space and mapping
the BufferedImage to each replicated Rectangle2D.
- See Also:
- Paint, setPaint
BILINEAR- Texture colors are generated with the bilinear algorithm.
NEAREST_NEIGHBOR- Texture colors are generated with the nearest neighbor algorithm.
TexturePaint(BufferedImage, Rectangle2D, int)
- Constructs a TexturePaint object.
createContext(ColorModel, Rectangle, Rectangle2D, AffineTransform)
- Creates and returns a context used to generate the color pattern.
getTransparency()
- Return the transparency mode for this TexturePaint.
NEAREST_NEIGHBOR
public static final int NEAREST_NEIGHBOR
- Texture colors are generated with the nearest neighbor algorithm.
BILINEAR
public static final int BILINEAR
- Texture colors are generated with the bilinear algorithm.
TexturePaint
public TexturePaint(BufferedImage txtr,
Rectangle2D rect2d,
int interpolation)
- Constructs a TexturePaint object.
- Parameters:
- txtr - The BufferedImage object with the texture used for painting.
- rect2d - The rectangle in user space used to anchor and replicate
the texture.
- interpolation - The type of algorithm with regard to rendering
quality used to generate the color pattern. Possible values are
NEAREST_NEIGHBOR and BILINEAR
- See Also:
- NEAREST_NEIGHBOR, BILINEAR
createContext
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform xform)
- Creates and returns a context used to generate the color pattern.
- Parameters:
- cm - ColorModel in which the caller wishes to receive the
paint data. This is used only as a hint.
- deviceBounds - The rectangle describing the bounding box
in device space of the graphics primitive being rendered.
- userBounds - The rectangle describing the bounding box in
user space of the graphics primitive being rendered.
- xform - The Transform from user space into device space.
- Returns:
- The PaintContext for generating color patterns.
- See Also:
- PaintContext
getTransparency
public int getTransparency()
- Return the transparency mode for this TexturePaint.
- See Also:
- Transparency
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature