public GraphicsPath(PointF[] pts, byte[] types, System.Drawing.Drawing2D.FillMode fillMode)
        {
            if (pts == null)
            {
                throw new ArgumentNullException("pts");
            }
            IntPtr zero = IntPtr.Zero;

            if (pts.Length != types.Length)
            {
                throw SafeNativeMethods.Gdip.StatusException(2);
            }
            int    length      = types.Length;
            IntPtr handle      = SafeNativeMethods.Gdip.ConvertPointToMemory(pts);
            IntPtr destination = Marshal.AllocHGlobal(length);

            try
            {
                Marshal.Copy(types, 0, destination, length);
                int status = SafeNativeMethods.Gdip.GdipCreatePath2(new HandleRef(null, handle), new HandleRef(null, destination), length, (int)fillMode, out zero);
                if (status != 0)
                {
                    throw SafeNativeMethods.Gdip.StatusException(status);
                }
            }
            finally
            {
                Marshal.FreeHGlobal(handle);
                Marshal.FreeHGlobal(destination);
            }
            this.nativePath = zero;
        }
Exemple #2
0
        //draw figure by points
        private void Draw(List <int> a, List <int> b, List <int> c, List <int> d,
                          List <int> e, List <int> f, List <int> g, List <int> h0,
                          List <int> h1, List <int> h2, List <int> h3)
        {
            drawArea.FillRectangle(Brushes.White, 0, 0, pictureBox1.Width, pictureBox1.Height);

            drawArea.DrawLine(p, 0, (int)(pictureBox1.Height / 2),
                              (int)(pictureBox1.Width), (int)(pictureBox1.Height / 2));
            drawArea.DrawLine(p, (int)(pictureBox1.Width / 2), 0,
                              (int)(pictureBox1.Width / 2), (int)(pictureBox1.Height));
            p = new Pen(Color.Red, 1);
            drawArea.DrawLine(p, 90, (int)(pictureBox1.Height), (int)(pictureBox1.Width) - 90, 0);

            p = new Pen(Color.Black, 1);
            drawArea.DrawLine(p, a[0] + additiveX, additiveY - a[1], b[0] + additiveX, additiveY - b[1]);
            drawArea.DrawLine(p, b[0] + additiveX, additiveY - b[1], c[0] + additiveX, additiveY - c[1]);
            drawArea.DrawLine(p, c[0] + additiveX, additiveY - c[1], d[0] + additiveX, additiveY - d[1]);
            drawArea.DrawLine(p, d[0] + additiveX, additiveY - d[1], e[0] + additiveX, additiveY - e[1]);
            drawArea.DrawLine(p, e[0] + additiveX, additiveY - e[1], f[0] + additiveX, additiveY - f[1]);
            drawArea.DrawLine(p, f[0] + additiveX, additiveY - f[1], g[0] + additiveX, additiveY - g[1]);
            drawArea.DrawLine(p, g[0] + additiveX, additiveY - g[1], a[0] + additiveX, additiveY - a[1]);

            Point H0 = new Point(h0[0] + additiveX, additiveY - h0[1]);
            Point H1 = new Point(h1[0] + additiveX, additiveY - h1[1]);
            Point H2 = new Point(h2[0] + additiveX, additiveY - h2[1]);
            Point H3 = new Point(h3[0] + additiveX, additiveY - h3[1]);

            Point[] curvePoints = { H0, H1, H2, H3 };
            float   tension     = 1.0F;

            System.Drawing.Drawing2D.FillMode aFillMode = System.Drawing.Drawing2D.FillMode.Alternate;

            drawArea.DrawClosedCurve(p, curvePoints.ToArray(), tension, aFillMode);
        }
        public XnaGraphicsPath(PointFx[] pts, PathPointType[] types, System.Drawing.Drawing2D.FillMode fillMode)
        {
            // TODO: Complete member initialization
            this.pts.AddRange(pts);
            this.types.AddRange(types);
            //this.fillMode = fillMode;
            transform = Matrix.Identity;

            //BasicPrimitiveRendering.PrimitiveRasterizer polyRasterizer = new BasicPrimitiveRendering.PrimitiveRasterizer(this.GraphicsDevice, this.SpriteBatch);
        }
        public GraphicsPath(System.Drawing.Drawing2D.FillMode fillMode)
        {
            IntPtr zero   = IntPtr.Zero;
            int    status = SafeNativeMethods.Gdip.GdipCreatePath((int)fillMode, out zero);

            if (status != 0)
            {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }
            this.nativePath = zero;
        }
