Packagegraphics.geom
Classpublic class GradientMatrix
InheritanceGradientMatrix Inheritance flash.geom.Matrix

This Matrix fix the native implementation of the Matrix.createGradientBox() is unfortunately entirely useless as soon as you try to introduce rotation and scaling to a gradient because internally the order of matrix operations is unsuited for that task.



Public Methods
 MethodDefined By
  
GradientMatrix(a:Number = 1, b:Number = 0, c:Number = 0, d:Number = 1, tx:Number = 0, ty:Number = 0)
Creates a new GradientMatrix instance with the specified parameters.
GradientMatrix
  
clone():Matrix
[override] Returns a new GradientMatrix object that is a clone of this matrix, with an exact copy of the contained object.
GradientMatrix
  
createGradientBox(width:Number, height:Number, rotation:Number = 0, tx:Number = 0, ty:Number = 0):void
[override] Creates the specific style of matrix expected by the beginGradientFill() and lineGradientStyle() methods of the Graphics class.
GradientMatrix
Constructor Detail
GradientMatrix()Constructor
public function GradientMatrix(a:Number = 1, b:Number = 0, c:Number = 0, d:Number = 1, tx:Number = 0, ty:Number = 0)

Creates a new GradientMatrix instance with the specified parameters.

Parameters
a:Number (default = 1) — The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
 
b:Number (default = 0) — The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
 
c:Number (default = 0) — The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
 
d:Number (default = 1) — The value that affects the positioning of pixels along the y axis when scaling or rotating an image.
 
tx:Number (default = 0) — The distance by which to translate each point along the x axis.
 
ty:Number (default = 0) — The distance by which to translate each point along the y axis.
Method Detail
clone()method
override public function clone():Matrix

Returns a new GradientMatrix object that is a clone of this matrix, with an exact copy of the contained object.

Returns
Matrix — a new GradientMatrix object that is a clone of this matrix, with an exact copy of the contained object.
createGradientBox()method 
override public function createGradientBox(width:Number, height:Number, rotation:Number = 0, tx:Number = 0, ty:Number = 0):void

Creates the specific style of matrix expected by the beginGradientFill() and lineGradientStyle() methods of the Graphics class. Width and height are scaled to a scaleX / scaleY pair and the tx / ty values are offset by half the width and height (This method fix the problem of order of matrix operations).

Parameters

width:Number — The width of the gradient box.
 
height:Number — The height of the gradient box.
 
rotation:Number (default = 0) — The amount to rotate, in radians.
 
tx:Number (default = 0) — The distance, in pixels, to translate to the right along the x axis. This value is offset by half of the width parameter.
 
ty:Number (default = 0) — The distance, in pixels, to translate down along the y axis. This value is offset by half of the height parameter.