当前位置: 首页>>代码示例>>C#>>正文


C# CoreGraphics.CGAffineTransform类代码示例

本文整理汇总了C#中MonoMac.CoreGraphics.CGAffineTransform的典型用法代码示例。如果您正苦于以下问题:C# CGAffineTransform类的具体用法?C# CGAffineTransform怎么用?C# CGAffineTransform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CGAffineTransform类属于MonoMac.CoreGraphics命名空间,在下文中一共展示了CGAffineTransform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RotateAt

		public void RotateAt (float angle, float centerX, float centerY)
		{
			angle = Conversions.DegreesToRadians (angle);
			var sina = (float)Math.Sin (angle);
			var cosa = (float)Math.Cos (angle);
			var matrix = new CGAffineTransform(cosa, sina, -sina, cosa, centerX - centerX * cosa + centerY * sina, centerY - centerX * sina - centerY * cosa);
			control = CGAffineTransform.Multiply (matrix, control);
		}
开发者ID:Exe0,项目名称:Eto,代码行数:8,代码来源:MatrixHandler.cs

示例2: Multiply

		//
		// Operations
		//
		public static CGAffineTransform Multiply (CGAffineTransform a, CGAffineTransform b)
		{
			return new CGAffineTransform (a.xx * b.xx + a.yx * b.xy,
						      a.xx * b.yx + a.yx * b.yy,
						      a.xy * b.xx + a.yy * b.xy,
						      a.xy * b.yx + a.yy * b.yy,
						      a.x0 * b.xx + a.y0 * b.xy + b.x0,
						      a.x0 * b.yx + a.y0 * b.yy + b.y0);
		}
开发者ID:Anomalous-Software,项目名称:maccore,代码行数:12,代码来源:CGAffineTransform.cs

示例3: CGPattern

		public CGPattern (RectangleF bounds, CGAffineTransform matrix, float xStep, float yStep, CGPatternTiling tiling, bool isColored, DrawPattern drawPattern)
		{
			if (drawPattern == null)
				throw new ArgumentNullException ("drawPattern");

			callbacks.draw = DrawCallback;
			callbacks.release = ReleaseCallback;
			callbacks.version = 0;
			this.draw_pattern = drawPattern;

			gch = GCHandle.Alloc (this);
			handle = CGPatternCreate (GCHandle.ToIntPtr (gch) , bounds, matrix, xStep, yStep, tiling, isColored, ref callbacks);
		}
开发者ID:Anomalous-Software,项目名称:maccore,代码行数:13,代码来源:CGPattern.cs

示例4: Matrix

        public Matrix(Rectangle rect, Point[] plgpts)
        {
            if (plgpts == null)
                throw new ArgumentNullException ("plgpts");
            if (plgpts.Length != 3)
                throw new ArgumentException ("plgpts");

            Point p0 = plgpts [0];
            Point p1 = plgpts [1];
            Point p2 = plgpts [2];

            float m11 = (p1.X - p0.X) / (float)rect.Width;
            float m12 = (p1.Y - p0.Y) / (float)rect.Width;
            float m21 = (p2.X - p0.X) / (float)rect.Height;
            float m22 = (p2.X - p0.X) / (float)rect.Height;

            transform = new CGAffineTransform (m11, m12, m21, m22, p0.X, p0.Y);
            transform.Translate (rect.Width, rect.Height);
        }
开发者ID:janeC,项目名称:sysdrawing-coregraphics,代码行数:19,代码来源:Matrix.cs

示例5: DrawString


