public System.Drawing.Bitmap SetCornerAlpha(System.Drawing.Bitmap pBit) { System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(pBit); new System.Drawing.SolidBrush(EdgeDisplay.alphaColor); System.Drawing.Drawing2D.GraphicsPath graphicsPath = new System.Drawing.Drawing2D.GraphicsPath(); System.Drawing.PointF[] array = new System.Drawing.PointF[4]; array[0] = new System.Drawing.PointF(0f, 0f); array[1] = new System.Drawing.PointF(0f, (float)pBit.Height); array[2] = new System.Drawing.PointF((float)pBit.Height, (float)pBit.Height); graphicsPath.ClearMarkers(); graphicsPath.AddPolygon(array); graphics.SetClip(graphicsPath); graphics.Clear(System.Drawing.Color.Transparent); array[0] = new System.Drawing.PointF((float)this.subSize.Width, 0f); array[1] = new System.Drawing.PointF((float)(this.subSize.Width - pBit.Height), (float)pBit.Height); array[2] = new System.Drawing.PointF((float)(this.subSize.Width + pBit.Height + 1), (float)pBit.Height); array[3] = new System.Drawing.PointF((float)(this.subSize.Width + 1), 0f); graphicsPath.ClearMarkers(); graphicsPath.AddPolygon(array); graphics.SetClip(graphicsPath); graphics.Clear(System.Drawing.Color.Transparent); array[0] = new System.Drawing.PointF((float)(this.subSize.Width + this.subSize.Height), 0f); array[1] = new System.Drawing.PointF((float)(this.subSize.Width + this.subSize.Height - pBit.Height), (float)pBit.Height); array[2] = new System.Drawing.PointF((float)(this.subSize.Width + this.subSize.Height + pBit.Height + 1), (float)pBit.Height); array[3] = new System.Drawing.PointF((float)(this.subSize.Width + this.subSize.Height + 1), 0f); graphicsPath.ClearMarkers(); graphicsPath.AddPolygon(array); graphics.SetClip(graphicsPath); graphics.Clear(System.Drawing.Color.Transparent); array[0] = new System.Drawing.PointF((float)(this.subSize.Width * 2 + this.subSize.Height), 0f); array[1] = new System.Drawing.PointF((float)(this.subSize.Width * 2 + this.subSize.Height - pBit.Height), (float)pBit.Height); array[2] = new System.Drawing.PointF((float)(this.subSize.Width * 2 + this.subSize.Height + pBit.Height + 1), (float)pBit.Height); array[3] = new System.Drawing.PointF((float)(this.subSize.Width * 2 + this.subSize.Height + 1), 0f); graphicsPath.ClearMarkers(); graphicsPath.AddPolygon(array); graphics.SetClip(graphicsPath); graphics.Clear(System.Drawing.Color.Transparent); array[0] = new System.Drawing.PointF((float)(this.subSize.Width * 2 + this.subSize.Height * 2), 0f); array[1] = new System.Drawing.PointF((float)(this.subSize.Width * 2 + this.subSize.Height * 2 - pBit.Height), (float)pBit.Height); array[2] = new System.Drawing.PointF((float)(this.subSize.Width * 2 + this.subSize.Height * 2 + pBit.Height + 1), (float)pBit.Height); array[3] = new System.Drawing.PointF((float)(this.subSize.Width * 2 + this.subSize.Height * 2 + 1), 0f); graphicsPath.ClearMarkers(); graphicsPath.AddPolygon(array); graphics.SetClip(graphicsPath); graphics.Clear(System.Drawing.Color.Transparent); return(pBit); }
public override System.Drawing.Bitmap GetNext() { if (this.nowState == MarqueeDisplayState.First) { this.nowPositionF -= this.step; if (this.nowPositionF > (float)((this.newBitmap.Height + this.newBitmap.Width) / 2)) { this.nowState = MarqueeDisplayState.Stay; } this.nowPosition = (int)this.nowPositionF; this.getPoint1(this.nowPosition); this.getPoint2(this.nowPosition); this.getPoint3(this.nowPosition); this.getPoint4(this.nowPosition); System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(this.newBitmap); System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap); System.Drawing.Drawing2D.GraphicsPath graphicsPath = new System.Drawing.Drawing2D.GraphicsPath(); graphicsPath.AddPolygon(this.pa1); graphics.SetClip(graphicsPath); graphics.Clear(System.Drawing.Color.Black); graphicsPath.ClearMarkers(); graphicsPath.AddPolygon(this.pa2); graphics.SetClip(graphicsPath); graphics.Clear(System.Drawing.Color.Black); graphicsPath.ClearMarkers(); graphicsPath.AddPolygon(this.pa3); graphics.SetClip(graphicsPath); graphics.Clear(System.Drawing.Color.Black); graphicsPath.ClearMarkers(); graphicsPath.AddPolygon(this.pa4); graphics.SetClip(graphicsPath); graphics.Clear(System.Drawing.Color.Black); if (this.nowPositionF <= 0f) { this.nowState = MarqueeDisplayState.Second; } return(bitmap); } return(null); }
public override System.Drawing.Bitmap GetNext() { System.Drawing.Bitmap result; lock (this.newBitmap) { lock (this.oldBitmap) { if (this.nowState == MarqueeDisplayState.First) { this.nowPositionF -= this.step; if (this.nowPositionF < 0f) { this.nowState = MarqueeDisplayState.Stay; } this.nowPosition = (int)this.nowPositionF; this.getPoint1(this.nowPosition); this.getPoint2(this.nowPosition); this.getPoint3(this.nowPosition); this.getPoint4(this.nowPosition); } else { if (this.nowState == MarqueeDisplayState.Stay) { this.StayNum += 42; if (this.StayNum > this.effect.Stay) { if (this.effect.ExitMode == 0) { result = null; return(result); } this.nowState = MarqueeDisplayState.Exit; } result = new System.Drawing.Bitmap(this.newBitmap); return(result); } if (this.nowState == MarqueeDisplayState.Exit) { result = this.Exit.GetNext(); return(result); } } System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(this.oldBitmap); System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap); System.Drawing.Bitmap image = new System.Drawing.Bitmap(this.newBitmap); System.Drawing.Graphics graphics2 = System.Drawing.Graphics.FromImage(image); System.Drawing.Drawing2D.GraphicsPath graphicsPath = new System.Drawing.Drawing2D.GraphicsPath(); graphicsPath.AddPolygon(this.pa1); graphics2.SetClip(graphicsPath); graphics2.Clear(System.Drawing.Color.Transparent); graphicsPath.ClearMarkers(); graphicsPath.AddPolygon(this.pa2); graphics2.SetClip(graphicsPath); graphics2.Clear(System.Drawing.Color.Transparent); graphicsPath.ClearMarkers(); graphicsPath.AddPolygon(this.pa3); graphics2.SetClip(graphicsPath); graphics2.Clear(System.Drawing.Color.Transparent); graphicsPath.ClearMarkers(); graphicsPath.AddPolygon(this.pa4); graphics2.SetClip(graphicsPath); graphics2.Clear(System.Drawing.Color.Transparent); graphics.DrawImage(image, new System.Drawing.Point(0, 0)); result = bitmap; } } return(result); }
private void ClearMarkers2(Graphics g) { // Create a path and set two markers. GraphicsPath myPath = new GraphicsPath(); myPath.AddLine(new Point(0, 0), new Point(50, 50)); myPath.SetMarkers(); Rectangle rect = new Rectangle(50, 50, 50, 50); myPath.AddRectangle(rect); myPath.SetMarkers(); myPath.AddEllipse(100, 100, 100, 50); var pathPoints = myPath.PathPoints; var pathTypes = myPath.PathTypes; Console.WriteLine("ClearMarkers Before reverse"); for (int i = 0; i < myPath.PathTypes.Length; i++) { Console.WriteLine("{0} - {1},{2}", (PathPointType)pathTypes[i], pathPoints[i].X, pathPoints[i].Y); } // Draw the path to screen. g.FillPath(Brushes.Red, myPath); g.DrawPath(new Pen(Color.Black, 2), myPath); // Draw the first set of points to the screen. DrawPoints2(g, myPath.PathPoints, 20); // Call GraphicsPath.Reverse. myPath.Reverse(); pathPoints = myPath.PathPoints; pathTypes = myPath.PathTypes; Console.WriteLine("ClearMarkers After reverse"); for (int i = 0; i < myPath.PathTypes.Length; i++) { Console.WriteLine("{0} - {1},{2}", (PathPointType)pathTypes[i], pathPoints[i].X, pathPoints[i].Y); } // Call GraphicsPath.ClearMarkers. myPath.ClearMarkers(); pathPoints = myPath.PathPoints; pathTypes = myPath.PathTypes; Console.WriteLine("ClearMarkers After Clear"); for (int i = 0; i < myPath.PathTypes.Length; i++) { Console.WriteLine("{0} - {1},{2}", (PathPointType)pathTypes[i], pathPoints[i].X, pathPoints[i].Y); } // Draw the path to screen. g.FillPath(Brushes.CornflowerBlue, myPath); g.DrawPath(new Pen(Color.Black, 2), myPath); // Draw the reversed set of points to the screen. DrawPoints2(g, myPath.PathPoints, 150); }
private void ClearMarkers1(Graphics g) { // Create a path and set two markers. GraphicsPath myPath = new GraphicsPath(); myPath.AddLine(new Point(0, 0), new Point(50, 50)); myPath.SetMarkers(); Rectangle rect = new Rectangle(50, 50, 50, 50); myPath.AddRectangle(rect); myPath.SetMarkers(); myPath.AddEllipse(100, 100, 100, 50); myPath.ClearMarkers (); // Draw the path to screen. g.DrawPath(new Pen(Color.Black, 2), myPath); }
protected override void refreshPath() { path = new GraphicsPath(); Rectangle rect = new Rectangle(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width, this.ClientRectangle.Height); Point p1 = new Point(rect.Width / 2, 0); Point p2 = new Point(rect.Width, rect.Height / 2); Point p3 = new Point(rect.Width / 2, rect.Height); Point p4 = new Point(0, rect.Height / 2); if (type == RelationshipType.AssociativeEntity) { path.ClearMarkers(); path.AddRectangle(rect); } else { path.ClearMarkers(); path.AddPolygon(new Point[] { p1, p2, p3, p4 }); } this.Region = new Region(path); }
protected void SetPath(RectangleF rect, out GraphicsPath path) { path = new GraphicsPath(); path.ClearMarkers(); RectangleF tl = new RectangleF(rect.Left, rect.Top, 20, 20); RectangleF tr = new RectangleF(rect.Right - 20, rect.Top, 20, 20); RectangleF bl = new RectangleF(rect.Left, rect.Bottom - 20, 20, 20); RectangleF br = new RectangleF(rect.Right - 20, rect.Bottom - 20, 20, 20); path.AddArc(tl, 179, 91); path.AddArc(tr, 269, 91); path.AddArc(br, 359, 91); path.AddArc(bl, 89, 91); path.CloseFigure(); }
public void ClearMarkers() { path = new GraphicsPath (); path.AddEllipse (0, 0, 100, 200); path.SetMarkers (); path.AddLine (new Point (100, 100), new Point (200, 100)); Rectangle rect = new Rectangle (200, 0, 100, 200); path.AddRectangle (rect); path.SetMarkers (); path.AddLine (new Point (250, 200), new Point (250, 300)); path.SetMarkers (); path.ClearMarkers(); GraphicsPathIterator pathIterator = new GraphicsPathIterator(path); pathIterator.Rewind (); int [] pointsNumber = new int [] {21, 0, 0, 0}; for (int i=0; i < 4; i ++) { Assert.AreEqual (pointsNumber [i], pathIterator.NextMarker (path)); } //t.AssertCompare (); }