////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 13JUN2009  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * Calculate outline with given pen.
         * @param lineStyle
         * @return
         */
        public GraphicsPathFP CalcOutline(PenFP lineStyle)
        {
            var outline          = new GraphicsPathFP();
            var outlineGenerator =
                new GraphicsPathOutlineFP(outline, lineStyle);

            Visit(outlineGenerator);
            return(outline);
        }
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 13JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * Calculate outline with given pen.
  * @param lineStyle
  * @return
  */
 public GraphicsPathFP CalcOutline(PenFP lineStyle)
 {
     var outline = new GraphicsPathFP();
     var outlineGenerator =
             new GraphicsPathOutlineFP(outline, lineStyle);
     Visit(outlineGenerator);
     return outline;
 }
Beispiel #3
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 15JUN2009  James Shen                 	          Initial Creation
        ////////////////////////////////////////////////////////////////////////////
        /**
         * Constructs a new <code>Pen</code> with the specified
         * attributes.
         * @param color the color of the pen.
         * @param width the width of this <code>Pen</code>.  The
         *         width must be greater than or equal to 0.  If width is
         *         set to 0, the stroke is rendered as the thinnest
         *         possible line for the target device and the antialias
         *         hint setting.
         * @param cap the decoration of the ends of a <code>Pen</code>
         * @param join the decoration applied where path segments meet
         * @param dash the array representing the dashing pattern
         * @param dash_phase the offset to start the dashing pattern
         * @throws IllegalArgumentException if <code>width</code> is negative
         */
        public Pen(Color color, int width, int cap, int join,
                int[] dash, int dashPhase)
        {
            if (width < 0)
            {
                throw new ArgumentException("negative width");
            }
            if (cap != CAP_BUTT && cap != CAP_ROUND && cap != CAP_SQUARE)
            {
                throw new ArgumentException("illegal end cap Value");
            }
            if (join != JOIN_ROUND && join != JOIN_BEVEL && join != JOIN_MITER)
            {
                throw new ArgumentException("illegal line join Value");
            }
            if (dash != null)
            {
                if (dashPhase < 0)
                {
                    throw new ArgumentException("negative dash phase");
                }
                bool allzero = true;
                for (int i = 0; i < dash.Length; i++)
                {
                    int d = dash[i];
                    if (d > 0)
                    {
                        allzero = false;
                    }
                    else if (d < 0)
                    {
                        throw new ArgumentException("negative dash length");
                    }
                }
                if (allzero)
                {
                    throw new ArgumentException("dash lengths all zero");
                }
            }
            _width = width;
            _cap = cap;
            _join = join;
            _color = color;
            if (dash != null)
            {
                _dash = dash;
            }

            _dashPhase = dashPhase;
            _wrappedPenFP = new PenFP(color._value, width << SingleFP.DECIMAL_BITS,
                    cap, cap, join);
            if (dash != null)
            {
                int[] newDash = new int[dash.Length];
                for (int i = 0; i < newDash.Length; i++)
                {
                    newDash[i] = dash[i] << SingleFP.DECIMAL_BITS;
                }
                _wrappedPenFP.SetDashArray(newDash, dashPhase);
            }
        }