當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。