Exemple #5
0
 //Mode (CurverLine Close Mode)
 private void button6_Click(object sender, EventArgs e)
 {
     if (mode == System.Drawing.Drawing2D.FillMode.Alternate)
     {
         mode        = System.Drawing.Drawing2D.FillMode.Winding;
         label2.Text = "Крила";
     }
     else
     {
         mode        = System.Drawing.Drawing2D.FillMode.Alternate;
         label2.Text = "Альт";
     }
 }
Exemple #6
0
        protected FreehandVObject(string objectName, System.Drawing.PointF[] points, bool closePath, System.Drawing.Drawing2D.FillMode fillMode)
            : base(objectName)
        {
            if (points == null)
            {
                throw new System.ArgumentNullException("points");
            }
            if (points.Length == 0)
            {
                throw new System.ArgumentException(StringResources.GetString("ExStrArrayZeroLengthError"), "points");
            }

            _points    = points;
            _closePath = closePath;
            _fillMode  = fillMode;

            UpdatePath();
        }
Exemple #7
0
 public void FillClosedCurve(Brush brush, PointF[] points, System.Drawing.Drawing2D.FillMode fillmode, float tension)
 {
     throw new NotImplementedException();
 }
Exemple #8
0
 public void DrawClosedCurve(Pen pen, PointF[] points, float tension, System.Drawing.Drawing2D.FillMode fillmode)
 {
     g.DrawClosedCurve(pen, points, tension, fillmode);
 }
Exemple #9
0
 public void FillPolygon(Brush brush, PointF[] points, System.Drawing.Drawing2D.FillMode fillMode)
 {
     throw new NotImplementedException();
 }
Exemple #10
0
 /// <summary>
 /// Constructs a new PPath with the given points, point types, fill mode and pen.
 /// </summary>
 /// <param name="pts">The points in the path.</param>
 /// <param name="types">The types of the points in the path.</param>
 /// <param name="fillMode">The fill mode to use when rendering this node.</param>
 /// <param name="pen">The pen to use when rendering this node.</param>
 public PPath(PointFx[] pts, PathPointType[] types, System.Drawing.Drawing2D.FillMode fillMode, System.Drawing.Pen pen)
 {
     path     = new XnaGraphicsPath(pts, types, fillMode);
     this.pen = pen;
     UpdateBoundsFromPath();
 }
Exemple #11
0
 /// <summary>
 /// Constructs a new PPath with the given points, point types and fill mode.
 /// </summary>
 /// <param name="pts">The points in the path.</param>
 /// <param name="types">The types of the points in the path.</param>
 /// <param name="fillMode">The fill mode to use when rendering this node.</param>
 public PPath(PointFx[] pts, PathPointType[] types, System.Drawing.Drawing2D.FillMode fillMode)
     : this(pts, types, fillMode, DEFAULT_PEN)
 {
 }
Exemple #12
0
        bool ModifyItem(ServiceProtocol serviceProtocol, Int64 requestID, Guid guid, String tag, String path, Model model, Shape stencil, RectangleF boundingRect, Single angle, System.Drawing.Color fillColor, System.Drawing.Drawing2D.FillMode fillMode, bool mirrorX, bool mirrorY)
        {
            if (true) // Decide whether to modify an item.
            {         // We're going to do it.
              // Modify the item.

                // Need to get hold of a valid pDoc pointer... *********

                //Individual changes would go something like this: *********
                //int length = tag.Length;
                //wchar_t * tagwc = (wchar_t*)(void*)Marshal.StringToHGlobalUni(tag);

                //char * tagc = (char *)malloc(length+1);
                //tagc[length] = 0;
                //for (int i=0; i<length; i++)
                //  tagc[i] = (char)tagwc[i];

                //pDoc.GCB.DoModify(tagc,
                //                    angle,
                //                    boundingRect,
                //                    fillColor,
                //                    fillMode,
                //                    mirrorX,
                //                    mirrorY);

                // Raise event(s).
                serviceProtocol.DoItemModified(requestID, guid, tag, path, model, stencil, boundingRect, angle, fillColor, fillMode, mirrorX, mirrorY);

                return(true);
            }
            else
            { // We're not going to do it.
                return(false);
            }
        }
