Package gov.nih.mipav.model.algorithms
Class ContourPlot.BarycentricGradientPaintContext
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.ContourPlot.BarycentricGradientPaintContext
-
- All Implemented Interfaces:
java.awt.PaintContext
- Enclosing class:
- ContourPlot
public class ContourPlot.BarycentricGradientPaintContext extends java.lang.Object implements java.awt.PaintContextThis class is implements thePaintContextforContourPlot.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 booleanantialiasingprotected intc1protected intc2protected intc3protected java.lang.ref.WeakReference<int[]>cacheprotected java.awt.image.DirectColorModelcmprotected floatdenomprotected float[]MSAA_SAMPLESprotected java.awt.image.WritableRastersavedprotected floatx1protected floatx13protected floatx2protected floatx23protected floatx3protected floaty1protected floaty13protected floaty2protected floaty23protected floaty3
-
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 inta(int argb)private intargb(int a, int r, int g, int b)private intb(int argb)protected voidcacheRaster(java.awt.image.WritableRaster ras)protected java.awt.image.WritableRastercreateRaster(int w, int h, int[] data)private int[]dataFromRaster(java.awt.image.WritableRaster wr)voiddispose()protected voidfillRaster(int xA, int yA, int w, int h, int[] data)protected voidfillRasterMSAA(int xA, int yA, int w, int h, int[] data)private intg(int argb)protected java.awt.image.WritableRastergetCachedOrCreateRaster(int w, int h)java.awt.image.ColorModelgetColorModel()java.awt.image.RastergetRaster(int xA, int yA, int w, int h)private intmixColor3(int c1, int c2, int c3, float m1, float m2, float m3)private intmixColor4(int c1, int c2, int c3, int c4, float m1, float m2, float m3, float m4)private intr(int argb)private intscaleColorAlpha(int color, float m)
-
-
-
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:
disposein interfacejava.awt.PaintContext
-
getColorModel
public java.awt.image.ColorModel getColorModel()
- Specified by:
getColorModelin interfacejava.awt.PaintContext
-
getRaster
public java.awt.image.Raster getRaster(int xA, int yA, int w, int h)- Specified by:
getRasterin interfacejava.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)
-
-