public class IlvPaint extends Object implements Paint, IlvPersistentObject
java.awt.Paint
implementation that is bean
compliant. It can be used in SDM to create a Paint
object used
in many IlvGraphic
s. The default value is Color.black
.
Here is an example of use in SDM. It creates a gradient paint from blue to yellow, with anchor points at (0,10) and (10,10):
#paintGradient {
class : 'ilog.views.sdm.graphic.IlvPaint';
gradientColor1 : blue ;
gradientColor2 : yellow ;
gradientAnchors : 0,10,10,10;
cyclic : false;
}
BITMASK, OPAQUE, TRANSLUCENT
Constructor and Description |
---|
IlvPaint()
Bean constructor.
|
IlvPaint(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
Modifier and Type | Method and Description |
---|---|
PaintContext |
createContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform xform,
RenderingHints hints)
Implementation of the
Paint interface. |
Color |
getColor()
Returns the paint color.
|
float[] |
getGradientAnchors()
Returns the anchor coordinates.
|
Color |
getGradientColor1()
Returns one of the gradient colors.
|
Color |
getGradientColor2()
Returns one of the gradient colors.
|
IlvTexture |
getTexture()
Returns the texture paint.
|
int |
getTransparency()
Implementation of the
Transparency interface. |
boolean |
isCyclic()
Returns the cyclic value for gradient paint.
|
void |
setColor(Color color)
Sets the
Paint implementation to java.awt.Color . |
void |
setCyclic(boolean cyclic)
Sets the
Paint implementation to java.awt.GradientPaint . |
void |
setGradientAnchors(float[] gradientAnchors)
Sets the
Paint implementation to java.awt.GradientPaint . |
void |
setGradientColor1(Color gradientColor)
Sets the
Paint implementation to java.awt.GradientPaint . |
void |
setGradientColor2(Color gradientColor)
Sets the
Paint implementation to java.awt.GradientPaint . |
void |
setTexture(IlvTexture paint)
Sets the
Paint implementation to IlvTexture . |
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
public IlvPaint()
public IlvPaint(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- The input stream.IlvReadFileException
- if the format is not correct.public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints)
Paint
interface.createContext
in interface Paint
cm
- The java.awt.image.ColorModel
that
receives the Paint
data. This is used only as a hint.deviceBounds
- The device space bounding box of
the graphics primitive being rendered.userBounds
- The user space bounding box of
the graphics primitive being rendered.xform
- The java.awt.geom.AffineTransform
from user space into device space.hints
- The hint that the context object uses to
choose between rendering alternatives.java.awt.PaintContext
for generating
color patterns.PaintContext
public int getTransparency()
Transparency
interface.getTransparency
in interface Transparency
public void setColor(Color color)
Paint
implementation to java.awt.Color
.color
- The color.public Color getColor()
null
if the Paint
implementation is not a color.public void setGradientAnchors(float[] gradientAnchors)
Paint
implementation to java.awt.GradientPaint
.gradientAnchors
- Contains x1, y1, x2, and y2, the four
coordinates of the two points anchoring the gradient pattern.public float[] getGradientAnchors()
null
if the Paint
implementation is not a GradientPaint
.public void setGradientColor1(Color gradientColor)
Paint
implementation to java.awt.GradientPaint
.gradientColor
- The first of the two colors used to
define the gradient.public Color getGradientColor1()
null
if
the Paint
implementation is not a GradientPaint
.public void setGradientColor2(Color gradientColor)
Paint
implementation to java.awt.GradientPaint
.gradientColor
- The second of the two colors used to
define the gradient.public Color getGradientColor2()
null
if
the Paint
implementation is not a GradientPaint
.public void setCyclic(boolean cyclic)
Paint
implementation to java.awt.GradientPaint
.cyclic
- The cyclic argument of the gradient
paint. The default is true
.public boolean isCyclic()
public void setTexture(IlvTexture paint)
Paint
implementation to IlvTexture
.paint
- The new texture.public IlvTexture getTexture()
IlvTexture
if the current paint implementation is
IlvTexture
, and null
otherwise.public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.
You should not
call this method directly; instead, you should use the write
methods of the manager.write
in interface IlvPersistentObject
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.