Ejemplo n.º 1
0
        public override void DrawEllipticArc(double cx, double cy, double aradius, double bradius, double tilt, double startangle, double sweepangle)
        {
            if (thinlinemode != ThinLineModeFlag.OwnThinLines)
            {
                base.DrawEllipticArc(cx, cy, aradius, bradius, tilt, startangle, sweepangle);
                return;
            }

            /* stipplebit = 0x8000;
             *
             * int px=0,py=0,nx,ny;
             * bool first = true;
             *
             * GeomUtil.FlattenEllipticArc(cx, cy, aradius, bradius, tilt, startangle, sweepangle, flattentol, true, (x, y,moveto) =>
             * {
             *   nx = GFXUtil.RealToInt(x);
             *   ny = GFXUtil.RealToInt(y);
             *   if (!first)
             *       Line_Internal(px, py, nx, ny, true); //TODO: can we skip last pixel except on last segment?
             *   else
             *       first = false;
             *
             *
             *   px = nx;
             *   py = ny;
             * });*/


            int px = 0, py = 0, nx, ny;

            int num = Clipper.ClipEllipticArc(cx, cy, aradius, bradius, tilt, startangle, sweepangle, clipbuffer, clipMinX, clipMinY, clipMaxX, clipMaxY);

            for (int l = 0; l < num; l += 2)
            {
                stipplebit = 0x8000;

                GeomUtil.FlattenEllipticArc(cx, cy, aradius, bradius, tilt, clipbuffer[l], clipbuffer[l + 1] - clipbuffer[l], flattentol, true, (x, y, moveto) =>
                {
                    nx = GFXUtil.FloatToInt(x);
                    ny = GFXUtil.FloatToInt(y);
                    if (!moveto)
                    {
                        Line_Internal(px, py, nx, ny, true); //TODO: can we skip last pixel except on last segment?
                    }
                    px = nx;
                    py = ny;
                });
            }
        }