/** CellRenderer.pde (part of NoiseGrid) Dave Bollinger http://www.davebollinger.com */ /** * a renderer wraps up a transform and shape and is passed to the * render() method of a NoiseGrid which then call the renderers * render() method for each cell within the grid. */ public class CellRenderer { PApplet applet; BaseTransform transform; BaseShape shape; public CellRenderer(PApplet applet) { this.applet = applet; } public void config(BaseTransform transform, BaseShape shape) { this.transform = transform; this.shape = shape; } public boolean ready() { return ((transform!=null) && (shape!=null)); } public void render(float screenx, float screeny, float value, float xscale, float yscale) { transform.apply(screenx, screeny, value, xscale, yscale); shape.draw(); transform.unapply(); } }