|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.flagstone.transform.fillstyle.GradientFill
public final class GradientFill
GradientFill defines how a colour changes across an area to be filled with colour. Two types of gradient fill are supported:
Gradients are defined in terms of a standard space called the gradient square, centred at (0,0) and extending from (-16384, -16384) to (16384, 16384).
A coordinate transform is required to map the gradient square to the coordinates of the filled area. The transformation is applied in two steps. First the gradient square is scaled so the colour covers the shape followed by a translation to map the gradient square coordinates to the coordinate range of the shape.
A series of gradient points is used to control how the colour displayed changes across the gradient. At least two points are required to define a gradient - one for the starting colour and one for the final colour. When the Flash Player displays the control points they are sorted by the ratio defined in each Gradient object, with the smallest ratio value displayed first.
Gradient| Constructor Summary | |
|---|---|
GradientFill(GradientFill object)
Creates and initialises a GradientFill fill style using the values copied from another GradientFill object. |
|
GradientFill(GradientType gradientType,
CoordTransform matrix,
List<Gradient> list)
Creates a GradientFill object specifying the type, coordinate transform and list of gradient points. |
|
GradientFill(GradientType gradientType,
CoordTransform matrix,
Spread spreadType,
Interpolation interpolationType,
List<Gradient> list)
Creates a GradientFill object specifying the type, coordinate transform and list of gradient points. |
|
GradientFill(int fillType,
SWFDecoder coder,
Context context)
Creates and initialises a GradientFill fill style using values encoded in the Flash binary format. |
|
| Method Summary | |
|---|---|
GradientFill |
add(Gradient aGradient)
Add a Gradient object to the list of gradient objects. |
GradientFill |
copy()
Creates a complete copy of this object. |
void |
encode(SWFEncoder coder,
Context context)
Encode an object to the Flash binary format. |
List<Gradient> |
getGradients()
Get the list of Gradient objects defining the points for the gradient fill. |
Interpolation |
getInterpolation()
Get the method used to calculate the colour changes across the gradient. |
Spread |
getSpread()
Get the Spread describing how the gradient fills the area: PAD - the last colour fills the remaining area; REPEAT - the gradient is repeated; REFLECT - the gradient is repeated but reflected (reversed) each time. |
CoordTransform |
getTransform()
Get the coordinate transform mapping the gradient square onto physical coordinates. |
GradientType |
getType()
Get the GradientType that identifies whether the gradient is linear or radial. |
int |
prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. |
void |
setGradients(List<Gradient> list)
Sets the list of control points that define the gradient. |
void |
setInterpolation(Interpolation interpolationType)
Set the method used to calculate the colour changes across the gradient. |
void |
setSpread(Spread spreadType)
Set the Spread describing how the gradient fills the area: either by using the last gradient colour to fill the area (PAD); repeating the gradient (REPEAT) or repeating but reversing it each time (REFLECT). |
void |
setTransform(CoordTransform matrix)
Sets the coordinate transform mapping the gradient square onto physical coordinates. |
void |
setType(GradientType gradientType)
Set the GradientType that identifies whether the gradient is linear or radial. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public GradientFill(int fillType,
SWFDecoder coder,
Context context)
throws IOException
fillType - the value used to identify the fill style when it is
encoded.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 GradientFill(GradientType gradientType,
CoordTransform matrix,
List<Gradient> list)
gradientType - identifies whether the gradient is rendered linearly or
radially.matrix - the coordinate transform mapping the gradient square onto
physical coordinates. Must not be null.list - a list of Gradient objects defining the control points for
the gradient. For Flash 7 and earlier versions there can be up
to 8 Gradients. For Flash 8 onwards this number was increased
to 15. Must not be null.
public GradientFill(GradientType gradientType,
CoordTransform matrix,
Spread spreadType,
Interpolation interpolationType,
List<Gradient> list)
gradientType - identifies whether the gradient is rendered linearly or
radially.matrix - the coordinate transform mapping the gradient square onto
physical coordinates. Must not be null.spreadType - To be documented.interpolationType - how the changes in colours across the gradient are calculated.list - a list of Gradient objects defining the control points for
the gradient. For Flash 7 and earlier versions there can be up
to 8 Gradients. For Flash 8 onwards this number was increased
to 15. Must not be null.public GradientFill(GradientFill object)
object - a GradientFill fill style from which the values will be
copied.| Method Detail |
|---|
public GradientType getType()
public void setType(GradientType gradientType)
gradientType - the GradientType for the fill, either LINEAR or RADIAL.public Spread getSpread()
public void setSpread(Spread spreadType)
spreadType - the Spread, either PAD, REFLECT or REPEAT.public Interpolation getInterpolation()
public void setInterpolation(Interpolation interpolationType)
interpolationType - the Interpolation that describes how colours change.public CoordTransform getTransform()
public List<Gradient> getGradients()
public void setTransform(CoordTransform matrix)
matrix - the coordinate transform. Must not be null.public void setGradients(List<Gradient> list)
list - a list of Gradient objects. Must not be null.public GradientFill add(Gradient aGradient)
aGradient - an Gradient object. Must not be null.
public GradientFill copy()
copy in interface Copyable<FillStyle>public String toString()
toString 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 | |||||||||