AddCloseFigure() public method

public AddCloseFigure ( ) : void
return void
Beispiel #1
0
 static Affine BuildImageBoundsPath(int srcW, int srcH,
                                    VertexStore drawImageRectPath, AffinePlan[] affPlans)
 {
     drawImageRectPath.Clear();
     drawImageRectPath.AddMoveTo(0, 0);
     drawImageRectPath.AddLineTo(srcW, 0);
     drawImageRectPath.AddLineTo(srcW, srcH);
     drawImageRectPath.AddLineTo(0, srcH);
     drawImageRectPath.AddCloseFigure();
     return(Affine.NewMatix(affPlans));
 }
 static Affine BuildImageBoundsPath(int srcW, int srcH,
                                    AffinePlan[] affPlans,
                                    VertexStore outputDestImgRect)
 {
     outputDestImgRect.Clear();
     outputDestImgRect.AddMoveTo(0, 0);
     outputDestImgRect.AddLineTo(srcW, 0);
     outputDestImgRect.AddLineTo(srcW, srcH);
     outputDestImgRect.AddLineTo(0, srcH);
     outputDestImgRect.AddCloseFigure();
     return(Affine.NewMatix(affPlans));
 }
Beispiel #3
0
        Affine BuildImageBoundsPath(IImageReaderWriter sourceImage,
                                    VertexStore drawImageRectPath, AffinePlan[] affPlans)
        {
            int srcW = sourceImage.Width;
            int srcH = sourceImage.Height;

            drawImageRectPath.Clear();
            drawImageRectPath.AddMoveTo(0, 0);
            drawImageRectPath.AddLineTo(srcW, 0);
            drawImageRectPath.AddLineTo(srcW, srcH);
            drawImageRectPath.AddLineTo(0, srcH);
            drawImageRectPath.AddCloseFigure();

            return(Affine.NewMatix(affPlans));
        }
Beispiel #4
0
        Affine BuildImageBoundsPath(IImageReaderWriter sourceImage,
                                    VertexStore drawImageRectPath,
                                    double destX, double destY,
                                    double hotspotOffsetX, double hotSpotOffsetY,
                                    double scaleX, double scaleY,
                                    double angleRad)
        {
            AffinePlan[] plan = new AffinePlan[4];
            int          i    = 0;

            if (hotspotOffsetX != 0.0f || hotSpotOffsetY != 0.0f)
            {
                plan[i] = AffinePlan.Translate(-hotspotOffsetX, -hotSpotOffsetY);
                i++;
            }

            if (scaleX != 1 || scaleY != 1)
            {
                plan[i] = AffinePlan.Scale(scaleX, scaleY);
                i++;
            }

            if (angleRad != 0)
            {
                plan[i] = AffinePlan.Rotate(angleRad);
                i++;
            }

            if (destX != 0 || destY != 0)
            {
                plan[i] = AffinePlan.Translate(destX, destY);
                i++;
            }


            int srcW = sourceImage.Width;
            int srcH = sourceImage.Height;

            drawImageRectPath.Clear();
            drawImageRectPath.AddMoveTo(0, 0);
            drawImageRectPath.AddLineTo(srcW, 0);
            drawImageRectPath.AddLineTo(srcW, srcH);
            drawImageRectPath.AddLineTo(0, srcH);
            drawImageRectPath.AddCloseFigure();


            return(Affine.NewMatix(plan));
        }
        static Affine BuildImageBoundsPath(
            int srcW, int srcH,
            double destX, double destY, VertexStore outputDestImgRect)
        {
            AffinePlan plan = new AffinePlan();

            if (destX != 0 || destY != 0)
            {
                plan = AffinePlan.Translate(destX, destY);
            }

            outputDestImgRect.Clear();
            outputDestImgRect.AddMoveTo(0, 0);
            outputDestImgRect.AddLineTo(srcW, 0);
            outputDestImgRect.AddLineTo(srcW, srcH);
            outputDestImgRect.AddLineTo(0, srcH);
            outputDestImgRect.AddCloseFigure();
            return(Affine.NewMatix(plan));
        }
        static Affine BuildImageBoundsPath(
            int srcW, int srcH,
            double destX, double destY,
            double hotspotOffsetX, double hotSpotOffsetY,
            double scaleX, double scaleY,
            double angleRad,
            VertexStore outputDestImgRect)
        {
            AffinePlan[] plans = new AffinePlan[4];
            int          i     = 0;

            if (hotspotOffsetX != 0.0f || hotSpotOffsetY != 0.0f)
            {
                plans[i] = AffinePlan.Translate(-hotspotOffsetX, -hotSpotOffsetY);
                i++;
            }

            if (scaleX != 1 || scaleY != 1)
            {
                plans[i] = AffinePlan.Scale(scaleX, scaleY);
                i++;
            }

            if (angleRad != 0)
            {
                plans[i] = AffinePlan.Rotate(angleRad);
                i++;
            }

            if (destX != 0 || destY != 0)
            {
                plans[i] = AffinePlan.Translate(destX, destY);
                i++;
            }

            outputDestImgRect.Clear();
            outputDestImgRect.AddMoveTo(0, 0);
            outputDestImgRect.AddLineTo(srcW, 0);
            outputDestImgRect.AddLineTo(srcW, srcH);
            outputDestImgRect.AddLineTo(0, srcH);
            outputDestImgRect.AddCloseFigure();
            return(Affine.NewMatix(plans));
        }
        Affine BuildImageBoundsPath(
            int srcW, int srcH,
            VertexStore drawImageRectPath,
            double destX, double destY,
            double hotspotOffsetX, double hotSpotOffsetY,
            double scaleX, double scaleY,
            double angleRad)
        {
            AffinePlan[] plan = new AffinePlan[4];
            int i = 0;
            if (hotspotOffsetX != 0.0f || hotSpotOffsetY != 0.0f)
            {
                plan[i] = AffinePlan.Translate(-hotspotOffsetX, -hotSpotOffsetY);
                i++;
            }

            if (scaleX != 1 || scaleY != 1)
            {
                plan[i] = AffinePlan.Scale(scaleX, scaleY);
                i++;
            }

            if (angleRad != 0)
            {
                plan[i] = AffinePlan.Rotate(angleRad);
                i++;
            }

            if (destX != 0 || destY != 0)
            {
                plan[i] = AffinePlan.Translate(destX, destY);
                i++;
            }

            drawImageRectPath.Clear();
            drawImageRectPath.AddMoveTo(0, 0);
            drawImageRectPath.AddLineTo(srcW, 0);
            drawImageRectPath.AddLineTo(srcW, srcH);
            drawImageRectPath.AddLineTo(0, srcH);
            drawImageRectPath.AddCloseFigure();
            return Affine.NewMatix(plan);
        }
