org.game.Juzzle
Class PuzzlePaint

java.lang.Object
  |
  +--org.game.Juzzle.PuzzlePaint
All Implemented Interfaces:
java.awt.Paint, java.awt.PaintContext, java.awt.Transparency

public class PuzzlePaint
extends java.lang.Object
implements java.awt.Paint, java.awt.PaintContext

puzzle paint return the part of the whole image to draw.

See Also:
Paint, PaintContext

Field Summary
protected  java.awt.image.BufferedImage bimage
          the reference to the whole image
protected  java.awt.Rectangle userBounds
          help variable
protected  java.awt.Rectangle viewRect
          the part of the image rectangle
 
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
 
Constructor Summary
PuzzlePaint(java.awt.image.BufferedImage textur, java.awt.Rectangle viewRect)
          simply 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)
          get the PaintContext of this Paint
 void dispose()
          destroy the Paint, not needed in Juzzle
 java.awt.image.ColorModel getColorModel()
          the ColorModel of this Paint, it's the same the puzzle image
 java.awt.image.Raster getRaster(int x, int y, int w, int h)
          return the part of the image to draw
 int getTransparency()
          has this Paint transparent parts or not
 void setViewRect(java.awt.Rectangle viewRect)
          set a new rectangle for this piece, needed if two pieces comes together
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bimage

protected java.awt.image.BufferedImage bimage
the reference to the whole image

viewRect

protected java.awt.Rectangle viewRect
the part of the image rectangle

userBounds

protected java.awt.Rectangle userBounds
help variable
Constructor Detail

PuzzlePaint

public PuzzlePaint(java.awt.image.BufferedImage textur,
                   java.awt.Rectangle viewRect)
simply constructor.
Parameters:
textur - the puzzle image
viewRect - the rectangle for this piece
Method Detail

setViewRect

public void setViewRect(java.awt.Rectangle viewRect)
set a new rectangle for this piece, needed if two pieces comes together
Parameters:
viewRect - the new rectangle for this piece

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)
get the PaintContext of this Paint
Specified by:
createContext in interface java.awt.Paint
See Also:
Paint, PaintContext

getTransparency

public int getTransparency()
has this Paint transparent parts or not
Specified by:
getTransparency in interface java.awt.Transparency
See Also:
Paint

dispose

public void dispose()
destroy the Paint, not needed in Juzzle
Specified by:
dispose in interface java.awt.PaintContext
See Also:
PaintContext

getColorModel

public java.awt.image.ColorModel getColorModel()
the ColorModel of this Paint, it's the same the puzzle image
Specified by:
getColorModel in interface java.awt.PaintContext
See Also:
PaintContext

getRaster

public java.awt.image.Raster getRaster(int x,
                                       int y,
                                       int w,
                                       int h)
return the part of the image to draw
Specified by:
getRaster in interface java.awt.PaintContext
See Also:
PaintContext