Package gov.nih.mipav.model.algorithms
Class ContourPlot.BarycentricGradientPaint
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.ContourPlot.BarycentricGradientPaint
-
- All Implemented Interfaces:
java.awt.Paint
,java.awt.Transparency
- Enclosing class:
- ContourPlot
public class ContourPlot.BarycentricGradientPaint extends java.lang.Object implements java.awt.Paint
The BarycentricGradientPaint class provides a way to fill aShape
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
-
-
Constructor Summary
Constructors Constructor Description BarycentricGradientPaint(double x1, double y1, double x2, double y2, double x3, double y3, java.awt.Color color1, java.awt.Color color2, java.awt.Color color3)
Creates a newContourPlot.BarycentricGradientPaint
object with specified triangle vertices and vertex colors.BarycentricGradientPaint(float[] x, float[] y, java.awt.Color color1, java.awt.Color color2, java.awt.Color color3)
Creates a newContourPlot.BarycentricGradientPaint
object with specified triangle vertices and vertex colors.BarycentricGradientPaint(float x1, float y1, float x2, float y2, float x3, float y3, java.awt.Color color1, java.awt.Color color2, java.awt.Color color3)
Creates a newContourPlot.BarycentricGradientPaint
object with specified triangle vertices and vertex colors.BarycentricGradientPaint(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, java.awt.geom.Point2D p3, java.awt.Color color1, java.awt.Color color2, java.awt.Color color3)
Creates a newContourPlot.BarycentricGradientPaint
object with specified triangle vertices and vertex colors.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.PaintContext
createContext(java.awt.image.ColorModel cm, java.awt.Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform xform, java.awt.RenderingHints hints)
int
getTransparency()
-
-
-
Constructor Detail
-
BarycentricGradientPaint
public BarycentricGradientPaint(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, java.awt.geom.Point2D p3, java.awt.Color color1, java.awt.Color color2, java.awt.Color color3)
Creates a newContourPlot.BarycentricGradientPaint
object 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
public BarycentricGradientPaint(float[] x, float[] y, java.awt.Color color1, java.awt.Color color2, java.awt.Color color3)
Creates a newContourPlot.BarycentricGradientPaint
object 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, java.awt.Color color1, java.awt.Color color2, java.awt.Color color3)
Creates a newContourPlot.BarycentricGradientPaint
object 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, java.awt.Color color1, java.awt.Color color2, java.awt.Color color3)
Creates a newContourPlot.BarycentricGradientPaint
object 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 Detail
-
getTransparency
public int getTransparency()
- Specified by:
getTransparency
in interfacejava.awt.Transparency
-
createContext
public java.awt.PaintContext createContext(java.awt.image.ColorModel cm, java.awt.Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform xform, java.awt.RenderingHints hints)
- Specified by:
createContext
in interfacejava.awt.Paint
-
-