com.flagstone.transform.button
Class ButtonColorTransform

java.lang.Object
  extended by com.flagstone.transform.button.ButtonColorTransform
All Implemented Interfaces:
Copyable<MovieTag>, SWFEncodeable, MovieTag

public final class ButtonColorTransform
extends Object
implements MovieTag

ButtonColorTransform defines the colour transform that is applied to each shape that is used to draw a button.

This class is only used in conjunction with DefineButton. The DefineButton2 class allows colour transforms to be specified in the ButtonRecord object that identifies each shape that is displayed for a given button state.

See Also:
DefineButton, DefineButton2

Constructor Summary
ButtonColorTransform(ButtonColorTransform object)
          Creates and initialises a ButtonColorTransform object using the values copied from another ButtonColorTransform object.
ButtonColorTransform(int uid, ColorTransform cxform)
          Creates a ButtonColorTransform object with a colour transform for the specified button.
ButtonColorTransform(SWFDecoder coder, Context context)
          Creates and initialises a ButtonColorTransform object using values encoded in the Flash binary format.
 
Method Summary
 ButtonColorTransform copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 ColorTransform getColorTransform()
          Get the colour transform that will be applied to the button.
 int getIdentifier()
          Get the unique identifier of the button that this object applies to.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setColorTransform(ColorTransform cxform)
          Sets the colour transform that will be applied to the button.
 void setIdentifier(int uid)
          Sets the identifier of the button that the transform applies to.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ButtonColorTransform

public ButtonColorTransform(SWFDecoder coder,
                            Context context)
                     throws IOException
Creates and initialises a ButtonColorTransform object using values encoded in the Flash binary format.

Parameters:
coder - an SWFDecoder object that contains the encoded Flash data.
context - a Context object used to manage the decoders for different type of object and to pass information on how objects are decoded.
Throws:
IOException - if an error occurs while decoding the data.

ButtonColorTransform

public ButtonColorTransform(int uid,
                            ColorTransform cxform)
Creates a ButtonColorTransform object with a colour transform for the specified button.

Parameters:
uid - the unique identifier of a button that this object applies to. Must be in the range 1..65535.
cxform - an ColorTransform object that will be applied to the button.

ButtonColorTransform

public ButtonColorTransform(ButtonColorTransform object)
Creates and initialises a ButtonColorTransform object using the values copied from another ButtonColorTransform object.

Parameters:
object - a ButtonColorTransform object from which the values will be copied.
Method Detail

getIdentifier

public int getIdentifier()
Get the unique identifier of the button that this object applies to.

Returns:
the unique identifier of the button.

getColorTransform

public ColorTransform getColorTransform()
Get the colour transform that will be applied to the button.

Returns:
the colour transform applied to the button.

setIdentifier

public void setIdentifier(int uid)
Sets the identifier of the button that the transform applies to.

Parameters:
uid - the unique identifier of the button that the colour transform will be applied to. Must be in the range 1..65535.

setColorTransform

public void setColorTransform(ColorTransform cxform)
Sets the colour transform that will be applied to the button.

Parameters:
cxform - the colour transform object. Must not be null.

copy

public ButtonColorTransform copy()
Creates a complete copy of this object.

Specified by:
copy in interface Copyable<MovieTag>
Returns:
a deep-copy of this object. New instances of mutable objects are copied and immutable instances are shared.

toString

public String toString()
Overrides:
toString in class Object

prepareToEncode

public int prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. This method also used to initialise variables, such as offsets and flags that will be used when the object is encoded. Generally the method returns the size in bytes, however when called on objects that use bit fields such as shapes the methods will return the size in bits.

Specified by:
prepareToEncode in interface SWFEncodeable
Parameters:
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Returns:
the size of the object when it is encoded.

encode

public void encode(SWFEncoder coder,
                   Context context)
            throws IOException
Encode an object to the Flash binary format.

Specified by:
encode in interface SWFEncodeable
Parameters:
coder - an SWFEncoder object.
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Throws:
IOException - if an error occurs while encoding the object.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.