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_BOUNDS
BITMASK, 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 Paint
cm
- the specified ColorModel
r
- the specified Rectangle
r2d
- the specified Rectangle2D
xform
- the specified AffineTransform
hints
- the specified RenderingHints
PaintContext
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 Transparency
Paint
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 IlvAdaptablePaint
public Paint getCurrentPaint()
public Paint getOnPaint()
public Paint getOffPaint()
public long getOnPeriod()
getOnPeriod
in interface IlvBlinkingDrawingResource
public long getOffPeriod()
getOffPeriod
in interface IlvBlinkingDrawingResource
public void setOn(boolean flag)
setOn
in interface IlvBlinkingDrawingResource
flag
- 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 IlvBlinkingDrawingResource
public void setTemporarilyDisabled(boolean flag)
setTemporarilyDisabled
in interface IlvBlinkingDrawingResource
flag
- 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 IlvBlinkingDrawingResource
obj
- The blinking object.used
- Whether the paint is used.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.