System.Drawing.Drawing2D.Matrix.Rotate(float)

Here are the examples of the csharp api class System.Drawing.Drawing2D.Matrix.Rotate(float) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

27 Examples 7

1. Example

Project: DotSpatial
Source File: RasterExt.cs
public static void Rotate(this IRaster raster, float degrees)
        {
            Matrix m = raster.Bounds.GetAffineMatrix();
            m.Rotate(degrees);
            raster.Bounds.SetAffineMatrix(m);
        }

2. Example

Project: NClass
Source File: PDFGraphics.cs
public void RotateTransform(float angle)
    {
      transform.Rotate(angle);
      graphics.RotateTransform(angle);
    }

3. Example

Project: SvgNet
Source File: SVGGraphics.cs
public void RotateTransform(Single angle)
        {
            _transforms.Top.Rotate(angle);
        }

4. Example

Project: NClass
Source File: PDFGraphics.cs
public void RotateTransform(float angle)
    {
      transform.Rotate(angle);
      graphics.RotateTransform(angle);
    }

5. Example

Project: GerberTools
Source File: SVGWriter.cs
public void RotateTransform(float p)
        {
            CurrentTransform.Rotate(p);
            
        }

6. Example

Project: GerberTools
Source File: GLGraphicsInterface.cs
public void RotateTransform(float p)
        {
            System.Drawing.Drawing2D.Matrix M2 = new System.Drawing.Drawing2D.Matrix();
            M2.Rotate(p);
            DoTransform(M2);
        }

7. Example

Project: GerberTools
Source File: GLGraphicsInterface.cs
public void RotateTransform(float p)
        {
            System.Drawing.Drawing2D.Matrix M2 = new System.Drawing.Drawing2D.Matrix();
            M2.Rotate(p);
            DoTransform(M2);
        }

8. Example

Project: DotSpatial
Source File: Symbol.cs
public void Draw(Graphics g, double scaleWidth)
        {
            if (_innerSymbol != null)
            {
                _innerSymbol.Draw(g, scaleWidth);
                return;
            }

            Matrix old = g.Transform;
            Matrix adjust = g.Transform;
            float dx = (float)(scaleWidth * _offset.X);
            float dy = (float)(scaleWidth * _offset.Y);
            adjust.Translate(dx, -dy);
            adjust.Rotate((float)_angle);
            g.Transform = adjust;

            OnDraw(g, scaleWidth);

            g.Transform = old;
        }

9. Example

Project: ClearCanvas
Source File: MammographyImageSpatialTransform.cs
private static Vector3D GetCurrentPosteriorVector(Vector3D imagePosterior, int sourceWidth, float adjustedSourceHeight, int rotation, float scaleX, float scaleY, bool flipX, bool flipY)
		{
			// figure out where the posterior direction went
			using (var transform = new Matrix())
			{
				var points = new[] {new PointF(sourceWidth*imagePosterior.X, adjustedSourceHeight*imagePosterior.Y)};
				transform.Rotate(rotation);
				transform.Scale(scaleX*(flipY ? -1 : 1), scaleY*(flipX ? -1 : 1));
				transform.TransformPoints(points);
				return new Vector3D(points[0].X, points[0].Y, 0);
			}
		}

10. Example

Project: ClearCanvas
Source File: ShowAnglesToolGraphic.cs
private static PointF BisectAngle(PointF point1, PointF point2, PointF point3, float magnitude)
			{
				PointF[] points = new PointF[] {point1, point3};
				using (Matrix2D rotation = new Matrix2D())
				{
					rotation.Rotate((float) (-Vector.SubtendedAngle(point1, point2, point3)/2 + 180));
					rotation.Translate(-point2.X, -point2.Y);
					rotation.TransformPoints(points);
				}

				Vector3D result = new Vector3D(points[0].X, points[0].Y, 0);
				if (FloatComparer.AreEqual(result.Magnitude, 0F, 0.01F))
					result = new Vector3D(-1, 0, 0);
				result = result/result.Magnitude*magnitude;

				return new PointF(point2.X - result.X, point2.Y - result.Y);
			}

11. Example

