0 Replies Latest reply on May 19, 2009 10:45 PM by Jason Szeto

    [svn:fx-trunk] 7109: Added matrix support for gradient classes

    Jason Szeto Level 3

      Revision: 7109

      Author:   jszeto@adobe.com

      Date:     2009-05-19 21:13:55 -0700 (Tue, 19 May 2009)

       

      Log Message:

      ***********

      Added matrix support for gradient classes

       

      SDK-20529 matrix property on LinearGradient and RadialGradient not implemented

      SDK-21161 Gradient classes matrix and transform properties should remain in sync

       

      Implemented the matrix property for the GradientBase classes (LinearGradient, LinearGradientStroke, RadialGradient, and RadialGradientStroke). Added a compoundTransform property which holds the matrix and the convenience transform properties (x, y, rotation). The gradient scaleX and scaleY properties represent pixels while the Matrix scale properties represent multipliers. Thus they are not compatible. Another difference is the most of the transform properties (x, y, scaleX, and scaleY) support NaN values while the matrix does not. A NaN value means that the gradient will choose an appropriate value.

       

      By default, the matrix property is null. The scaleX and scaleY properties can not be represented by the matrix. The compoundTransform is only created when the matrix property is set. Once the matrix is set, scaleX and scaleY can no longer be set. Also, x and y can not be set to NaN. The matrix can be set back to null which also resets all of the convenience transform properties back to their default values.

       

      If the matrix is set, then the gradient draw logic will scale the gradient to fit the bounds of the graphic element. It will then position the gradient in the upper left corner of the graphic element. Finally, it will apply the matrix transformations.

       

      QE Notes: Add matrix tests

      Doc Notes: Need to document behaviors described above

      Bugs: SDK-20529, SDK-21161

      Reviewer: Glenn

       

      Ticket Links:

      ************

          http://bugs.adobe.com/jira/browse/SDK-20529

          http://bugs.adobe.com/jira/browse/SDK-21161

          http://bugs.adobe.com/jira/browse/SDK-20529

          http://bugs.adobe.com/jira/browse/SDK-21161

       

      Modified Paths:

      **************

          flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/GradientBase.as

          flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/LinearGradient.as

          flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/LinearGradientStroke.as

          flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/RadialGradient.as

          flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/RadialGradientStroke.as