com.miginfocom.util.gfx
Class XtdTexturePaint

java.lang.Object
  extended by com.miginfocom.util.gfx.XtdTexturePaint
All Implemented Interfaces:
java.awt.Paint, java.awt.Transparency, java.io.Serializable

public class XtdTexturePaint
extends java.lang.Object
implements java.awt.Paint, java.io.Serializable

A texture paint that can use a XtdImage. It can also be serialized to XML.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
 
Constructor Summary
XtdTexturePaint(XtdImage xtdImage)
          Constructor.
XtdTexturePaint(XtdImage xtdImage, java.awt.Point offset)
          Constructor.
 
Method Summary
 java.awt.PaintContext createContext(java.awt.image.ColorModel cm, java.awt.Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform xform, java.awt.RenderingHints hints)
           
 void flush()
          Releases the imageContext used for creating this image.
 java.awt.Point getOffset()
          Returns the offset of the upper left corner of the tile.
 int getTransparency()
           
 XtdImage getXtdImage()
          Returns the image that is used for tiling the texture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XtdTexturePaint

public XtdTexturePaint(XtdImage xtdImage)
Constructor. No automatic repaint when loaded the image.

Parameters:
xtdImage - The image to base this texture paint on. Not null but can have a null wrapped buffered image in which case this paint will just paint "control" color.

XtdTexturePaint

public XtdTexturePaint(XtdImage xtdImage,
                       java.awt.Point offset)
Constructor.

Parameters:
xtdImage - The image to base this texture paint on. Not null but can have a null wrapped buffered image in which case this paint will just paint "control" color.
offset - The offset of the upper left corner of the tile. No scaling, image should be pre scaled.
Method Detail

getXtdImage

public XtdImage getXtdImage()
Returns the image that is used for tiling the texture.

Returns:
The image that is used for tiling the texture. Never null but the image may not be loaded yet.

getOffset

public java.awt.Point getOffset()
Returns the offset of the upper left corner of the tile. The actual stored object, should not be changed.

Returns:
The offset of the upper left corner of the tile. Never null.

flush

public void flush()
Releases the imageContext used for creating this image. If this is done the image can no longer be serialized (saved) since only the pixel data is left.


createContext

public java.awt.PaintContext createContext(java.awt.image.ColorModel cm,
                                           java.awt.Rectangle deviceBounds,
                                           java.awt.geom.Rectangle2D userBounds,
                                           java.awt.geom.AffineTransform xform,
                                           java.awt.RenderingHints hints)
Specified by:
createContext in interface java.awt.Paint

getTransparency

public int getTransparency()
Specified by:
getTransparency in interface java.awt.Transparency


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.