java.awt
Class TexturePaint

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.TexturePaint
All Implemented Interfaces:
Paint sample code for java.awt.Paint definition code for java.awt.Paint , Transparency sample code for java.awt.Transparency definition code for java.awt.Transparency

public class TexturePaint
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Paint sample code for java.awt.Paint definition code for java.awt.Paint

The TexturePaint class provides a way to fill a Shape sample code for java.awt.Shape definition code for java.awt.Shape with a texture that is specified as a BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.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 sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.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.

See Also:
Paint sample code for java.awt.Paint definition code for java.awt.Paint , Graphics2D.setPaint(java.awt.Paint) sample code for java.awt.Graphics2D.setPaint(java.awt.Paint) definition code for java.awt.Graphics2D.setPaint(java.awt.Paint)

Field Summary
 
Fields inherited from interface java.awt.Transparency sample code for java.awt.Transparency definition code for java.awt.Transparency
BITMASK sample code for java.awt.Transparency.BITMASK definition code for java.awt.Transparency.BITMASK , OPAQUE sample code for java.awt.Transparency.OPAQUE definition code for java.awt.Transparency.OPAQUE , TRANSLUCENT sample code for java.awt.Transparency.TRANSLUCENT definition code for java.awt.Transparency.TRANSLUCENT
 
Constructor Summary
TexturePaint sample code for java.awt.TexturePaint.TexturePaint(java.awt.image.BufferedImage, java.awt.geom.Rectangle2D) definition code for java.awt.TexturePaint.TexturePaint(java.awt.image.BufferedImage, java.awt.geom.Rectangle2D) (BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.BufferedImage  txtr, Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  anchor)
          Constructs a TexturePaint object.
 
Method Summary
 PaintContext sample code for java.awt.PaintContext definition code for java.awt.PaintContext createContext sample code for java.awt.TexturePaint.createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints) definition code for java.awt.TexturePaint.createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints) (ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel  cm, Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  deviceBounds, Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  userBounds, AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  xform, RenderingHints sample code for java.awt.RenderingHints definition code for java.awt.RenderingHints  hints)
          Creates and returns a context used to generate the color pattern.
 Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D getAnchorRect sample code for java.awt.TexturePaint.getAnchorRect() definition code for java.awt.TexturePaint.getAnchorRect() ()
          Returns a copy of the anchor rectangle which positions and sizes the textured image.
 BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.BufferedImage getImage sample code for java.awt.TexturePaint.getImage() definition code for java.awt.TexturePaint.getImage() ()
          Returns the BufferedImage texture used to fill the shapes.
 int getTransparency sample code for java.awt.TexturePaint.getTransparency() definition code for java.awt.TexturePaint.getTransparency() ()
          Returns the transparency mode for this TexturePaint.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

TexturePaint sample code for java.awt.TexturePaint(java.awt.image.BufferedImage, java.awt.geom.Rectangle2D) definition code for java.awt.TexturePaint(java.awt.image.BufferedImage, java.awt.geom.Rectangle2D)

public TexturePaint(BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.BufferedImage  txtr,
                    Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  anchor)
Constructs a TexturePaint object.

Parameters:
txtr - the BufferedImage object with the texture used for painting
anchor - the Rectangle2D in user space used to anchor and replicate the texture
Method Detail

getImage sample code for java.awt.TexturePaint.getImage() definition code for java.awt.TexturePaint.getImage()

public BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.BufferedImage  getImage()
Returns the BufferedImage texture used to fill the shapes.

Returns:
a BufferedImage.

getAnchorRect sample code for java.awt.TexturePaint.getAnchorRect() definition code for java.awt.TexturePaint.getAnchorRect()

public Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  getAnchorRect()
Returns a copy of the anchor rectangle which positions and sizes the textured image.

Returns:
the Rectangle2D used to anchor and size this TexturePaint.

createContext sample code for java.awt.TexturePaint.createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints) definition code for java.awt.TexturePaint.createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints)

public PaintContext sample code for java.awt.PaintContext definition code for java.awt.PaintContext  createContext(ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel  cm,
                                  Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  deviceBounds,
                                  Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  userBounds,
                                  AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform  xform,
                                  RenderingHints sample code for java.awt.RenderingHints definition code for java.awt.RenderingHints  hints)
Creates and returns a context used to generate the color pattern.

Specified by:
createContext sample code for java.awt.Paint.createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints) definition code for java.awt.Paint.createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints) in interface Paint sample code for java.awt.Paint definition code for java.awt.Paint
Parameters:
cm - the ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel that receives the Paint data. This is used only as a hint.
deviceBounds - the device space bounding box of the graphics primitive being rendered
userBounds - the user space bounding box of the graphics primitive being rendered
xform - the AffineTransform sample code for java.awt.geom.AffineTransform definition code for java.awt.geom.AffineTransform from user space into device space
hints - a RenderingHints sample code for java.awt.RenderingHints definition code for java.awt.RenderingHints object that can be used to specify how the pattern is ultimately rendered
Returns:
the PaintContext sample code for java.awt.PaintContext definition code for java.awt.PaintContext used for generating color patterns.
See Also:
PaintContext sample code for java.awt.PaintContext definition code for java.awt.PaintContext

getTransparency sample code for java.awt.TexturePaint.getTransparency() definition code for java.awt.TexturePaint.getTransparency()

public int getTransparency()
Returns the transparency mode for this TexturePaint.

Specified by:
getTransparency sample code for java.awt.Transparency.getTransparency() definition code for java.awt.Transparency.getTransparency() in interface Transparency sample code for java.awt.Transparency definition code for java.awt.Transparency
Returns:
the transparency mode for this TexturePaint as an integer value.
See Also:
Transparency sample code for java.awt.Transparency definition code for java.awt.Transparency