Exemple #13
0
 private void button8_Click(object sender, EventArgs e)
 {
     if (listBox1.SelectedIndex == 0)
     {
         reverseMode       = false; label3.Text = "Вимк";
         mode              = System.Drawing.Drawing2D.FillMode.Alternate; label2.Text = "Альт";
         showparts         = false; label4.Text = "Не видно";
         checkBox1.Checked = true;
         checkBox2.Checked = true;
         checkBox3.Checked = true;
         size              = 20; textBox1.Text = size.ToString();
         k              = 1; textBox2.Text = k.ToString();
         brushfit       = 1; newbrushfit(); textBox5.Text = brushfit.ToString();
         heightclasters = 5; textBox3.Text = heightclasters.ToString();
         widthclasters  = 5; textBox4.Text = widthclasters.ToString();
         clearColor     = Color.White; drawColor = Color.FromArgb(clearColor.A, 255 - clearColor.R, 255 - clearColor.G, 255 - clearColor.B); currentPen.Color = drawColor; fillBrush = new SolidBrush(drawColor); label9.Text = "White"; clear();
     }
     if (listBox1.SelectedIndex == 1)
     {
         reverseMode       = false; label3.Text = "Вимк";
         mode              = System.Drawing.Drawing2D.FillMode.Alternate; label2.Text = "Альт";
         showparts         = false; label4.Text = "Не видно";
         checkBox1.Checked = false;
         checkBox2.Checked = false;
         checkBox3.Checked = true;
         tension           = 3; textBox6.Text = tension.ToString();
         size              = 35; textBox1.Text = size.ToString();
         k              = 1; textBox2.Text = k.ToString();
         brushfit       = 1; newbrushfit(); textBox5.Text = brushfit.ToString();
         heightclasters = 5; textBox3.Text = heightclasters.ToString();
         widthclasters  = 5; textBox4.Text = widthclasters.ToString();
         clearColor     = Color.Blue; drawColor = Color.DarkSlateBlue; currentPen.Color = drawColor; fillBrush = new SolidBrush(drawColor); label9.Text = "Blue"; clear();
     }
     if (listBox1.SelectedIndex == 2)
     {
         reverseMode       = false; label3.Text = "Вимк";
         mode              = System.Drawing.Drawing2D.FillMode.Alternate; label2.Text = "Альт";
         showparts         = false; label4.Text = "Не видно";
         checkBox1.Checked = true;
         checkBox2.Checked = false;
         checkBox3.Checked = true;
         size              = 50; textBox1.Text = size.ToString();
         k              = 1; textBox2.Text = k.ToString();
         brushfit       = 1; newbrushfit(); textBox5.Text = brushfit.ToString();
         heightclasters = 2; textBox3.Text = heightclasters.ToString();
         widthclasters  = 2; textBox4.Text = widthclasters.ToString();
         clearColor     = Color.White; drawColor = Color.FromArgb(clearColor.A, 255 - clearColor.R, 255 - clearColor.G, 255 - clearColor.B); currentPen.Color = drawColor; fillBrush = new SolidBrush(drawColor); label9.Text = "White"; clear();
     }
     if (listBox1.SelectedIndex == 3)
     {
         reverseMode       = false; label3.Text = "Вимк";
         mode              = System.Drawing.Drawing2D.FillMode.Alternate; label2.Text = "Альт";
         showparts         = false; label4.Text = "Не видно";
         checkBox1.Checked = true;
         checkBox2.Checked = true;
         checkBox3.Checked = true;
         size              = 40; textBox1.Text = size.ToString();
         k              = 3; textBox2.Text = k.ToString();
         brushfit       = 1; newbrushfit(); textBox5.Text = brushfit.ToString();
         heightclasters = 40; textBox3.Text = heightclasters.ToString();
         widthclasters  = 40; textBox4.Text = widthclasters.ToString();
         clearColor     = Color.White; drawColor = Color.FromArgb(clearColor.A, 255 - clearColor.R, 255 - clearColor.G, 255 - clearColor.B); currentPen.Color = drawColor; fillBrush = new SolidBrush(drawColor); label9.Text = "White"; clear();
     }
     if (listBox1.SelectedIndex == 4)
     {
         reverseMode       = false; label3.Text = "Вимк";
         mode              = System.Drawing.Drawing2D.FillMode.Alternate; label2.Text = "Альт";
         showparts         = false; label4.Text = "Не видно";
         checkBox1.Checked = true;
         checkBox2.Checked = true;
         checkBox3.Checked = true;
         size              = 5; textBox1.Text = size.ToString();
         k              = 3; textBox2.Text = k.ToString();
         brushfit       = 1; newbrushfit(); textBox5.Text = brushfit.ToString();
         heightclasters = 12; textBox3.Text = heightclasters.ToString();
         widthclasters  = 12; textBox4.Text = widthclasters.ToString();
         clearColor     = Color.White; drawColor = Color.FromArgb(clearColor.A, 255 - clearColor.R, 255 - clearColor.G, 255 - clearColor.B); currentPen.Color = drawColor; fillBrush = new SolidBrush(drawColor); label9.Text = "White"; clear();
     }
 }
