public class HalftoneGradient extends TransformedTexturePaint
This creates an image as a tile and uses an underlying TexturePaint to do most of the rendering.
| Modifier and Type | Field and Description |
|---|---|
protected int |
color1
|
protected int |
color2
|
protected boolean |
cycle
|
static int |
DEFAULT_WIDTH
The default suggested width for the tiled pattern.
|
static int |
TYPE_CIRCLE
|
static int |
TYPE_DIAMOND
|
static int |
TYPE_TRIANGLE
|
protected double |
x1
|
protected double |
x2
|
protected double |
y1
|
protected double |
y2
|
BITMASK, OPAQUE, TRANSLUCENT| Constructor and Description |
|---|
HalftoneGradient(float x1, float y1, Color
Create a new
HalftoneGradient.
|
HalftoneGradient(Point2D
Create a new
HalftoneGradient using circles and the default width.
|
HalftoneGradient(Point2D
Create a new
HalftoneGradient.
|
| Modifier and Type | Method and Description |
|---|---|
PaintContext |
createContext(ColorModel
|
Color |
getColor1()
Returns the color C1 anchored by the point P1.
|
Color |
getColor2()
Returns the color C2 anchored by the point P2.
|
Point2D |
getPoint1()
Returns a copy of the point P1 that anchors the first color.
|
Point2D |
getPoint2()
Returns a copy of the point P2 which anchors the second color.
|
getAnchorRect, getImage, getTransform, getTransparencypublic static final int TYPE_DIAMOND
public static final int TYPE_CIRCLE
public static final int TYPE_TRIANGLE
public static final int DEFAULT_WIDTH
protected boolean cycle
protected final double x1
protected final double y1
protected final double x2
protected final double y2
protected final int color1
protected final int color2
public HalftoneGradient(Point2Dp1, Color c1, Point2D p2, Color c2)
HalftoneGradient using circles and the default width.
p1 - the first point.
c1 - the first color.
p2 - the second point.
c2 - the second color.
public HalftoneGradient(Point2Dp1, Color c1, Point2D p2, Color c2, int width, int type, boolean cycle, float offset, float shear)
HalftoneGradient.
p1 - the first point.
c1 - the first color.
p2 - the second point.
c2 - the second color.
width - the width of the repeating pattern.
type - the type (TYPE_DIAMOND, TYPE_CIRCLE or TYPE_TRIANGLE)
cycle - whether this gradient repeats or not.
offset - a float from [0,1] that can be used to animate this gradient.
shear - a float (default should be zero) that shears the transform. In general this should be between [-2,2] for best results.
public HalftoneGradient(float x1,
float y1,
Color c1,
float x2,
float y2,
Color c2,
int width,
int type,
boolean cycle,
float offset,
float shear)
HalftoneGradient.
x1 - the x-coordinate of the first point.
y1 - the y-coordinate of the first point.
c1 - the first color.
x2 - the x-coordinate of the second point.
y2 - the y-coordinate of the second point.
c2 - the second color.
width - the width of the repeating pattern.
type - the type (TYPE_DIAMOND, TYPE_CIRCLE or TYPE_TRIANGLE)
cycle - whether this gradient repeats or not.
offset - a float from [0,1] that can be used to animate this gradient.
shear - a float (default should be zero) that shears the transform. In general this should be between [-2,2] for best results.
public Point2DgetPoint1()
public Point2DgetPoint2()
public ColorgetColor1()
public ColorgetColor2()
public PaintContextcreateContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints)