Class RMContourFill

All Implemented Interfaces:
Archivable, RMPropertyChanger, Paint, PaintContext, Transparency, Cloneable

public class RMContourFill extends RMFill implements PaintContext, Paint
RMFill implementation of a shape-burst gradient. Implements Paint & PaintContext methods for scan converting the gradient into an ARGB raster. Can be used on its own for a vaguely-interesting fill, or to create a bump map for the emboss effect. Currently the edge profile is a 45 degree straight line, but other edge profiles (rounded, cove, whatever) can easily be added.
  • Constructor Details

    • RMContourFill

      public RMContourFill()
      Creates a contour fill.
    • RMContourFill

      public RMContourFill(float height)
      Creates a contour fill with given height.
  • Method Details

    • getPaint

      public Paint getPaint()
      Paint & PaintContext interface methods.
    • getTransparency

      public int getTransparency()
      PaintContext method.
      Specified by:
      getTransparency in interface Transparency
    • getColorModel

      public ColorModel getColorModel()
      PaintContext method.
      Specified by:
      getColorModel in interface PaintContext
    • dispose

      public void dispose()
      PaintContext method.
      Specified by:
      dispose in interface PaintContext
    • createContext

      public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints)
      Paint & PaintContext interfaces.
      Specified by:
      createContext in interface Paint
    • getRaster

      public Raster getRaster(int x, int y, int w, int h)
      Creates a new raster.
      Specified by:
      getRaster in interface PaintContext
    • doShading

      public void doShading(int[] samples, int offset, int devicex, int devicey, int w, int h, int rowbytes)
      Replaces image samples with distance from pixel scaled to the range [0-1]. We scale every distance by the maximum. This means that the color of each edge will change with the same slope, and thicker sections will therefore be taller (if edge color is thought of as height). Another possibility would be to scale each edge by its local max, so each section ultimately reaches same height.
    • paint

      public void paint(RMShapePainter aPntr, RMShape aShape)
      Paint method.
      Overrides:
      paint in class RMFill
    • getMaskImage

      public BufferedImage getMaskImage(int width, int height)
      Draws the path into a buffered image to use as a mask
    • toXML

      public RXElement toXML(RXArchiver anArchiver)
      XML archival.
      Specified by:
      toXML in interface Archivable
      Overrides:
      toXML in class RMFill