Beispiel #8
0
        Affine BuildImageBoundsPath(
            int srcW, int srcH,
            VertexStore drawImageRectPath,
            double destX, double destY)
        {
            AffinePlan plan = new AffinePlan();

            if (destX != 0 || destY != 0)
            {
                plan = AffinePlan.Translate(destX, destY);
            }

            drawImageRectPath.Clear();
            drawImageRectPath.AddMoveTo(0, 0);
            drawImageRectPath.AddLineTo(srcW, 0);
            drawImageRectPath.AddLineTo(srcW, srcH);
            drawImageRectPath.AddLineTo(0, srcH);
            drawImageRectPath.AddCloseFigure();
            return(Affine.NewMatix(plan));
        }
Beispiel #9
0
        Affine BuildImageBoundsPath(IImageReaderWriter sourceImage,
                                    VertexStore drawImageRectPath,
                                    double destX, double destY)
        {
            AffinePlan plan = new AffinePlan();

            if (destX != 0 || destY != 0)
            {
                plan = AffinePlan.Translate(destX, destY);
            }
            int srcW = sourceImage.Width;
            int srcH = sourceImage.Height;

            drawImageRectPath.Clear();
            drawImageRectPath.AddMoveTo(0, 0);
            drawImageRectPath.AddLineTo(srcW, 0);
            drawImageRectPath.AddLineTo(srcW, srcH);
            drawImageRectPath.AddLineTo(0, srcH);
            drawImageRectPath.AddCloseFigure();

            return(Affine.NewMatix(plan));
        }
        void WriteOutput(VertexStore outputVxs, bool close)
        {
            //write output to

            if (close)
            {
                int positive_edgeCount = positiveSideVectors.Count;
                int negative_edgeCount = negativeSideVectors.Count;

                int    n = positive_edgeCount - 1;
                Vector v = positiveSideVectors[n];
                outputVxs.AddMoveTo(v.X, v.Y);
                for (; n >= 0; --n)
                {
                    v = positiveSideVectors[n];
                    outputVxs.AddLineTo(v.X, v.Y);
                }
                outputVxs.AddCloseFigure();
                //end ... create join to negative side
                //------------------------------------------
                //create line join from positive  to negative side
                v = negativeSideVectors[0];
                outputVxs.AddMoveTo(v.X, v.Y);
                n = 1;
                for (; n < negative_edgeCount; ++n)
                {
                    v = negativeSideVectors[n];
                    outputVxs.AddLineTo(v.X, v.Y);
                }
                //------------------------------------------
                //close
                outputVxs.AddCloseFigure();
            }
            else
            {
                int positive_edgeCount = positiveSideVectors.Count;
                int negative_edgeCount = negativeSideVectors.Count;

                //no a close shape stroke
                //create line cap for this
                //
                //positive
                Vector v = positiveSideVectors[0];
                //-----------
                //1. moveto

                //2.
                CreateStartLineCap(outputVxs,
                                   v,
                                   negativeSideVectors[0], this.HalfStrokeWidth);
                //-----------

                int n = 1;
                for (; n < positive_edgeCount; ++n)
                {
                    //increment n
                    v = positiveSideVectors[n];
                    outputVxs.AddLineTo(v.X, v.Y);
                }
                //negative

                //----------------------------------
                CreateEndLineCap(outputVxs,
                                 positiveSideVectors[positive_edgeCount - 1],
                                 negativeSideVectors[negative_edgeCount - 1],
                                 this.HalfStrokeWidth);
                //----------------------------------
                for (n = negative_edgeCount - 2; n >= 0; --n)
                {
                    //decrement n
                    v = negativeSideVectors[n];
                    outputVxs.AddLineTo(v.X, v.Y);
                }

                outputVxs.AddCloseFigure();
            }
            //reset
            positiveSideVectors.Clear();
            negativeSideVectors.Clear();
        }
