Exemple #1
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 09NOV2008  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * Create the gradient brush.
         * @param ff_xmin the top left coordinate.
         * @param ff_ymin the top left coordinate.
         * @param ff_xmax the bottom right coordinate.
         * @param ff_ymax the bottom right coordinate.
         * @param ff_angle the angle for this gradient.
         * @param type  the type of the gradient brush.
         */
        public RadialGradientBrushFP(int ffX, int ffY, int ffRadius,
                                     int ffAngle)
        {
            _matrix = new MatrixFP();
            _centerPt.Reset(ffX,
                            ffY);
            _matrix.Translate(-_centerPt.X, -_centerPt.Y);
            _matrix.Rotate(-ffAngle);
            _ffRadius = ffRadius;
        }
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 09NOV2008  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * Create the gradient brush.
  * @param ff_xmin the top left coordinate.
  * @param ff_ymin the top left coordinate.
  * @param ff_xmax the bottom right coordinate.
  * @param ff_ymax the bottom right coordinate.
  * @param ff_angle the angle for this gradient.
  * @param type  the type of the gradient brush.
  */
 public RadialGradientBrushFP(int ffX, int ffY, int ffRadius,
         int ffAngle)
 {
     _matrix = new MatrixFP();
     _centerPt.Reset(ffX,
             ffY);
     _matrix.Translate(-_centerPt.X, -_centerPt.Y);
     _matrix.Rotate(-ffAngle);
     _ffRadius = ffRadius;
 }
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 13JUN2009  James Shen                 	          Initial Creation
        ////////////////////////////////////////////////////////////////////////////
        /**
         * Create the gradient brush.
         * @param ff_xmin the top left coordinate.
         * @param ff_ymin the top left coordinate.
         * @param ff_xmax the bottom right coordinate.
         * @param ff_ymax the bottom right coordinate.
         * @param ff_angle the angle for this gradient.
         * @param type  the type of the gradient brush.
         */
        public LinearGradientBrushFP(int ffXmin, int ffYmin, int ffXmax, int ffYmax,
                int ffAngle)
        {
            _bounds.Reset(ffXmin, ffYmin,
                    ffXmax == ffXmin ? ffXmin + 1 : ffXmax,
                    ffYmax == ffYmin ? ffYmin + 1 : ffYmax);
            _matrix = new MatrixFP();
            _centerPt.Reset(ffXmin + (ffXmax - ffXmin) / 2,
                    ffYmin + (ffYmax - ffYmin) / 2);
            _matrix.Translate(-_centerPt.X, -_centerPt.Y);
            _matrix.Rotate(-ffAngle);
            //matrix.translate((ff_xmin + ff_xmax) / 2,(ff_ymin + ff_ymax) / 2);

            var ffAng = MathFP.Atan(MathFP.Div(_bounds.GetHeight(),
                    _bounds.GetWidth() == 0 ? 1 : _bounds.GetWidth()));
            var ffLen = PointFP.Distance(_bounds.GetHeight(), _bounds.GetWidth());
            _ffLength = MathFP.Mul(ffLen, MathFP.Max(
                    MathFP.Abs(MathFP.Cos(ffAngle - ffAng)),
                    MathFP.Abs(MathFP.Cos(ffAngle + ffAng))));
        }
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 13JUN2009  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * Create the gradient brush.
         * @param ff_xmin the top left coordinate.
         * @param ff_ymin the top left coordinate.
         * @param ff_xmax the bottom right coordinate.
         * @param ff_ymax the bottom right coordinate.
         * @param ff_angle the angle for this gradient.
         * @param type  the type of the gradient brush.
         */
        public LinearGradientBrushFP(int ffXmin, int ffYmin, int ffXmax, int ffYmax,
                                     int ffAngle)
        {
            _bounds.Reset(ffXmin, ffYmin,
                          ffXmax == ffXmin ? ffXmin + 1 : ffXmax,
                          ffYmax == ffYmin ? ffYmin + 1 : ffYmax);
            _matrix = new MatrixFP();
            _centerPt.Reset(ffXmin + (ffXmax - ffXmin) / 2,
                            ffYmin + (ffYmax - ffYmin) / 2);
            _matrix.Translate(-_centerPt.X, -_centerPt.Y);
            _matrix.Rotate(-ffAngle);
            //matrix.translate((ff_xmin + ff_xmax) / 2,(ff_ymin + ff_ymax) / 2);

            var ffAng = MathFP.Atan(MathFP.Div(_bounds.GetHeight(),
                                               _bounds.GetWidth() == 0 ? 1 : _bounds.GetWidth()));
            var ffLen = PointFP.Distance(_bounds.GetHeight(), _bounds.GetWidth());

            _ffLength = MathFP.Mul(ffLen, MathFP.Max(
                                       MathFP.Abs(MathFP.Cos(ffAngle - ffAng)),
                                       MathFP.Abs(MathFP.Cos(ffAngle + ffAng))));
        }