本文整理汇总了C#中Xwt.Drawing.Context.ModifyCTM方法的典型用法代码示例。如果您正苦于以下问题:C# Context.ModifyCTM方法的具体用法?C# Context.ModifyCTM怎么用?C# Context.ModifyCTM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xwt.Drawing.Context
的用法示例。
在下文中一共展示了Context.ModifyCTM方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reflect
/// <summary>
/// Illustrates the use of matrix transforms to skew and reflect text
/// </summary>
public void Reflect (Context ctx, double x, double y)
{
ctx.Save ();
ctx.SetLineWidth (1);
TextLayout layout = new TextLayout ();
layout.Text = "Reflected and Skewed Text";
layout.Font = Font.WithSize (16);
Size size = layout.GetSize ();
Rectangle r = new Rectangle (Point.Zero, size);
// Draw text with no transformations at (x+0.5, y+0.5)
ctx.Translate (x+0.5, y+0.5); // final move to specified location
ctx.SetColor (Colors.Blue);
ctx.DrawTextLayout (layout, 0, 0);
// Use Matrix transforms to reflect Y-values and skew X-values by -0.5*Y
// Note that transforms are prepended, so are actioned in reverse order
// This is the same order that Backend Context transforms are applied
Matrix m = new Matrix (); // Identity matrix
Matrix s = new Matrix (1.0, 0.0, // new skew matrix
-0.5, 1.0,
0.0, 0.0);
m.Translate (0, size.Height); // Shift text back to place
m.Prepend (s); // Skew X-values
m.Scale (1, -1); // Reflect text Y-values
m.Translate (0, -size.Height); // Shift text base to (0,0)
ctx.ModifyCTM (m); // NB ctx.Translate (x+0.5, y+0.5) still active
ctx.SetColor (Colors.DarkGray);
ctx.Rectangle (r);
ctx.Fill ();
ctx.SetColor (Colors.LightBlue);
ctx.DrawTextLayout (layout, 0, 0);
ctx.Restore ();
}