本文整理汇总了C#中Cairo.Context.RelMoveTo方法的典型用法代码示例。如果您正苦于以下问题:C# Context.RelMoveTo方法的具体用法?C# Context.RelMoveTo怎么用?C# Context.RelMoveTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.Context
的用法示例。
在下文中一共展示了Context.RelMoveTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawTriangle
void DrawTriangle (Context ctx)
{
var halfSide = arrowPadding;
var verticalModifier = arrowPosition == Xwt.Popover.Position.Top ? -1 : 1;
// Move to the left
ctx.RelMoveTo (-halfSide, 0);
ctx.RelLineTo (halfSide, verticalModifier * arrowPadding);
ctx.RelLineTo (halfSide, verticalModifier * -arrowPadding);
}
示例2: DrawText
public static void DrawText(Context cr, string family, double fontSize, string text, Pango.Alignment alignment)
{
// return;
lock (FontCache) {
// LogError("DrawText {0}", text);
Profiler p = new Profiler ("DrawText");
double w,h;
Pango.Layout layout = GetLayout (cr, family, QuantizeFontSize(fontSize));
layout.SetText (text);
layout.Alignment = alignment;
layout.GetExtents(out pe, out le);
p.Time ("GetExtents {0}", pe);
w = (double)le.Width / (double)Pango.Scale.PangoScale;
h = (double)le.Height / (double)Pango.Scale.PangoScale;
if (alignment == Pango.Alignment.Right) {
cr.RelMoveTo (-w, 0);
} else if (alignment == Pango.Alignment.Center) {
cr.RelMoveTo (-w/2, 0);
}
Pango.CairoHelper.ShowLayout (cr, layout);
p.Time ("ShowLayout");
if (ShowTextExtents) {
cr.Save ();
PointD pt = cr.CurrentPoint;
cr.MoveTo (pt.X, pt.Y);
cr.RelLineTo(w, 0);
cr.RelLineTo(0, h);
cr.Operator = Operator.Over;
cr.Color = new Color (1,0.5,1,0.5);
cr.LineWidth = 0.5;
cr.Stroke ();
cr.MoveTo (pt.X, pt.Y);
cr.Restore ();
}
cr.RelMoveTo (w, 0);
}
}
示例3: Text
public void Text(Context context, string txt, HorizontalTextAlignment horizontal = HorizontalTextAlignment.Center, VerticalTextAlignment vertical = VerticalTextAlignment.Middle)
{
context.SelectFontFace ("Sans", FontSlant.Normal, FontWeight.Normal);
//context.SetFontSize (_surface.Height / 10);
context.SetFontSize (14);
var extends = context.TextExtents (txt);
double x, y;
x = -(((double)horizontal) / 2 * extends.Width + extends.XBearing);
y = -(((double)vertical) / 2 * extends.Height + extends.YBearing);
context.RelMoveTo (x, y);
context.ShowText (txt);
}
示例4: ClickSortBar
/** FAST */
bool ClickSortBar(Context cr, double x, double y)
{
cr.NewPath ();
cr.MoveTo (0.0, 0.0);
TextExtents te;
cr.Color = ActiveColor;
cr.RelMoveTo ( 0.0, ToolbarLabelFontSize * 0.4 );
Helpers.DrawText (cr, ToolbarTitleFontFamily, ToolbarTitleFontSize, SortLabel);
cr.RelMoveTo ( 0.0, ToolbarLabelFontSize * -0.4 );
foreach (SortHandler sf in SortFields) {
cr.Color = (SortField == sf) ? ActiveColor : InActiveColor;
te = Helpers.GetTextExtents (
cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, sf.Name);
if (Helpers.CheckTextExtents(cr, te, x, y)) {
SortField = sf;
ResetZoom ();
UpdateLayout ();
return true;
}
Helpers.DrawText (cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, sf.Name);
Helpers.DrawText (cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, " ");
}
return false;
}
示例5: ClickBreadcrumb
/** FAST */
bool ClickBreadcrumb(Context cr, uint width, double x, double y)
{
if (CurrentDirPath == Helpers.RootDir) return false;
TextExtents te1 = Helpers.GetTextExtents (cr, BreadcrumbFontFamily, BreadcrumbFontSize, String.Join(dirSep, CurrentDirPath.Split(Helpers.DirSepC)) + dirSep);
cr.Save ();
double areaWidth = width-BreadcrumbMarginLeft-BreadcrumbMarginRight;
cr.Rectangle (0,0,areaWidth, te1.Height);
cr.Clip ();
cr.Translate (Math.Min(0,areaWidth-te1.Width), -BreadcrumbMarginTop);
if (areaWidth - te1.Width >= 0)
cr.Translate(-(BreadcrumbMarginLeft+1), 0);
cr.MoveTo (0.0, 0.0);
int hitIndex = 0;
string[] segments = CurrentDirPath.Split(Helpers.DirSepC);
foreach (string s in segments) {
string name = (s == "") ? rootChar : s+dirSep;
TextExtents te = Helpers.GetTextExtents (cr, BreadcrumbFontFamily, BreadcrumbFontSize, name);
te.Height += BreadcrumbMarginTop;
if (s == "" && (areaWidth - te1.Width >= 0))
te.Width += BreadcrumbMarginLeft+1;
if (Helpers.CheckTextExtents(cr, te, x, y)) {
string newDir = String.Join(Helpers.DirSepS, segments, 0, hitIndex+1);
if (newDir == "") newDir = Helpers.RootDir;
if (newDir != CurrentDirPath) {
SetCurrentDir (newDir);
} else {
ResetZoom ();
UpdateLayout ();
}
cr.Restore ();
return true;
}
cr.RelMoveTo( te.Width, 0 );
hitIndex += 1;
}
cr.IdentityMatrix ();
cr.Rectangle (0,-1,width,2);
if (cr.InFill(x,y)) {
ResetZoom ();
UpdateLayout ();
}
cr.Restore ();
return false;
}
示例6: DrawSortBar
/** FAST */
void DrawSortBar(Context cr)
{
cr.NewPath ();
cr.MoveTo (0.0, 0.0);
cr.Color = ActiveColor;
cr.RelMoveTo ( 0.0, ToolbarLabelFontSize * 0.4 );
Helpers.DrawText (cr, ToolbarTitleFontFamily, ToolbarTitleFontSize, SortLabel);
cr.RelMoveTo ( 0.0, ToolbarLabelFontSize * -0.4 );
foreach (SortHandler sf in SortFields) {
cr.Color = (SortField == sf) ? ActiveColor : InActiveColor;
Helpers.DrawText (cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, sf.Name);
Helpers.DrawText (cr, ToolbarLabelFontFamily, ToolbarLabelFontSize, " ");
}
}