public class IlvBlinkingPaint extends Object implements Paint, IlvAdaptablePaint, IlvBlinkingDrawingResource
IlvGraphic
support blinking paints.
Limitation: For technical reasons, the "on" and "off" durations are limited from 1 to max integer (not max long). It is recommended to use the same durations whenever possible for all objects, and to choose the durations not too small (e.g. not smaller than 100 ms), because otherwise the performance of the system will degrade dramatically.
KEY_USER_BOUNDSBITMASK, OPAQUE, TRANSLUCENT| Constructor and Description |
|---|
IlvBlinkingPaint(Paint onPaint,
Paint offPaint)
Creates a new blinking paint.
|
IlvBlinkingPaint(Paint onPaint,
Paint offPaint,
long onPeriod,
long offPeriod)
Creates a new blinking paint.
|
| Modifier and Type | Method and Description |
|---|---|
PaintContext |
createContext(ColorModel cm,
Rectangle r,
Rectangle2D r2d,
AffineTransform xform,
RenderingHints hints)
Creates and returns a
PaintContext. |
boolean |
equals(Object obj)
Determines whether another object is equal to this
IlvBlinkingPaint. |
Paint |
getCurrentPaint()
Returns current paint.
|
Paint |
getOffPaint()
Returns the paint of the "off" period.
|
long |
getOffPeriod()
Returns the duration, in milliseconds, of the "off" period.
|
Paint |
getOnPaint()
Returns the paint of the "on" period.
|
long |
getOnPeriod()
Returns the duration, in milliseconds, of the "on" period.
|
int |
getTransparency()
Returns the transparency mode for this
Paint. |
int |
hashCode()
Returns the hash code of this object.
|
boolean |
isAdapting()
Returns
true if the createContext method of this
object may rely on its userBounds argument. |
boolean |
isOn()
Returns
true if this paint displays like the "on" state,
and false if this paint displays like the "off" state. |
void |
notifyUsed(IlvBlinkingObject obj,
boolean used)
Called by
IlvGraphic if this paint is used. |
void |
setOn(boolean flag)
Sets whether this paint displays like the "on" or "off" state.
|
void |
setTemporarilyDisabled(boolean flag)
Temporarily disable the blinking.
|
public IlvBlinkingPaint(Paint onPaint, Paint offPaint)
onPaint - Paint used during the "on" periodoffPaint - Paint used during the "off" periodpublic IlvBlinkingPaint(Paint onPaint, Paint offPaint, long onPeriod, long offPeriod)
onPaint - Paint used during the "on" periodoffPaint - Paint used during the "off" periodonPeriod - Duration, in milliseconds, of the "on" periodoffPeriod - Duration, in milliseconds, of the "off" periodpublic boolean equals(Object obj)
IlvBlinkingPaint.public int hashCode()
public PaintContext createContext(ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, RenderingHints hints)
PaintContext.
If the current state is on, it returns a context representing the "on
paint", otherwise the "off paint".createContext in interface Paintcm - the specified ColorModelr - the specified Rectangler2d - the specified Rectangle2Dxform - the specified AffineTransformhints - the specified RenderingHintsPaintContext that is used to generate a
solid color pattern.Paint.createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints),
Paint,
PaintContext,
getOnPaint(),
getOffPaint()public int getTransparency()
Paint.
If the current state is on, it returns a transparency of the "on
paint", otherwise of the "off paint".getTransparency in interface TransparencyPaint object's transparency mode.Paint,
Transparency,
getOnPaint(),
getOffPaint()public boolean isAdapting()
true if the createContext method of this
object may rely on its userBounds argument.isAdapting in interface IlvAdaptablePaintpublic Paint getCurrentPaint()
public Paint getOnPaint()
public Paint getOffPaint()
public long getOnPeriod()
getOnPeriod in interface IlvBlinkingDrawingResourcepublic long getOffPeriod()
getOffPeriod in interface IlvBlinkingDrawingResourcepublic void setOn(boolean flag)
setOn in interface IlvBlinkingDrawingResourceflag - true means it displays like the "on" statepublic boolean isOn()
true if this paint displays like the "on" state,
and false if this paint displays like the "off" state.isOn in interface IlvBlinkingDrawingResourcepublic void setTemporarilyDisabled(boolean flag)
setTemporarilyDisabled in interface IlvBlinkingDrawingResourceflag - true if temporarily disabled.public void notifyUsed(IlvBlinkingObject obj, boolean used)
IlvGraphic if this paint is used.
You should not call this method.notifyUsed in interface IlvBlinkingDrawingResourceobj - The blinking object.used - Whether the paint is used.© Copyright Rogue Wave Software, Inc. 1997, 2017. All Rights Reserved.