|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.flagstone.transform.fillstyle.Gradient
public final class Gradient
Gradient defines a control point that is used to specify how a gradient colour is displayed.
Two or more control points are used to define how the colour changes across the gradient square. Each control point specifies the ratio indicating the location of the control point across the gradient square and the colour to be displayed at that point.
The ratio is a number between 0 and 255 - that specifies the relative location in the square. For Linear Gradient Fills a ratio of zero is mapped to the left side of the gradient square and 255 is mapped to the right side of the square. For Radial Gradient Fills a ratio of zero is mapped to the centre of the gradient square and 255 is mapped to the edge of the largest circle that fits inside the gradient square. A ratio is used rather than specifying coordinates within the gradient square as the coordinate space is transformed to fit the shape that the gradient is being displayed in.
Note that the object used to create the shape definition determines whether the alpha channel is encoded in the gradient colours. Simply specifying the level of transparency in the Color object is not sufficient.
GradientFill| Field Summary | |
|---|---|
static int |
MAX_GRADIENTS
Maximum number of gradient records. |
| Constructor Summary | |
|---|---|
Gradient(int aRatio,
Color aColor)
Creates a Gradient object with the specified ratio and color. |
|
Gradient(SWFDecoder coder,
Context context)
Creates and initialises a Gradient 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)
|
Color |
getColor()
Get the colour that is displayed at the control point across the gradient square defined by the ratio. |
int |
getRatio()
Get the ratio that defines the relative point across the gradient square. |
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 |
| Field Detail |
|---|
public static final int MAX_GRADIENTS
| Constructor Detail |
|---|
public Gradient(SWFDecoder coder,
Context context)
throws IOException
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.
IOException - if an error occurs while decoding the data.
public Gradient(int aRatio,
Color aColor)
aRatio - the ratio along the gradient square. Must be in the range
0..255.aColor - the color at the control point. Must not be null.| Method Detail |
|---|
public int getRatio()
public Color getColor()
public String toString()
toString in class Objectpublic boolean equals(Object object)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic int prepareToEncode(Context context)
prepareToEncode in interface SWFEncodeablecontext - an Context that allows information to be passed between
objects to control how they are initialised for encoding.
public void encode(SWFEncoder coder,
Context context)
throws IOException
encode in interface SWFEncodeablecoder - an SWFEncoder object.context - an Context that allows information to be passed between
objects to control how they are initialised for encoding.
IOException - if an error occurs while encoding the object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||