Class RgbPaperType

java.lang.Object
uk.ac.starlink.ttools.plot2.paper.RgbPaperType
All Implemented Interfaces:
PaperType
Direct Known Subclasses:
MonoPaperType, RgbPaperType2D, RgbPaperType3D

public abstract class RgbPaperType extends Object implements PaperType
Abstract bitmapped PaperType which uses an RgbImage to store graphics. Abstract subclasses are provided for different geometries, and concrete implementations have to provide their own compositing which operates on the supplied RgbImage, using either the BufferedImage or the backing buffer.
Since:
14 Feb 2013
Author:
Mark Taylor
  • Constructor Details

    • RgbPaperType

      protected RgbPaperType(String name, boolean upLayer)
      Constructor.
      Parameters:
      name - paper type name
      upLayer - true to render layers in ascending order, false to do them in descending order
  • Method Details

    • isBitmap

      public boolean isBitmap()
      Returns true.
      Specified by:
      isBitmap in interface PaperType
      Returns:
      true for pixellated surface, false for vector
    • placeDecal

      public void placeDecal(Paper paper, Decal decal)
      Specified by:
      placeDecal in interface PaperType
      Parameters:
      paper - graphics destination, of appropriate type for this object
      decal - graphic to paint
    • createDataIcon

      public Icon createDataIcon(Surface surface, Drawing[] drawings, Object[] plans, DataStore dataStore, boolean requireCached)
      Description copied from interface: PaperType
      Paints the content of a list of drawing objects onto a given plot surface, and returns the result as an Icon.

      The requireCached argument provides a hint about whether the output icon will cache computations. Set this true if you might want to paint the returned icon multiple times, false if it is one-shot only, or if keeping the memory footprint small is more important than speed.

      In general it's OK to call the paintIcon method of the returned object with a null Component. The returned icon is the size of the plotBounds rectangle, and will be painted at plotBounds.x, plotBounds.y. It contains everything in that region except perhaps for decorations, and it is opaque. It does not (cannot) contain external axis labels, but must contain any internal markings which appear underneath the data points.

      An implementation will usually create a Paper object and pass it in turn to the supplied drawings so that the returned icon can be based on the drawn-on paper.

      Specified by:
      createDataIcon in interface PaperType
      Parameters:
      surface - plot surface
      drawings - array of drawing objects to be painted in sequence
      plans - array of plan objects corresponding to the drawings array argument
      dataStore - data storage object
      requireCached - hint about whether to cache the calculation data
      Returns:
      plotBounds-sized icon
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createPaper

      protected abstract RgbPaperType.RgbPaper createPaper(Rectangle bounds)
      Creates a paper object for given bounds.
      Parameters:
      bounds - plot bounds
      Returns:
      new paper instance