Project: SvgNet
Source File: SVGGraphics.cs
private void DrawEndAnchor(LineCap lc, CustomLineCap clc, Color col, float w, PointF pt, float angle/n ..... /n //View Source file for more details /n }

12. Example

Project: SharpMap
Source File: NorthArrow.cs
protected override void OnRender(Graphics g, Map map)
        {
            var image = NorthArrowIm/n ..... /n //View Source file for more details /n }

13. Example

Project: ClearCanvas
Source File: ArcPrimitive.cs
internal static float ConvertStartAngle(float angle, SpatialTransform transform, CoordinateSystem targetSystem)
		{
			PointF xVector = new PointF(100, 0);

			Matrix rotation = new Matrix();
			PointF[] angleVector = new PointF[] { xVector };
			rotation.Rotate(angle);
			rotation.TransformVectors(angleVector);
			rotation.Dispose();

			SizeF xVectorTransformed, angleVectorTransformed;
			if (targetSystem == Graphics.CoordinateSystem.Destination)
			{
				xVectorTransformed = transform.ConvertToDestination(new SizeF(xVector));
				angleVectorTransformed = transform.ConvertToDestination(new SizeF(angleVector[0]));
			}
			else
			{
				xVectorTransformed = transform.ConvertToSource(new SizeF(xVector));
				angleVectorTransformed = transform.ConvertToSource(new SizeF(angleVector[0]));
			}

			float xRotationOffset =
				(int)Math.Round(Vector.SubtendedAngle(xVectorTransformed.ToPointF(), PointF.Empty, xVector));

			float angleTransformed =
				(int)Math.Round(Vector.SubtendedAngle(angleVectorTransformed.ToPointF(), PointF.Empty, xVectorTransformed.ToPointF()));

			// have to figure out where x-axis moved to and then return the difference between the angle
			// and the x-axis, where both are in 'target' coordinates.
			float returnAngle = angleTransformed + xRotationOffset;
			if (returnAngle < 0)
				returnAngle += 360;

			return returnAngle;
		}

14. Example

Project: ClearCanvas
Source File: InvariantBoundablePrimitive.cs
private PointF ConvertInvariantToDestination(PointF invariantPoint)
		{
			PointF xVector = new PointF(100, 0);
			SizeF xVectorTransformed = base.SpatialTransform.ConvertToDestination(new SizeF(xVector));

			//figure out where the source x-axis went in destination
			int rotation = (int)Math.Round(Vector.SubtendedAngle(xVectorTransformed.ToPointF(), PointF.Empty, xVector));
			if (rotation < 0)
				rotation += 360;

			Matrix m = new Matrix();
			m.Rotate(rotation);
			PointF[] pt = { invariantPoint };
			m.TransformPoints(pt);
			m.Dispose();

			return new PointF(base.Location.X + pt[0].X, base.Location.Y + pt[0].Y);
		}

15. Example

Project: ClearCanvas
Source File: ProtractorRoiCalloutLocationStrategy.cs
public override bool CalculateCalloutLocation(out PointF location, out CoordinateSystem coordinateSy/n ..... /n //View Source file for more details /n }

16. Example

Project: DotSpatial
Source File: ColorLever.cs
private void Transform(Matrix flipRot)
        {
            flipRot.Translate(Width / 2F, Height / 2F);
            if (Flip)
            {
                flipRot.Scale(-1F, 1F);
            }

            flipRot.Rotate(-(float)Angle);
            double ang = Angle * Math.PI / 180;
            float scale = (float)(1 / (1 + ((Math.Sqrt(2) - 1) * Math.Abs(Math.Sin(ang)))));
            flipRot.Scale(scale, scale); // A rotated square would go outside the bounds of the control, so resize.
            flipRot.Translate(-Width / 2F, -Height / 2F);
        }

17. Example

Project: ShareX
Source File: SpeechBalloonDrawingShape.cs
protected GraphicsPath CreateTailPath(Rectangle rect, Point tailPosition)
        {
            GraphicsPath gpTail = new GraphicsPath();
            Point center = rect.Center();
            int rectAverageSize = (rect.Width + rect.Height) / 2;
            int tailWidth = (int)(TailWidthMultiplier * rectAverageSize);
            tailWidth = Math.Min(Math.Min(tailWidth, rect.Width), rect.Height);
            int tailOrigin = tailWidth / 2;
            int tailLength = (int)MathHelpers.Distance(center, tailPosition);
            gpTail.AddLine(0, -tailOrigin, 0, tailOrigin);
            gpTail.AddLine(0, tailOrigin, tailLength, 0);
            gpTail.CloseFigure();
            using (Matrix matrix = new Matrix())
            {
                matrix.Translate(center.X, center.Y);
                float tailDegree = MathHelpers.LookAtDegree(center, tailPosition);
                matrix.Rotate(tailDegree);
                gpTail.Transform(matrix);
            }
            return gpTail;
        }

18. Example

Project: GerberTools
Source File: DelaunayBuilder.cs
public void Build(QuadTreeNode Mask, double compensateangle  = 0.0)
        {
          //  M = new /n ..... /n //View Source file for more details /n }

19. Example

Project: SvgNet
Source File: SvgTransformList.cs
public void FromString(string s)
		{
			_m = new Matrix();

			string name, args;

			int idx = s.In/n ..... /n //View Source file for more details /n }

20. Example

Project: ecsharp
Source File: LLShapes.cs
public override void Draw(Graphics g)
		{
			Matrix mat = new Matrix();
			mat.Translate(Point.X, Point.Y);
			mat.Scale(Radius, Radius);
			mat.Rotate(AngleDeg);
			PointF[] pts = Type.Points.SelectArray(p => p.AsBCL());
			mat.TransformPoints(pts);
			DrawPolygon(g, Style, pts.SelectArray(p => p.AsLoyc()), Type.Divisions.AsList(), Opacity);
		}

21. Example

Project: ShareX
Source File: SpeechbubbleContainer.cs
private GraphicsPath CreateTail()
        {
            Rectangle rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);

            int tailLength = GeometryHelper.Distance2D(rect.Left + rect.Width / 2, rect.Top + rect.Height / 2, TargetGripper.Left, TargetGripper.Top);
            int tailWidth = (Math.Abs(rect.Width) + Math.Abs(rect.Height)) / 20;

            // This should fix a problem with the tail being to wide
            tailWidth = Math.Min(Math.Abs(rect.Width) / 2, tailWidth);
            tailWidth = Math.Min(Math.Abs(rect.Height) / 2, tailWidth);

            GraphicsPath tail = new GraphicsPath();
            tail.AddLine(-tailWidth, 0, tailWidth, 0);
            tail.AddLine(tailWidth, 0, 0, -tailLength);
            tail.CloseFigure();

            int tailAngle = 90 + (int)GeometryHelper.Angle2D(rect.Left + rect.Width / 2, rect.Top + rect.Height / 2, TargetGripper.Left, TargetGripper.Top);

            using (Matrix tailMatrix = new Matrix())
            {
                tailMatrix.Translate(rect.Left + rect.Width / 2, rect.Top + rect.Height / 2);
                tailMatrix.Rotate(tailAngle);
                tail.Transform(tailMatrix);
            }

            return tail;
        }

22. Example

Project: ShareX
Source File: SpeechbubbleContainer.cs
private GraphicsPath CreateTail()
        {
            Rectangle rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);

            int tailLength = GeometryHelper.Distance2D(rect.Left + (rect.Width / 2), rect.Top + (rect.Height / 2), TargetGripper.Left, TargetGripper.Top);
            int tailWidth = (Math.Abs(rect.Width) + Math.Abs(rect.Height)) / 20;

            // This should fix a problem with the tail being to wide
            tailWidth = Math.Min(Math.Abs(rect.Width) / 2, tailWidth);
            tailWidth = Math.Min(Math.Abs(rect.Height) / 2, tailWidth);

            GraphicsPath tail = new GraphicsPath();
            tail.AddLine(-tailWidth, 0, tailWidth, 0);
            tail.AddLine(tailWidth, 0, 0, -tailLength);
            tail.CloseFigure();

            int tailAngle = 90 + (int)GeometryHelper.Angle2D(rect.Left + (rect.Width / 2), rect.Top + (rect.Height / 2), TargetGripper.Left, TargetGripper.Top);

            using (Matrix tailMatrix = new Matrix())
            {
                tailMatrix.Translate(rect.Left + (rect.Width / 2), rect.Top + (rect.Height / 2));
                tailMatrix.Rotate(tailAngle);
                tail.Transform(tailMatrix);
            }

            return tail;
        }

23. Example

Project: ClearCanvas
Source File: ArcPrimitive.cs
internal static float ConvertSweepAngle(float sweepAngle, float startAngle, SpatialTransform transform, CoordinateSystem targetSystem)
		{
			PointF x = new PointF(100, 0);

			PointF[] startVector = new PointF[] { x };
			Matrix rotation = new Matrix();
			rotation.Rotate(startAngle);
			rotation.TransformVectors(startVector);

			PointF[] sweepVector = (PointF[])startVector.Clone();
			rotation.Reset();
			rotation.Rotate(sweepAngle);
			rotation.TransformVectors(sweepVector);
			rotation.Dispose();

			SizeF startVectorTransformed, sweepVectorTransformed;
			if (targetSystem == Graphics.CoordinateSystem.Destination)
			{
				startVectorTransformed = transform.ConvertToDestination(new SizeF(startVector[0]));
				sweepVectorTransformed = transform.ConvertToDestination(new SizeF(sweepVector[0]));
			}
			else
			{
				startVectorTransformed = transform.ConvertToSource(new SizeF(startVector[0]));
				sweepVectorTransformed = transform.ConvertToSource(new SizeF(sweepVector[0]));
			}

			// simply return the angle between the start and sweep angle, in the target system.
			return (int)Math.Round(Vector.SubtendedAngle(sweepVectorTransformed.ToPointF(), PointF.Empty, startVectorTransformed.ToPointF()));
		}

24. Example

Project: TDMaker
Source File: PieItem.cs
override public bool GetCoords( GraphPane pane, int i, out string coords )
		{
			coords = string.Empty;

			PointF pt = _boundingRectangle.Location;
			pt.X += _boundingRectangle.Width / 2.0f;
			pt.Y += _boundingRectangle.Height / 2.0f;

			float radius = _boundingRectangle.Width / 2.0f;
			Matrix matrix = new Matrix();

			// Move the coordinate system to local coordinates
			// of this text object (that is, at the specified
			// x,y location)
			matrix.Translate( pt.X, pt.Y );

			matrix.Rotate( this.StartAngle );
			//One mark every 5'ish degrees
			int count = (int)Math.Floor ( SweepAngle / 5 ) + 1;
			PointF[] pts = new PointF[2 + count];
			pts[0] = new PointF( 0, 0 );
			pts[1] = new PointF( radius, 0 );
			double angle = 0.0;
			for ( int j = 2; j < count + 2; j++ )
			{
				angle += SweepAngle / count;

				pts[j] = new PointF(radius * (float)Math.Cos(angle * Math.PI / 180.0),
											radius * (float)Math.Sin( angle * Math.PI / 180.0 ) );
			}

			matrix.TransformPoints( pts );

			coords = String.Format("{0:f0},{1:f0},{2:f0},{3:f0},",
						pts[0].X, pts[0].Y, pts[1].X, pts[1].Y );
			for (int j = 2; j < count + 2; j++)
				coords += String.Format(j > count ? "{0:f0},{1:f0}" : "{0:f0},{1:f0},", pts[j].X, pts[j].Y);

			return true;
		}

25. Example

Project: ZedGraph
Source File: PieItem.cs
override public bool GetCoords( GraphPane pane, int i, out string coords )
		{
			coords = string.Empty;

			PointF pt = _boundingRectangle.Location;
			pt.X += _boundingRectangle.Width / 2.0f;
			pt.Y += _boundingRectangle.Height / 2.0f;

			float radius = _boundingRectangle.Width / 2.0f;
			Matrix matrix = new Matrix();

			// Move the coordinate system to local coordinates
			// of this text object (that is, at the specified
			// x,y location)
			matrix.Translate( pt.X, pt.Y );

			matrix.Rotate( this.StartAngle );
			//One mark every 5'ish degrees
			int count = (int)Math.Floor ( SweepAngle / 5 ) + 1;
			PointF[] pts = new PointF[2 + count];
			pts[0] = new PointF( 0, 0 );
			pts[1] = new PointF( radius, 0 );
			double angle = 0.0;
			for ( int j = 2; j < count + 2; j++ )
			{
				angle += SweepAngle / count;

				pts[j] = new PointF(radius * (float)Math.Cos(angle * Math.PI / 180.0),
											radius * (float)Math.Sin( angle * Math.PI / 180.0 ) );
			}

			matrix.TransformPoints( pts );

			coords = String.Format("{0:f0},{1:f0},{2:f0},{3:f0},",
						pts[0].X, pts[0].Y, pts[1].X, pts[1].Y );
			for (int j = 2; j < count + 2; j++)
				coords += String.Format(j > count ? "{0:f0},{1:f0}" : "{0:f0},{1:f0},", pts[j].X, pts[j].Y);

			return true;
		}

26. Example

Project: ui
Source File: GraphicsRenderer2D.cs
private void DrawLineTextSegment(Target2DWrapper<Graphics> target, double[] x, double[] y, str/n ..... /n //View Source file for more details /n }

27. Example

Project: ATF
Source File: ChartUtil.cs
public static void DrawVerticalScale(
            Matrix transform,
            RectangleF graphRect/n ..... /n //View Source file for more details /n }