本文整理汇总了C#中MonoMac.CoreGraphics.CGAffineTransform.TransformPoint方法的典型用法代码示例。如果您正苦于以下问题:C# CGAffineTransform.TransformPoint方法的具体用法?C# CGAffineTransform.TransformPoint怎么用?C# CGAffineTransform.TransformPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoMac.CoreGraphics.CGAffineTransform
的用法示例。
在下文中一共展示了CGAffineTransform.TransformPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NativeDrawString
//.........这里部分代码省略.........
penFlushness = (float)line.GetPenOffsetForFlush(1.0f, insetBounds.Width);
else if (stringFormat.Alignment == StringAlignment.Center)
penFlushness = (float)line.GetPenOffsetForFlush(0.5f, insetBounds.Width);
// initialize our Text Matrix or we could get trash in here
var textMatrix = new CGAffineTransform (
1, 0, 0, -1, 0, ascent);
if (stringFormat.LineAlignment == StringAlignment.Near)
textMatrix.Translate (penFlushness + textPosition.X, textPosition.Y); //insetBounds.Height - textPosition.Y -(float)Math.Floor(ascent - 1));
if (stringFormat.LineAlignment == StringAlignment.Center)
textMatrix.Translate (penFlushness + textPosition.X, textPosition.Y + ((insetBounds.Height / 2) - (baselineOffset / 2)) ); // -(float)Math.Floor(ascent)
if (stringFormat.LineAlignment == StringAlignment.Far)
textMatrix.Translate(penFlushness + textPosition.X, textPosition.Y + ((insetBounds.Height) - (baselineOffset)));
var glyphRuns = line.GetGlyphRuns ();
for (int glyphRunIndex = 0; glyphRunIndex < glyphRuns.Length; glyphRunIndex++)
{
var glyphRun = glyphRuns [glyphRunIndex];
var glyphs = glyphRun.GetGlyphs ();
var glyphPositions = glyphRun.GetPositions ();
//var textMatrix = glyphRun.TextMatrix;
// Create and initialize some values from the bounds.
float glyphAscent;
float glyphDescent;
float glyphLeading;
var elementPoints = new PointF[3];
for (int glyphIndex = 0; glyphIndex < glyphs.Length; glyphIndex++)
{
if (glyphIndex > 0)
{
textMatrix.x0 += glyphPositions [glyphIndex].X - glyphPositions[glyphIndex - 1].X;
textMatrix.y0 += glyphPositions [glyphIndex].Y - glyphPositions[glyphIndex - 1].Y;
}
var glyphPath = font.nativeFont.GetPathForGlyph (glyphs [glyphIndex]);
// glyphPath = null if it is a white space character
if (glyphPath != null) {
glyphPath.Apply (
delegate (CGPathElement pathElement) {
elementPoints[0] = textMatrix.TransformPoint(pathElement.Point1);
elementPoints[1] = textMatrix.TransformPoint(pathElement.Point2);
elementPoints[2] = textMatrix.TransformPoint(pathElement.Point3);
//Console.WriteLine ("Applying {0} - {1}, {2}, {3}", pathElement.Type, elementPoints[0], elementPoints[1], elementPoints[2]);
// now add position offsets
switch(pathElement.Type)
{
case CGPathElementType.MoveToPoint:
start_new_fig = true;
Append(elementPoints[0].X, elementPoints[0].Y,PathPointType.Line,true);
break;
case CGPathElementType.AddLineToPoint:
var lastPoint = points[points.Count - 1];
AppendPoint(lastPoint, PathPointType.Line, false);
AppendPoint(elementPoints[0], PathPointType.Line, false);
break;
case CGPathElementType.AddCurveToPoint:
case CGPathElementType.AddQuadCurveToPoint:
// This is the only thing I can think of right now for the fonts that
// I have tested. See the description of the quadraticToCubic method for
// more information
// Get the last point
var pt1 = points[points.Count - 1];
var pt2 = PointF.Empty;
var pt3 = PointF.Empty;
var pt4 = elementPoints[1];
GeomUtilities.QuadraticToCubic(pt1, elementPoints[0], elementPoints[1], out pt2, out pt3);
Append (pt1.X, pt1.Y, PathPointType.Line, true);
AppendBezier (pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
break;
case CGPathElementType.CloseSubpath:
CloseFigure();
break;
}
}
);
}
}
}
// 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();
}
}