Exemple #14
0
        public static void FillPolygon(this Graphics g, Brush brush, PointD[] points, System.Drawing.Drawing2D.FillMode fillMode)
        {
            var pointsF = new PointF[points.Length];

            for (int i = 0; i < points.Length; i++)
            {
                pointsF[i] = new PointF((float)points[i].X, (float)points[i].Y);
            }
            g.FillPolygon(brush, pointsF, fillMode);
        }
Exemple #15
0
 public FreehandVObject(System.Drawing.PointF[] points, bool closePath, System.Drawing.Drawing2D.FillMode fillMode)
     : this("freeHand", points, closePath, fillMode)
 {
 }
Exemple #16
0
 public void FillClosedCurve(Brush brush, Point[] points, System.Drawing.Drawing2D.FillMode fillmode, float tension)
 {
 }
Exemple #17
0
 public void FillClosedCurve(Brush brush, PointF[] points, System.Drawing.Drawing2D.FillMode fillmode)
 {
 }
Exemple #18
0
 public void FillPolygon(Brush brush, Point[] points, System.Drawing.Drawing2D.FillMode fillMode)
 {
 }
Exemple #19
0
 public PolylineVObject(System.Drawing.PointF[] points, bool closePath, System.Drawing.Drawing2D.FillMode fillMode)
     : base("polyline", points, closePath, fillMode)
 {
     _polylineControlPointsProvider = new PolylineControlPointsProvider(this);
     base.JointControlPointsProvider.InsertProvider(0, _polylineControlPointsProvider);
 }
Exemple #20
0
        bool CreateItem(ServiceProtocol serviceProtocol, Int64 requestID, Guid guid, String tag, String path, Model model, Shape stencil, RectangleF boundingRect, Single angle, System.Drawing.Color fillColor, System.Drawing.Drawing2D.FillMode fillMode, bool mirrorX, bool mirrorY)
        {
            // Need to check for runstate here, and decide if we'll fire DoItemCreated.
            // This is required in case a rogue client tries to create an item even when not supposed to.
            // This applies to all three create*, and all three delete* events.
            if (true) // Decide whether to create an item.
            {         // We're going to do it.
              // Create the item.

                // Raise event(s).
                serviceProtocol.DoItemCreated(requestID, guid, tag, path, model, stencil, boundingRect, angle, fillColor, fillMode, mirrorX, mirrorY);

                return(true);
            }
            else
            { // We're not going to do it.
                return(false);
            }
        }