Beispiel #11
0
        public static void ConvertToVxs(System.Drawing.Drawing2D.PathData pathdata, VertexStore outputVxs)
        {
            byte[]   pointTypes = pathdata.Types;
            PointF[] points     = pathdata.Points;
            int      pointCount = points.Length;

            //from MSDN document
            //0 = start of figure (MoveTo)
            //1 = one of the two endpoints of a line (LineTo)
            //3 = an endpoint or control point of a cubic Bezier spline (4 points spline)
            //masks..
            //0x7 = 111b (binary) => for masking lower 3 bits
            //0x20 = (1<<6) specific that point is a marker
            //0x80 = (1<<7) specific that point is the last point of a closed subpath( figure)

            //----------------------------------
            //convert to Agg's VertexStorage
            int curvePointCount = 0;

            for (int i = 0; i < pointCount; ++i)
            {
                byte   pointType = pointTypes[i];
                PointF p         = points[i];

                switch (0x7 & pointType)
                {
                case 0:
                    //move to
                    outputVxs.AddMoveTo(p.X, p.Y);
                    curvePointCount = 0;
                    break;

                case 1:
                    //line to
                    outputVxs.AddLineTo(p.X, p.Y);
                    curvePointCount = 0;
                    break;

                case 3:
                    //end point of control point of cubic Bezier spline
                {
                    switch (curvePointCount)
                    {
                    case 0:
                    {
                        outputVxs.AddP2c(p.X, p.Y);
                        curvePointCount++;
                    } break;

                    case 1:
                    {
                        outputVxs.AddP3c(p.X, p.Y);
                        curvePointCount++;
                    } break;

                    case 2:
                    {
                        outputVxs.AddLineTo(p.X, p.Y);
                        curvePointCount = 0;                //reset
                    } break;

                    default:
                    {
                        throw new NotSupportedException();
                    }
                    }
                } break;

                default:
                {
                } break;
                }

                if ((pointType >> 7) == 1)
                {
                    //close figure to
                    outputVxs.AddCloseFigure();
                }
                if ((pointType >> 6) == 1)
                {
                }
            }
        }
 static Affine BuildImageBoundsPath(int srcW, int srcH,
    VertexStore drawImageRectPath, AffinePlan[] affPlans)
 {
     drawImageRectPath.Clear();
     drawImageRectPath.AddMoveTo(0, 0);
     drawImageRectPath.AddLineTo(srcW, 0);
     drawImageRectPath.AddLineTo(srcW, srcH);
     drawImageRectPath.AddLineTo(0, srcH);
     drawImageRectPath.AddCloseFigure();
     return Affine.NewMatix(affPlans);
 }
        Affine BuildImageBoundsPath(
           int srcW, int srcH,
           VertexStore drawImageRectPath,
           double destX, double destY)
        {
            AffinePlan plan = new AffinePlan();
            if (destX != 0 || destY != 0)
            {
                plan = AffinePlan.Translate(destX, destY);
            }

            drawImageRectPath.Clear();
            drawImageRectPath.AddMoveTo(0, 0);
            drawImageRectPath.AddLineTo(srcW, 0);
            drawImageRectPath.AddLineTo(srcW, srcH);
            drawImageRectPath.AddLineTo(0, srcH);
            drawImageRectPath.AddCloseFigure();
            return Affine.NewMatix(plan);
        }