org.havi.ui
Class HFlatEffectMatte

java.lang.Object
  extended byorg.havi.ui.HFlatEffectMatte
All Implemented Interfaces:
HAnimateEffect, HMatte

public class HFlatEffectMatte
extends java.lang.Object
implements HMatte, HAnimateEffect

The HFlatEffectMatte class represents a matte that is constant over space but varies over time. It is specified as a sequence of floating point values in the range 0.0 to 1.0 where:

The data for any HFlatEffectMatte 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:


The parameters to the constructors are as follows, in cases where parameters are not used, then the constructor should use the default values.

Default parameter values exposed in the constructors

ParameterDescriptionDefault value Set methodGet method
data The transparency value for this flat effect matte. null (the matte should be treated as being temporally unvarying and opaque) setMatteData getMatteData

Default parameter values not exposed in the constructors

DescriptionDefault valueSet 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


Field Summary
 
Fields inherited from interface org.havi.ui.HAnimateEffect
PLAY_ALTERNATING, PLAY_REPEATING, REPEAT_INFINITE
 
Constructor Summary
HFlatEffectMatte()
          Creates an HFlatEffectMatte object.
HFlatEffectMatte(float[] data)
          Creates an HFlatEffectMatte object.
 
Method Summary
 int getDelay()
          Gets the presentation delay for this HFlatEffectMatte.
 float[] getMatteData()
          Returns the matte data used for this matte.
 int getPlayMode()
          Gets the playing mode for this HFlatEffectMatte.
 int getPosition()
          Get the current index into the content array which this HFlatEffectMatte is using to display content.
 int getRepeatCount()
          Gets the number of times that this HFlatEffectMatte is to be played.
 boolean isAnimated()
          This method indicates the animation (running) state of the HFlatEffectMatte.
 void setDelay(int count)
          Sets the delay between the presentation of successive pieces of content (frames).
 void setMatteData(float[] data)
          Sets the data for this matte.
 void setPlayMode(int mode)
          Sets the playing mode for this HFlatEffectMatte.
 void setPosition(int position)
          Set this HFlatEffectMatte to display the content at the specified position.
 void setRepeatCount(int count)
          Sets the number of times that this HFlatEffectMatte should be played.
 void start()
          This method starts this HFlatEffectMatte playing.
 void stop()
          This method indicates that the running HFlatEffectMatte should be stopped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HFlatEffectMatte

public HFlatEffectMatte()
Creates an HFlatEffectMatte object. See the class description for details of constructor parameters and default values.


HFlatEffectMatte

public HFlatEffectMatte(float[] data)
Creates an HFlatEffectMatte object. See the class description for details of constructor parameters and default values.

Method Detail

setMatteData

public void setMatteData(float[] data)
Sets the data for this matte. Any previously set data is replaced. If this method is called when the animation is running the data is changed immediately and the current animation position is reset according to the active play mode. The changes affect the animation immediately.

Parameters:
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.

getMatteData

public float[] getMatteData()
Returns the matte data used for this matte.

Returns:
the data used for this matte (an array of numbers), or null if no matte data has been set.

start

public void start()
This method starts this HFlatEffectMatte 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.

Specified by:
start in interface HAnimateEffect

stop

public void stop()
This method indicates that the running HFlatEffectMatte 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.

Specified by:
stop in interface HAnimateEffect

isAnimated

public boolean isAnimated()
This method indicates the animation (running) state of the HFlatEffectMatte.

Specified by:
isAnimated in interface HAnimateEffect
Returns:
true if this HFlatEffectMatte is running, i.e. the start method has been invoked - false otherwise.

setPosition

public void setPosition(int position)
Set this HFlatEffectMatte 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.

Specified by:
setPosition in interface HAnimateEffect
Parameters:
position - 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.

getPosition

public int getPosition()
Get the current index into the content array which this HFlatEffectMatte is using to display content.

Specified by:
getPosition in interface HAnimateEffect
Returns:
the index of the content currently being displayed, in the range 0 <= index < length

setRepeatCount

public void setRepeatCount(int count)
Sets the number of times that this HFlatEffectMatte 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.

Specified by:
setRepeatCount in interface HAnimateEffect
Parameters:
count - the number of times that an HFlatEffectMatte should be played. Valid values of the repeat count are one or more, and REPEAT_INFINITE.

getRepeatCount

public int getRepeatCount()
Gets the number of times that this HFlatEffectMatte 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.

Specified by:
getRepeatCount in interface HAnimateEffect
Returns:
the total number of times that an HFlatEffectMatte is to be played. The returned value shall be greater than zero, or REPEAT_INFINITE.

setDelay

public void setDelay(int count)
Sets the delay between the presentation of successive pieces of content (frames).

After calling setDelay on a currently playing HFlatEffectMatte, there is no guarantee that one or more frames will not be displayed using the previous delay until the new delay value takes effect.

Specified by:
setDelay in interface HAnimateEffect
Parameters:
count - 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.

getDelay

public int getDelay()
Gets the presentation delay for this HFlatEffectMatte.

Specified by:
getDelay in interface HAnimateEffect
Returns:
the presentation delay in units of 0.1 seconds.

setPlayMode

public void setPlayMode(int mode)
Sets the playing mode for this HFlatEffectMatte. 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.

Specified by:
setPlayMode in interface HAnimateEffect
Parameters:
mode - the play mode for this HFlatEffectMatte, which must be either HAnimateEffect.PLAY_ALTERNATING or HAnimateEffect.PLAY_REPEATING.

getPlayMode

public int getPlayMode()
Gets the playing mode for this HFlatEffectMatte.

Specified by:
getPlayMode in interface HAnimateEffect
Returns:
the play mode for this HFlatEffectMatte.