|
Quaqua 8.0 2011-10-02 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectch.randelshofer.quaqua.util.CachedPainter
public abstract class CachedPainter
A base class used for icons or images that are expensive to paint. A subclass will do the following:
paint when you want to paint the image,
if you are implementing Icon you'll invoke this from
paintIcon.
The args argument is useful when additional state is needed.
paintToImage to render the image. The code that
lives here is equivalent to what previously would go in
paintIcon, for an Icon.
| Constructor Summary | |
|---|---|
CachedPainter(int cacheCount)
Creates an instance of CachedPainter that will cache up
to cacheCount images of this class. |
|
| Method Summary | |
|---|---|
protected java.awt.Image |
createImage(java.awt.Component c,
int w,
int h,
java.awt.GraphicsConfiguration config)
Creates the image to cache. |
int |
getMaxCachedImageSize()
|
protected void |
paint(java.awt.Component c,
java.awt.Graphics g,
int x,
int y,
int w,
int h,
java.lang.Object args)
Renders the cached image to the the passed in Graphic. |
protected void |
paintImage(java.awt.Component c,
java.awt.Graphics g,
int x,
int y,
int w,
int h,
java.awt.Image image,
java.lang.Object args)
Paints the image to the specified location. |
protected abstract void |
paintToImage(java.awt.Component c,
java.awt.Graphics g,
int w,
int h,
java.lang.Object args)
Paints the representation to cache to the supplied Graphics. |
protected void |
paintToImage(java.awt.Component c,
java.awt.Image image,
int w,
int h,
java.lang.Object args)
Paints the representation to cache to the supplied Graphics. |
void |
setMaxCachedImageSize(int maxCachedImageSize)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CachedPainter(int cacheCount)
CachedPainter that will cache up
to cacheCount images of this class.
cacheCount - Max number of images to cache| Method Detail |
|---|
protected void paint(java.awt.Component c,
java.awt.Graphics g,
int x,
int y,
int w,
int h,
java.lang.Object args)
Graphic.
If there is no cached image paintToImage will be invoked.
paintImage is invoked to paint the cached image.
protected void paintToImage(java.awt.Component c,
java.awt.Image image,
int w,
int h,
java.lang.Object args)
c - Component painting toimage - Image to paint tow - Width to paint toh - Height to paint toargs - Arguments supplied to paint
protected abstract void paintToImage(java.awt.Component c,
java.awt.Graphics g,
int w,
int h,
java.lang.Object args)
c - Component painting tog - Graphics to paint tow - Width to paint toh - Height to paint toargs - Arguments supplied to paint
protected void paintImage(java.awt.Component c,
java.awt.Graphics g,
int x,
int y,
int w,
int h,
java.awt.Image image,
java.lang.Object args)
c - Component painting tog - Graphics to paint tox - X coordinate to paint toy - Y coordinate to paint tow - Width to paint toh - Height to paint toimage - Image to paintargs - Arguments supplied to paint
protected java.awt.Image createImage(java.awt.Component c,
int w,
int h,
java.awt.GraphicsConfiguration config)
c - Component painting tow - Width of image to createh - Height to image to createconfig - GraphicsConfiguration that will be
rendered to, this may be null.public int getMaxCachedImageSize()
public void setMaxCachedImageSize(int maxCachedImageSize)
|
Copyright 2003-2007 (c) Werner Randelshofer. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||