Package gov.nih.mipav.model.algorithms
Class ContourPlot.BarycentricGradientPaint
java.lang.Object
gov.nih.mipav.model.algorithms.ContourPlot.BarycentricGradientPaint
- All Implemented Interfaces:
Paint,Transparency
- Enclosing class:
ContourPlot
The BarycentricGradientPaint class provides a way to fill a
Shape
with a triangular color gradient.
Colors are specified for the vertices of a triangle and interpolated within
the triangle according to barycentric coordinates.
Only areas of the filled shape that are intersecting with the triangle of
this paint are colored.
This paint supports the ANTIALIASING rendering hint
(RenderingHints) using a 4x multisampling approach.
When enabled, the edges of the triangle will appear anti-aliased.
It is recommended to disable AA when filling a triangle mesh (where triangles
are adjacent), since otherwise triangle edges become visible.
Note that it is not necessary to use a triangular Shape to render a
triangle. Instead a rectangle can be used as well, since only the intersecting
area will be filled.
- Author:
- hageldave
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Colorprotected Colorprotected Colorprotected Point2D.Floatprotected Point2D.Floatprotected Point2D.FloatFields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT -
Constructor Summary
ConstructorsConstructorDescriptionBarycentricGradientPaint(double x1, double y1, double x2, double y2, double x3, double y3, Color color1, Color color2, Color color3) Creates a newContourPlot.BarycentricGradientPaintobject with specified triangle vertices and vertex colors.BarycentricGradientPaint(float[] x, float[] y, Color color1, Color color2, Color color3) Creates a newContourPlot.BarycentricGradientPaintobject with specified triangle vertices and vertex colors.BarycentricGradientPaint(float x1, float y1, float x2, float y2, float x3, float y3, Color color1, Color color2, Color color3) Creates a newContourPlot.BarycentricGradientPaintobject with specified triangle vertices and vertex colors.BarycentricGradientPaint(Point2D p1, Point2D p2, Point2D p3, Color color1, Color color2, Color color3) Creates a newContourPlot.BarycentricGradientPaintobject with specified triangle vertices and vertex colors. -
Method Summary
Modifier and TypeMethodDescriptioncreateContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) int
-
Field Details
-
p1
-
p2
-
p3
-
color1
-
color2
-
color3
-
-
Constructor Details
-
BarycentricGradientPaint
public BarycentricGradientPaint(Point2D p1, Point2D p2, Point2D p3, Color color1, Color color2, Color color3) Creates a newContourPlot.BarycentricGradientPaintobject with specified triangle vertices and vertex colors.- Parameters:
p1- vertex of trianglep2- vertex of trianglep3- vertex of trianglecolor1- color of vertexcolor2- color of vertexcolor3- color of vertex
-
BarycentricGradientPaint
Creates a newContourPlot.BarycentricGradientPaintobject with specified triangle vertices and vertex colors.- Parameters:
x- x-coordinates for the triangle verticesy- y-coordinates for the triangle verticescolor1- color of vertexcolor2- color of vertexcolor3- color of vertex
-
BarycentricGradientPaint
public BarycentricGradientPaint(double x1, double y1, double x2, double y2, double x3, double y3, Color color1, Color color2, Color color3) Creates a newContourPlot.BarycentricGradientPaintobject with specified triangle vertices and vertex colors.- Parameters:
x1- x-coord of triangle vertexy1- y-coord of triangle vertexx2- x-coord of triangle vertexy2- y-coord of triangle vertexx3- x-coord of triangle vertexy3- y-coord of triangle vertexcolor1- color of vertexcolor2- color of vertexcolor3- color of vertex
-
BarycentricGradientPaint
public BarycentricGradientPaint(float x1, float y1, float x2, float y2, float x3, float y3, Color color1, Color color2, Color color3) Creates a newContourPlot.BarycentricGradientPaintobject with specified triangle vertices and vertex colors.- Parameters:
x1- x-coord of triangle vertexy1- y-coord of triangle vertexx2- x-coord of triangle vertexy2- y-coord of triangle vertexx3- x-coord of triangle vertexy3- y-coord of triangle vertexcolor1- color of vertexcolor2- color of vertexcolor3- color of vertex
-
-
Method Details
-
getTransparency
public int getTransparency()- Specified by:
getTransparencyin interfaceTransparency
-
createContext
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) - Specified by:
createContextin interfacePaint
-