本文整理汇总了C#中Cairo.Context.RelLineTo方法的典型用法代码示例。如果您正苦于以下问题:C# Context.RelLineTo方法的具体用法?C# Context.RelLineTo怎么用?C# Context.RelLineTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.Context
的用法示例。
在下文中一共展示了Context.RelLineTo方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: 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);
}
示例3: xxx_dash
public void xxx_dash(Context cr, int width, int height)
{
double[] dashes = new double[] {
0.20, // ink
0.05, // skip
0.05, // ink
0.05 // skip
};
double offset = -0.2;
Normalize(cr, width, height);
cr.SetDash(dashes, offset);
cr.MoveTo(0.5, 0.1);
cr.LineTo(0.9, 0.9);
cr.RelLineTo(-0.4, 0.0);
cr.CurveTo(0.2, 0.9, 0.2, 0.5, 0.5, 0.5);
cr.Stroke();
}
示例4: Paint
public virtual void Paint(Context ctx)
{
PointD size = this.MeasureSize (ctx);
PaintContour (ctx,size);
KnownColors.SetFontFacePieceName(ctx);
TextExtents te = ctx.TextExtents(this.Name), ten;
double y0 = 0.5d*(size.Y-te.Width);
ctx.MoveTo(0.5d*Margin,y0);
ctx.Save();
ctx.Rotate(0.5d*Math.PI);
ctx.ShowText(this.Name);
ctx.Restore();
double x0 = Margin+te.Height;
KnownColors.SetFontFaceNormal(ctx);
te = ctx.TextExtents(OptionalString);
y0 = 2.0d*Margin;
int index = 0x00;
PointD siz;
foreach(IPuzzlePiece ipp in this.arguments) {
ctx.Save();
ctx.Translate(x0,Margin);
if(ipp == null) {
siz = new PointD(MinimumWidth,size.Y-4.0d*Margin);
ctx.Rectangle(Margin,Margin,siz.X,siz.Y);
ctx.Pattern = KnownColors.ConstructionPattern;
ctx.FillPreserve();
}
else {
siz = ipp.MeasureSize(ctx);
}
ctx.Rectangle(0.0d,0.0d,siz.X+2.0d*Margin,siz.Y+2.0d*Margin);
ctx.Color = KnownColors.Black;
ctx.StrokePreserve();
if(ipp == null) {
ctx.Pattern = ExtensionMethods.GenerateColorSequencePattern(siz.X+2.0d*Margin,TypeColorArguments[index]);
ctx.Fill();
ctx.Translate(Margin,Margin);
ctx.MoveTo(0.0d,0.0d);
ctx.LineTo(MinimumWidth,0.0d);
ctx.RelLineTo(0.0d,5.0d);
ctx.LineTo(5.0d,5.0d);
ctx.ClosePath();
ctx.Pattern = KnownColors.ShadowDownPattern;
ctx.Fill();
ctx.MoveTo(0.0d,0.0d);
ctx.LineTo(0.0d,siz.Y);
ctx.RelLineTo(5.0d,0.0d);
ctx.LineTo(5.0d,5.0d);
ctx.ClosePath();
ctx.Pattern = KnownColors.ShadowRightPattern;
ctx.Fill();
}
else {
ctx.Pattern = ExtensionMethods.GenerateColorSequencePattern(siz.X+2.0d*Margin,TypeColorArguments[index]);
ctx.Fill();
ctx.Color = KnownColors.Black;
ctx.Translate(Margin,Margin);
ipp.Paint(ctx);
}
ctx.Restore();
subpieces[index] = new Rectangle(x0+Margin,2.0d*Margin,siz.X,siz.Y);
x0 += siz.X+3.0d*Margin;
if(index >= NumberOfArguments-NumberOfOptionalArguments) {
ctx.MoveTo(x0-2.0d*Margin-0.5d*(siz.X+te.Width),siz.Y+3.0d*Margin-2.0d);
ctx.ShowText(OptionalString);
}
if(this.ArgumentNames != null && index < arguments.Length) {
ten = ctx.TextExtents(this.ArgumentNames[index]);
ctx.MoveTo(x0-2.0d*Margin-0.5d*(siz.X+ten.Width),-te.YBearing+Margin+2.0d);
ctx.ShowText(this.ArgumentNames[index]);
}
index++;
}
}
示例5: text_align_center
public void text_align_center(Context cr, int width, int height)
{
Normalize (cr, width, height);
cr.SelectFontFace("Sans", FontSlant.Normal, FontWeight.Normal);
cr.SetFontSize(0.2);
TextExtents extents = cr.TextExtents("cairo");
double x = 0.5 -((extents.Width/2.0) + extents.XBearing);
double y = 0.5 -((extents.Height/2.0) + extents.YBearing);
cr.MoveTo(x, y);
cr.ShowText("cairo");
// draw helping lines
cr.Color = new Color (1, 0.2, 0.2, 0.6);
cr.Arc(x, y, 0.05, 0, 2*Math.PI);
cr.Fill();
cr.MoveTo(0.5, 0);
cr.RelLineTo(0, 1);
cr.MoveTo(0, 0.5);
cr.RelLineTo(1, 0);
cr.Stroke();
}
示例6: text_extents
public void text_extents(Context cr, int width, int height)
{
double x=0.1;
double y=0.6;
string utf8 = "cairo";
Normalize (cr, width, height);
cr.SelectFontFace("Sans", FontSlant.Normal, FontWeight.Normal);
cr.SetFontSize(0.4);
TextExtents extents = cr.TextExtents(utf8);
cr.MoveTo(x,y);
cr.ShowText(utf8);
// draw helping lines
cr.Color = new Color (1, 0.2, 0.2, 0.6);
cr.Arc(x, y, 0.05, 0, 2*Math.PI);
cr.Fill();
cr.MoveTo(x,y);
cr.RelLineTo(0, -extents.Height);
cr.RelLineTo(extents.Width, 0);
cr.RelLineTo(extents.XBearing, -extents.YBearing);
cr.Stroke();
}
示例7: set_line_join
public void set_line_join(Context cr, int width, int height)
{
Normalize(cr, width, height);
cr.LineWidth = 0.16;
cr.MoveTo(0.3, 0.33);
cr.RelLineTo(0.2, -0.2);
cr.RelLineTo(0.2, 0.2);
cr.LineJoin = LineJoin.Miter; // default
cr.Stroke();
cr.MoveTo(0.3, 0.63);
cr.RelLineTo(0.2, -0.2);
cr.RelLineTo(0.2, 0.2);
cr.LineJoin = LineJoin.Bevel;
cr.Stroke();
cr.MoveTo(0.3, 0.93);
cr.RelLineTo(0.2, -0.2);
cr.RelLineTo(0.2, 0.2);
cr.LineJoin = LineJoin.Round;
cr.Stroke();
}
示例8: path
public void path(Context cr, int width, int height)
{
Normalize(cr, width, height);
cr.MoveTo(0.5, 0.1);
cr.LineTo(0.9, 0.9);
cr.RelLineTo(-0.4, 0.0);
cr.CurveTo(0.2, 0.9, 0.2, 0.5, 0.5, 0.5);
cr.Stroke();
}
示例9: fill_and_stroke2
public void fill_and_stroke2(Context cr, int width, int height)
{
Normalize (cr, width, height);
cr.MoveTo(0.5, 0.1);
cr.LineTo(0.9, 0.9);
cr.RelLineTo(-0.4, 0.0);
cr.CurveTo(0.2, 0.9, 0.2, 0.5, 0.5, 0.5);
cr.ClosePath();
cr.MoveTo(0.25, 0.1);
cr.RelLineTo(0.2, 0.2);
cr.RelLineTo(-0.2, 0.2);
cr.RelLineTo(-0.2, -0.2);
cr.ClosePath();
cr.Color = new Color (0, 0, 1);
cr.FillPreserve();
cr.Color = new Color (0, 0, 0);
cr.Stroke();
}
示例10: paintBackground
private void paintBackground(Context ctx, int w, int h)
{
ctx.Color = BlueprintStyle.BluePrint;
ctx.Rectangle(0.0d, 0.0d, w, h);
ctx.Fill();
ctx.Color = BlueprintStyle.SoftWhite;
ctx.Rectangle(Offset, Offset, w-2*Offset, h-2*Offset);
ctx.ClosePath();
ctx.Rectangle(Offset2, Offset2, w-2*Offset2, h-2*Offset2);
ctx.ClosePath();
ctx.Fill();
double W = w-2*Offset2;
int n = (int)Math.Round((double)W/LineDelta);
double dx = (double)W/n;
ctx.LineWidth = 0.5d;
for(int i = 1; i < n; i++) {
ctx.MoveTo(dx*i+Offset2, Offset2);
ctx.RelLineTo(0.0d, h-2*Offset2);
ctx.Stroke();
}
double H = h-2*Offset2;
n = (int)Math.Round((double)H/LineDelta);
double dy = (double)H/n;
for(int i = 1; i < n; i++) {
ctx.MoveTo(Offset2, dy*i+Offset2);
ctx.RelLineTo(w-2.0d*Offset2, 0.0d);
ctx.Stroke();
}
}
示例11: PaintWidget
protected override void PaintWidget(Context ctx, int w, int h)
{
ctx.Rectangle (0.0d, 0.0d, w, h);
ctx.SetFill (BlueprintStyle.BluePrint);
double wb = w - Offset - xb - 4.0d;
double xbt = wb * (current - min) / (max - min) - 4.0d;
ctx.Fill ();
switch (this.mode) {
case MediaMode.Play:
ctx.Rectangle (Offset + 2, 1.0d, 8.0d, 32.0d);
ctx.Rectangle (Offset + 18, 1.0d, 8.0d, 32.0d);
ctx.ClosePath ();
break;
default:
ctx.MoveTo (Offset, 1.0d);
ctx.RelLineTo (32.0d, 16.0d);
ctx.RelLineTo (-32.0d, 16.0d);
ctx.ClosePath ();
break;
}
double xf = xb + xbt;
double xt = xf + 8.0d;
ctx.Rectangle (xf, 1.0d, 8.0d, 32.0d);
this.xtickS = xf;
this.xtickE = xt;
ctx.SetFill (BlueprintStyle.FillPattern);
ctx.FillPreserve ();
ctx.SetFill (BlueprintStyle.HardWhite);
if (xbt > 0.0d) {
ctx.MoveTo (xb, 16.0d);
ctx.LineTo (xf, 16.0d);
}
if (xf < w - Offset - 4.0d) {
ctx.MoveTo (xt, 16.0d);
ctx.LineTo (w - Offset - 4.0d, 16.0d);
}
foreach (double t in this.Chapters) {
double x = this.TtoX (t);
if (x < xf || x >= xt) {
ctx.MoveTo (x, 0.0d);
ctx.LineTo (x, 33.0d);
}
}
ctx.Stroke ();
}