Class ContourPlot.BarycentricGradientPaintContext

  • All Implemented Interfaces:
    java.awt.PaintContext
    Enclosing class:
    ContourPlot

    public class ContourPlot.BarycentricGradientPaintContext
    extends java.lang.Object
    implements java.awt.PaintContext
    This class is implements the PaintContext for ContourPlot.BarycentricGradientPaint.

    The context operates solely in ARGB color space (blue on least significant bits) with an integer packing DirectColorModel.

    A cache for raster memory is implemented to avoid costly memory allocations.

    Author:
    hageldave
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean antialiasing  
      protected int c1  
      protected int c2  
      protected int c3  
      protected java.lang.ref.WeakReference<int[]> cache  
      protected java.awt.image.DirectColorModel cm  
      protected float denom  
      protected float[] MSAA_SAMPLES  
      protected java.awt.image.WritableRaster saved  
      protected float x1  
      protected float x13  
      protected float x2  
      protected float x23  
      protected float x3  
      protected float y1  
      protected float y13  
      protected float y2  
      protected float y23  
      protected float y3  
    • Constructor Summary

      Constructors 
      Constructor Description
      BarycentricGradientPaintContext​(java.awt.geom.Point2D.Float p1, java.awt.geom.Point2D.Float p2, java.awt.geom.Point2D.Float p3, java.awt.Color color1, java.awt.Color color2, java.awt.Color color3, java.awt.geom.AffineTransform xform, boolean antialiasing)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int a​(int argb)  
      private int argb​(int a, int r, int g, int b)  
      private int b​(int argb)  
      protected void cacheRaster​(java.awt.image.WritableRaster ras)  
      protected java.awt.image.WritableRaster createRaster​(int w, int h, int[] data)  
      private int[] dataFromRaster​(java.awt.image.WritableRaster wr)  
      void dispose()  
      protected void fillRaster​(int xA, int yA, int w, int h, int[] data)  
      protected void fillRasterMSAA​(int xA, int yA, int w, int h, int[] data)  
      private int g​(int argb)  
      protected java.awt.image.WritableRaster getCachedOrCreateRaster​(int w, int h)  
      java.awt.image.ColorModel getColorModel()  
      java.awt.image.Raster getRaster​(int xA, int yA, int w, int h)  
      private int mixColor3​(int c1, int c2, int c3, float m1, float m2, float m3)  
      private int mixColor4​(int c1, int c2, int c3, int c4, float m1, float m2, float m3, float m4)  
      private int r​(int argb)  
      private int scaleColorAlpha​(int color, float m)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MSAA_SAMPLES

        protected final float[] MSAA_SAMPLES
      • x1

        protected final float x1
      • x2

        protected final float x2
      • x3

        protected final float x3
      • y1

        protected final float y1
      • y2

        protected final float y2
      • y3

        protected final float y3
      • x23

        protected final float x23
      • x13

        protected final float x13
      • y23

        protected final float y23
      • y13

        protected final float y13
      • denom

        protected final float denom
      • c1

        protected final int c1
      • c2

        protected final int c2
      • c3

        protected final int c3
      • cm

        protected final java.awt.image.DirectColorModel cm
      • antialiasing

        protected final boolean antialiasing
      • saved

        protected java.awt.image.WritableRaster saved
      • cache

        protected java.lang.ref.WeakReference<int[]> cache
    • Constructor Detail

      • BarycentricGradientPaintContext

        public BarycentricGradientPaintContext​(java.awt.geom.Point2D.Float p1,
                                               java.awt.geom.Point2D.Float p2,
                                               java.awt.geom.Point2D.Float p3,
                                               java.awt.Color color1,
                                               java.awt.Color color2,
                                               java.awt.Color color3,
                                               java.awt.geom.AffineTransform xform,
                                               boolean antialiasing)
    • Method Detail

      • dispose

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

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

        public java.awt.image.Raster getRaster​(int xA,
                                               int yA,
                                               int w,
                                               int h)
        Specified by:
        getRaster in interface java.awt.PaintContext
      • fillRaster

        protected void fillRaster​(int xA,
                                  int yA,
                                  int w,
                                  int h,
                                  int[] data)
      • fillRasterMSAA

        protected void fillRasterMSAA​(int xA,
                                      int yA,
                                      int w,
                                      int h,
                                      int[] data)
      • getCachedOrCreateRaster

        protected java.awt.image.WritableRaster getCachedOrCreateRaster​(int w,
                                                                        int h)
      • cacheRaster

        protected void cacheRaster​(java.awt.image.WritableRaster ras)
      • createRaster

        protected java.awt.image.WritableRaster createRaster​(int w,
                                                             int h,
                                                             int[] data)
      • dataFromRaster

        private int[] dataFromRaster​(java.awt.image.WritableRaster wr)
      • mixColor3

        private int mixColor3​(int c1,
                              int c2,
                              int c3,
                              float m1,
                              float m2,
                              float m3)
      • mixColor4

        private int mixColor4​(int c1,
                              int c2,
                              int c3,
                              int c4,
                              float m1,
                              float m2,
                              float m3,
                              float m4)
      • a

        private int a​(int argb)
      • r

        private int r​(int argb)
      • g

        private int g​(int argb)
      • b

        private int b​(int argb)
      • argb

        private int argb​(int a,
                         int r,
                         int g,
                         int b)
      • scaleColorAlpha

        private int scaleColorAlpha​(int color,
                                    float m)