//.........这里部分代码省略.........

                //textPosition.Y += baselineOffset;
            }

            // If we are drawing vertial direction then we need to rotate our context transform by 90 degrees
            if ((format.FormatFlags & StringFormatFlags.DirectionVertical) == StringFormatFlags.DirectionVertical)
            {
                //textMatrix.Rotate (ConversionHelpers.DegreesToRadians (90));
                var verticalOffset = 0.0f;
                while (start < length) {
                    int count = typesetter.SuggestLineBreak (start, boundsWidth);
                    var line = typesetter.GetLine (new NSRange(start, count));

                    // Create and initialize some values from the bounds.
                    float ascent;
                    float descent;
                    float leading;
                    line.GetTypographicBounds (out ascent, out descent, out leading);
                    verticalOffset += (float)Math.Ceiling (ascent + descent + leading + 1); // +1 matches best to CTFramesetter's behavior
                    line.Dispose ();
                    start += count;
                }
                context.TranslateCTM (layoutRectangle.X, layoutRectangle.Y);
                context.RotateCTM (ConversionHelpers.DegreesToRadians (90));
                context.TranslateCTM (-layoutRectangle.X, -layoutRectangle.Y);
                context.TranslateCTM (0, -verticalOffset);
                start = 0;
            }

            start = 0;
            while (start < length && textPosition.Y < insetBounds.Bottom)
            {

                // Now we ask the typesetter to break off a line for us.
                // This also will take into account line feeds embedded in the text.
                //  Example: "This is text \n with a line feed embedded inside it"
                int count = typesetter.SuggestLineBreak(start, boundsWidth);
                var line = typesetter.GetLine(new NSRange(start, count));

                // Create and initialize some values from the bounds.
                float ascent;
                float descent;
                float leading;
                double lineWidth = line.GetTypographicBounds(out ascent, out descent, out leading);

                // Calculate the string format if need be
                var penFlushness = 0.0f;
                if (format != null)
                {
                    if (layoutAvailable)
                    {
                        if (format.Alignment == StringAlignment.Far)
                            penFlushness = (float)line.GetPenOffsetForFlush(1.0f, boundsWidth);
                        else if (format.Alignment == StringAlignment.Center)
                            penFlushness = (float)line.GetPenOffsetForFlush(0.5f, boundsWidth);
                    }
                    else
                    {
                        // We were only passed in a point so we need to format based
                        // on the point.
                        if (format.Alignment == StringAlignment.Far)
                            penFlushness -= (float)lineWidth;
                        else if (format.Alignment == StringAlignment.Center)
                            penFlushness -= (float)lineWidth / 2.0f;

                    }

                }

                // initialize our Text Matrix or we could get trash in here
                var textMatrix = new CGAffineTransform (
                    1, 0, 0, -1, 0, ascent);

                if (format.LineAlignment == StringAlignment.Near)
                    textMatrix.Translate (penFlushness + textPosition.X, textPosition.Y);
                if (format.LineAlignment == StringAlignment.Center)
                    textMatrix.Translate (penFlushness + textPosition.X, textPosition.Y + ((insetBounds.Height / 2) - (baselineOffset / 2)) );
                if (format.LineAlignment == StringAlignment.Far)
                    textMatrix.Translate(penFlushness + textPosition.X,  textPosition.Y + ((insetBounds.Height) - (baselineOffset)));

                context.TextMatrix = textMatrix;

                // and draw the line
                line.Draw(context);

                // Move the index beyond the line break.
                start += count;
                textPosition.Y += (float)Math.Ceiling(ascent + descent + leading + 1); // +1 matches best to CTFramesetter's behavior
                line.Dispose();

            }

            // Now we call the brush with a fill of true so the brush can do the fill if need be
            // For LinearGradientBrush this will draw the Gradient and end the TransparentLayer.
            // See comments.
            brush.Setup(this, true); // Fill

            context.TextMatrix = saveMatrix;
            context.RestoreState();
        }
开发者ID:Bewolf2,项目名称:sysdrawing-coregraphics,代码行数:101,代码来源:Graphics-DrawString.cs

示例6: CGPathContainsPoint

		extern static bool CGPathContainsPoint(IntPtr path, ref CGAffineTransform m, PointF point, bool eoFill);
开发者ID:kangaroo,项目名称:maccore,代码行数:1,代码来源:CGPath.cs

示例7: CGPathAddPath

		extern static void CGPathAddPath(IntPtr path1, ref CGAffineTransform m, IntPtr path2);
开发者ID:kangaroo,项目名称:maccore,代码行数:1,代码来源:CGPath.cs

示例8: CGPathAddArcToPoint

		extern static void CGPathAddArcToPoint(IntPtr path, ref CGAffineTransform m, float x1, float y1, float x2, float y2, float radius);
开发者ID:kangaroo,项目名称:maccore,代码行数:1,代码来源:CGPath.cs

示例9: CGPathAddArc

		extern static void CGPathAddArc(IntPtr path, ref CGAffineTransform m, float x, float y, float radius, float startAngle, float endAngle, bool clockwise);
开发者ID:kangaroo,项目名称:maccore,代码行数:1,代码来源:CGPath.cs

示例10: CGPathAddEllipseInRect

		extern static void CGPathAddEllipseInRect(IntPtr path, ref CGAffineTransform m, RectangleF rect);
开发者ID:kangaroo,项目名称:maccore,代码行数:1,代码来源:CGPath.cs

示例11: CGPathAddLineToPoint

		public void CGPathAddLineToPoint (CGAffineTransform transform, float x, float y)
		{
			CGPathAddLineToPoint (handle, ref transform, x, y);
		}
开发者ID:kangaroo,项目名称:maccore,代码行数:4,代码来源:CGPath.cs

示例12: CoreGraphicsGraphics

        //bool _highQuality = false;
        static CoreGraphicsGraphics()
        {
            //foreach (var f in UIFont.FamilyNames) {
            //	Console.WriteLine (f);
            //	var fs = UIFont.FontNamesForFamilyName (f);
            //	foreach (var ff in fs) {
            //		Console.WriteLine ("  " + ff);
            //	}
            //}

            _textMatrix = CGAffineTransform.MakeScale (1, -1);
        }
开发者ID:anton-nesterenko,项目名称:CrossGraphics,代码行数:13,代码来源:CoreGraphicsGraphics.cs

示例13: CGContextSetTextMatrix

		extern static void CGContextSetTextMatrix(IntPtr c, CGAffineTransform t);
开发者ID:jonlipsky,项目名称:maccore,代码行数:1,代码来源:CGContext.cs

示例14: AddLines

		public void AddLines (CGAffineTransform m, PointF [] points)
		{
			CGPathAddLines (handle, ref m, points, points.Length);
		}
开发者ID:kangaroo,项目名称:maccore,代码行数:4,代码来源:CGPath.cs

示例15: AddRects

		public void AddRects (CGAffineTransform m, PointF [] points, int count)
		{
			if (count > points.Length)
				throw new ArgumentException ("count");
			CGPathAddLines (handle, ref m, points, count);
		}
开发者ID:kangaroo,项目名称:maccore,代码行数:6,代码来源:CGPath.cs


注:本文中的MonoMac.CoreGraphics.CGAffineTransform类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。