|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.artoflife.gp.Phenotype | +--org.artoflife.gui.paintable.PaintablePhenotype
A Phenotype
that can paint itself at various sizes
onto a Graphics2D. Caches the last painted images to reuse if asked to paint
at the same sizes again. If asked to paint at a new size, a new one is
painted to fit the current size. Cached images are saved in a WeakHashMap so
low memory conditions will force collection of old images.
Constructor Summary | |
PaintablePhenotype()
|
Method Summary | |
java.lang.Object |
clone()
Phenotypes must be Cloneable so that an Individual can be cloned and then mutated as an independent new Individual. |
abstract void |
doPaint(java.awt.Graphics2D g,
int width,
int height)
Paint onto the passed Graphics2D sized to fit the passed dimensions. |
abstract float |
getHeightToWidth()
|
void |
paint(java.awt.Graphics2D g,
int width,
int height,
boolean highQuality)
Use the cached Image if available, else paint it first. |
void |
paintNoCache(java.awt.Graphics2D g,
int width,
int height,
boolean highQuality)
Paint without caching the resulting image. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PaintablePhenotype()
Method Detail |
public void paintNoCache(java.awt.Graphics2D g, int width, int height, boolean highQuality)
g
- the Graphics2D to paint ontowidth
- of image to paint, may be 0 when phenotype will
paint at its preferred width for the provided heightheight
- of image to paint, may be 0 when phenotype will
paint at its preferred height for the provided widthhighQuality
- how to paint it, either fast and dirty or slow and
high qualitypublic void paint(java.awt.Graphics2D g, int width, int height, boolean highQuality)
g
- the Graphics2D to paint ontowidth
- of image to paint, may be 0 when phenotype will
paint at its preferred width for the provided heightheight
- of image to paint, may be 0 when phenotype will
paint at its preferred height for the provided widthhighQuality
- how to paint it, either fast and dirty or slow and
high qualityorg.artoflife.gui.paintable.view.IndividualRecord#paint(Graphics2D)
public abstract void doPaint(java.awt.Graphics2D g, int width, int height)
g
- the Graphics2D to paint ontowidth
- of image to paint, may be 0 when phenotype will
paint at its preferred width for the provided heightheight
- of image to paint, may be 0 when phenotype will
paint at its preferred height for the provided widthpublic abstract float getHeightToWidth()
public java.lang.Object clone()
clone
in class Phenotype
|
artoflife pre0.1.0-dev | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |