Class PaintPaperType

  • All Implemented Interfaces:
    PaperType
    Direct Known Subclasses:
    PaintPaperType2D, SortedPaperType3D

    public abstract class PaintPaperType
    extends java.lang.Object
    implements PaperType
    Vector paper type abstract superclass. All graphics are painted rather than laid down pixel by pixel, which gives more beautiful results on a non-bitmapped output medium. It may be slower (for large datasets, perhaps much slower) than one of the bitmapped options. Whether it supports transparency depends on whether the graphics context does. In any case the details of the transparency rendering may not be identical to the way it is done by the other paper types, since in some cases they handle the compositing in a non-standard fashion, for instance opacity boost for very transparent points. Note that some of the output may in any case look pixellated when using this output format, if that's how the plot layers have decided to render it (bitmapped decals rather than glyphs).
    Since:
    14 Feb 2013
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected PaintPaperType​(java.lang.String name, boolean upLayer)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      javax.swing.Icon createDataIcon​(Surface surface, Drawing[] drawings, java.lang.Object[] plans, DataStore dataStore, boolean cached)
      Paints the content of a list of drawing objects onto a given plot surface, and returns the result as an Icon.
      static java.awt.GraphicsConfiguration createHeadlessGraphicsConfig​(int imtype)
      Returns a graphics configuration that does not rely on a display.
      protected abstract Paper createPaper​(java.awt.Graphics g, java.awt.Rectangle bounds)
      Creates a paper instance for use with this PaperType.
      protected abstract void flushPaper​(Paper paper)
      Called when all the layers have been painted.
      boolean isBitmap()
      Returns false.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PaintPaperType

        protected PaintPaperType​(java.lang.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 Detail

      • isBitmap

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

        public javax.swing.Icon createDataIcon​(Surface surface,
                                               Drawing[] drawings,
                                               java.lang.Object[] plans,
                                               DataStore dataStore,
                                               boolean cached)
        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
        cached - hint about whether to cache the calculation data
        Returns:
        plotBounds-sized icon
      • createPaper

        protected abstract Paper createPaper​(java.awt.Graphics g,
                                             java.awt.Rectangle bounds)
        Creates a paper instance for use with this PaperType.
        Parameters:
        g - graphics context to which paper should output
        bounds - plot bounds
        Returns:
        new paper instance
      • flushPaper

        protected abstract void flushPaper​(Paper paper)
        Called when all the layers have been painted.
        Parameters:
        paper - graphics destination
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • createHeadlessGraphicsConfig

        public static java.awt.GraphicsConfiguration createHeadlessGraphicsConfig​(int imtype)
        Returns a graphics configuration that does not rely on a display.
        Parameters:
        imtype - image type as used by BufferedImage
        Returns:
        graphics config