Class RMContourFill

  • All Implemented Interfaces:
    Archivable, RMPropertyChanger, java.awt.Paint, java.awt.PaintContext, java.awt.Transparency, java.lang.Cloneable

    public class RMContourFill
    extends RMFill
    implements java.awt.PaintContext, java.awt.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 Detail

      • RMContourFill

        public RMContourFill()
        Creates a contour fill.
      • RMContourFill

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

      • getPaint

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

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

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

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

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

        public java.awt.image.Raster getRaster​(int x,
                                               int y,
                                               int w,
                                               int h)
        Creates a new raster.
        Specified by:
        getRaster in interface java.awt.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.
      • getMaskImage

        public java.awt.image.BufferedImage getMaskImage​(int width,
                                                         int height)
        Draws the path into a buffered image to use as a mask