public class HImageEffectMatte extends Object implements HMatte, HAnimateEffect
HImageEffectMatte class
represents a matte that varies over both space and time, it is
specified as a sequence of image masks.
The data for any HImageEffectMatte may be changed "on the fly"
using the setMatteData method.
However, some implementations may be asynchronously referencing
their content (i.e. through a separate implementation-specific
animation thread). Therefore the following restrictions apply to
the setMatteData method:
| Parameter | Description | Default value | Set method | Get method |
|---|---|---|---|---|
| data | The transparency data for this image effect matte. | null (the matte should be treated as being spatially and temporally unvarying and opaque) | setMatteData |
getMatteData |
| Description | Default value | Set method | Get method |
|---|---|---|---|
| The initial piece of content to be presented, i.e. its position in the content array. | 0 | setPosition |
getPosition |
| By default the animation should be stopped. Hence, to start the animation its start method must be explicitly invoked. This mechanism allows for animations that are programmatically controlled, e.g. via the setPosition method. | "stopped" | start /
stop |
isAnimated |
The pixel offset for each image within the HImageEffectMatte, relative to the
top, left corner of its associated component. |
A java.awt.Point (0, 0) | setOffset |
getOffset |
PLAY_ALTERNATING, PLAY_REPEATING, REPEAT_INFINITE| Constructor and Description |
|---|
HImageEffectMatte()
Creates an
HImageEffectMatte object. |
HImageEffectMatte(Image[] data)
Creates an
HImageEffectMatte object. |
| Modifier and Type | Method and Description |
|---|---|
int |
getDelay()
Gets the presentation delay for this
HImageEffectMatte. |
Image[] |
getMatteData()
Returns the data used for this matte.
|
Point |
getOffset(int index)
Get the offset of a specified frame of the matte relative to
its component in pixels.
|
int |
getPlayMode()
Gets the playing mode for this
HImageEffectMatte. |
int |
getPosition()
Get the current index into the content array which this
HImageEffectMatte is using to display
content. |
int |
getRepeatCount()
Gets the number of times that this
HImageEffectMatte is to be played. |
boolean |
isAnimated()
This method indicates the animation (running) state of the
HImageEffectMatte. |
void |
setDelay(int count)
Sets the delay between the presentation of successive pieces of
content (frames).
|
void |
setMatteData(Image[] data)
Sets the data for this matte (an array of images).
|
void |
setOffset(Point p,
int index)
Set the offset of a specified frame of the matte relative to
its component in pixels.
|
void |
setPlayMode(int mode)
Sets the playing mode for this
HImageEffectMatte. |
void |
setPosition(int position)
Set this
HImageEffectMatte to
display the content at the specified position. |
void |
setRepeatCount(int count)
Sets the number of times that this
HImageEffectMatte should be played. |
void |
start()
This method starts this
HImageEffectMatte playing. |
void |
stop()
This method indicates that the running
HImageEffectMatte should be
stopped. |
public HImageEffectMatte()
HImageEffectMatte object. See the class description for
details of constructor parameters and default values.public HImageEffectMatte(Image[] data)
HImageEffectMatte object. See the class description for
details of constructor parameters and default values.public void setMatteData(Image[] data)
Note that if the size of an image is smaller than the size of
the component to which the matte is applied, the empty space
behaves as if it were an opaque flat matte of value 1.0. By
default images are aligned at the top left corner of the
component. This can be changed with the setOffset method
data - the data for this matte. Specify a null object to
remove the associated data for this matte. If the length of the
data array is zero, an IllegalArgumentException is thrown. If
an element of the data array is null, or an image referred to
is still being loaded, then that image will be skipped when the
animation is playing.public Image[] getMatteData()
public void setOffset(Point p, int index)
p - the offset of the specified frame of the matte
relative to the top left corner of its component in pixels. If
p is null a NullPointerException is thrown.index - the zero-index to the data for which the offset
should be applied. If index is not valid for this matte an
IndexOutOfBounds exception is thrown.public Point getOffset(int index)
index - the zero-index to the data for which the offset
should be recovered. If index is not valid for this matte an
IndexOutOfBounds exception is thrown.public void start()
HImageEffectMatte playing. If start is called when
the animation is already running it resets the animation
according to the current play mode, as returned by getPlayMode.start in interface HAnimateEffectpublic void stop()
HImageEffectMatte should be
stopped. After calling this method, there is no guarantee that
one or more frames will not be displayed before the animation
actually stops playing. If the animation is already stopped
further calls to stop have no effect.stop in interface HAnimateEffectpublic boolean isAnimated()
HImageEffectMatte.isAnimated in interface HAnimateEffecttrue if this HImageEffectMatte is running, i.e. the start method
has been invoked - false otherwise.public void setPosition(int position)
HImageEffectMatte to
display the content at the specified position. If the animation
is already running a call to setPosition will
change the current value and affect the animation immediately.setPosition in interface HAnimateEffectposition - an index into the content array which specifies
the next piece of content to be displayed. If
position is less than 0, then the array element at
index 0 is displayed, if position is greater than
or equal to the length of the content array, then the array
element at index [length-1] will be used.public int getPosition()
HImageEffectMatte is using to display
content.getPosition in interface HAnimateEffect0 <= index < lengthpublic void setRepeatCount(int count)
HImageEffectMatte should be played.
If the animation is already running a call to
setRepeatCount will change the current value and
reset the current number of repeats to 0, affecting the
animation immediately.setRepeatCount in interface HAnimateEffectcount - the number of times that an HImageEffectMatte should be
played. Valid values of the repeat count are one or more, and
REPEAT_INFINITE.public int getRepeatCount()
HImageEffectMatte is to be played. Note that this method does not
return the number of repeats that are remaining to be played.
Except for HAnimateEffect implementations that specify a
different default, getRepeatCount() returns
REPEAT_INFINITE if no call to
setRepeatCount() has previously been made.
getRepeatCount in interface HAnimateEffectHImageEffectMatte is to be played. The
returned value shall be greater than zero, or REPEAT_INFINITE.public void setDelay(int count)
After calling setDelay on a currently playing HImageEffectMatte, there is no
guarantee that one or more frames will not be displayed using
the previous delay until the new delay value takes effect.
setDelay in interface HAnimateEffectcount - the content presentation delay in units of 0.1
seconds duration. If count is less than one "unit",
then it shall be treated as if it were a delay of one
"unit", i.e. 0.1 seconds.public int getDelay()
HImageEffectMatte.getDelay in interface HAnimateEffectpublic void setPlayMode(int mode)
HImageEffectMatte. If the animation is already running a call to
setPlayMode will change the current value and
affect the animation immediately. The position of the animation
is unchanged.setPlayMode in interface HAnimateEffectmode - the play mode for this HImageEffectMatte, which must be either HAnimateEffect.PLAY_ALTERNATING or HAnimateEffect.PLAY_REPEATING.public int getPlayMode()
HImageEffectMatte.getPlayMode in interface HAnimateEffectHImageEffectMatte.Copyright © 2012 code4tv.com. All Rights Reserved.