com.jmex.awt.swingui
Class ImageGraphics

java.lang.Object
  extended by java.awt.Graphics
      extended by java.awt.Graphics2D
          extended by com.jmex.awt.swingui.ImageGraphics
Direct Known Subclasses:
ImageGraphicsBaseImpl

public abstract class ImageGraphics
extends java.awt.Graphics2D

This abstract class provides methods to paint on a Image via the awt Graphics2D.


Field Summary
protected  Image image
          where painting in update() goes to.
 
Constructor Summary
protected ImageGraphics(Image image)
          Protected ctor for subclasses.
 
Method Summary
static ImageGraphics createInstance(int width, int height, int paintedMipMapCount)
           
 Image getImage()
           
abstract  boolean isDirty()
           
 boolean isExpandDirtyRegion()
           
 void setExpandDirtyRegion(boolean expand)
           
abstract  void update()
          Updates the image data.
 void update(Texture texture)
          Update a texture that contains the image from getImage().
abstract  void update(Texture texture, boolean clean)
          Update a texture that contains the image from getImage().
 
Methods inherited from class java.awt.Graphics2D
addRenderingHints, clip, draw, draw3DRect, drawGlyphVector, drawImage, drawImage, drawRenderableImage, drawRenderedImage, drawString, drawString, drawString, drawString, fill, fill3DRect, getBackground, getComposite, getDeviceConfiguration, getFontRenderContext, getPaint, getRenderingHint, getRenderingHints, getStroke, getTransform, hit, rotate, rotate, scale, setBackground, setComposite, setPaint, setRenderingHint, setRenderingHints, setStroke, setTransform, shear, transform, translate, translate
 
Methods inherited from class java.awt.Graphics
clearRect, clipRect, copyArea, create, create, dispose, drawArc, drawBytes, drawChars, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolygon, drawPolyline, drawRect, drawRoundRect, fillArc, fillOval, fillPolygon, fillPolygon, fillRect, fillRoundRect, finalize, getClip, getClipBounds, getClipBounds, getClipRect, getColor, getFont, getFontMetrics, getFontMetrics, hitClip, setClip, setClip, setColor, setFont, setPaintMode, setXORMode, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

image

protected final Image image
where painting in update() goes to.

Constructor Detail

ImageGraphics

protected ImageGraphics(Image image)
Protected ctor for subclasses.

Parameters:
image - where painting in update() goes to.
Method Detail

createInstance

public static ImageGraphics createInstance(int width,
                                           int height,
                                           int paintedMipMapCount)
Parameters:
width - of the image
height - of the image
paintedMipMapCount - number of mipmaps that are painted, rest is drawn by image copying, 0 for no mipmaps, 1 for a single image painted and mipmaps copied, higher values respective
Returns:
a new instance of ImageGraphics matching the display system.

getImage

public Image getImage()
Returns:
image where painting in update() goes to
See Also:
update()

update

public void update(Texture texture)
Update a texture that contains the image from getImage(). Only dirty areas are updated. The texture must have mipmapping turned off (Texture#MM_NONE). The whole area is cleaned (dirty markers removed).

Parameters:
texture - texture to be updated

update

public abstract void update(Texture texture,
                            boolean clean)
Update a texture that contains the image from getImage(). Only dirty areas are updated. The texture must have mipmapping turned off (Texture#MM_NONE).

Parameters:
texture - texture to be updated
clean - true to mark whole area as clean after updating, false to keep dirty area for updating more textures

update

public abstract void update()
Updates the image data.

See Also:
getImage()

isDirty

public abstract boolean isDirty()
Returns:
true if image/texture needs update

setExpandDirtyRegion

public void setExpandDirtyRegion(boolean expand)
Parameters:
expand - if true, dirty region grow by 2x2 to prevent antialiasing problem

isExpandDirtyRegion

public boolean isExpandDirtyRegion()
Returns:
if true, dirty region grow by 2x2 to prevent antialiasing problem