com.flagstone.transform.font
Class AlignmentZone

java.lang.Object
  extended by com.flagstone.transform.font.AlignmentZone
All Implemented Interfaces:
SWFEncodeable

public final class AlignmentZone
extends Object
implements SWFEncodeable

AlignmentZone defines a bounding box that is used by the advanced text rendering engine in the Flash Player to snap glyphs to the nearest pixel.


Constructor Summary
AlignmentZone(float coord, float size)
          Creates a new AlignmentZone with the specified coordinate and size.
AlignmentZone(SWFDecoder coder)
          Creates and initialises an AlignmentZone object using values encoded in the Flash binary format.
 
Method Summary
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 boolean equals(Object object)
           
 float getCoordinate()
          Get the coordinate of the left or bottom edge of the alignment box.
 float getRange()
          Get the width or height of the alignment box.
 int hashCode()
           
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AlignmentZone

public AlignmentZone(SWFDecoder coder)
              throws IOException
Creates and initialises an AlignmentZone object using values encoded in the Flash binary format.

Parameters:
coder - an SWFDecoder object that contains the encoded Flash data.
Throws:
IOException - if an error occurs while decoding the data.

AlignmentZone

public AlignmentZone(float coord,
                     float size)
Creates a new AlignmentZone with the specified coordinate and size.

Parameters:
coord - the x or y coordinate of the left edge or bottom of the box.
size - the width or height of the box.
Method Detail

getCoordinate

public float getCoordinate()
Get the coordinate of the left or bottom edge of the alignment box.

Returns:
the x or y coordinate of the box.

getRange

public float getRange()
Get the width or height of the alignment box.

Returns:
the size of the box.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object object)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode 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.