Пример #1
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 13JUN2009  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         *
         * @param path
         * @param matrix
         * @param fillStyle
         * @param mode
         */
        public void DrawPath(GraphicsPathFP path, MatrixFP matrix,
                             BrushFP fs, int mode)
        {
            _transformMatrix = matrix;
            DrawPath(path, fs, mode);
            _transformMatrix = null;
        }
Пример #2
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;
 }
Пример #4
0
 internal static AffineTransform ToMatrix(MatrixFP matrixFP)
 {
     if (matrixFP == null)
     {
         return null;
     }
     if (matrixFP.IsIdentity())
     {
         return new AffineTransform();
     }
     AffineTransform matrix = new AffineTransform(SingleFP.ToDouble(matrixFP.ScaleX),
             SingleFP.ToDouble(matrixFP.RotateX),
             SingleFP.ToDouble(matrixFP.RotateY),
             SingleFP.ToDouble(matrixFP.ScaleY),
             SingleFP.ToDouble(matrixFP.TranslateX),
             SingleFP.ToDouble(matrixFP.TranslateY));
     return matrix;
 }
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- 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))));
        }
Пример #7
0
        internal static MatrixFP ToMatrixFP(AffineTransform matrix)
        {
            if (matrix == null)
            {
                return null;
            }
            if (matrix.IsIdentity())
            {
                return MatrixFP.Identity;
            }

            MatrixFP matrixFP = new MatrixFP(SingleFP.FromDouble(matrix.GetScaleX()),
                    SingleFP.FromDouble(matrix.GetScaleY()),
                    SingleFP.FromDouble(matrix.GetShearX()),
                    SingleFP.FromDouble(matrix.GetShearY()),
                    SingleFP.FromDouble(matrix.GetTranslateX()),
                    SingleFP.FromDouble(matrix.GetTranslateY()));
            return matrixFP;
        }
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 13JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  *
  * @param path
  * @param matrix
  * @param fillStyle
  * @param mode
  */
 public void DrawPath(GraphicsPathFP path, MatrixFP matrix,
         BrushFP fs, int mode)
 {
     _transformMatrix = matrix;
     DrawPath(path, fs, mode);
     _transformMatrix = null;
 }