本文整理汇总了C#中Cairo.CurveTo方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.CurveTo方法的具体用法?C# Cairo.CurveTo怎么用?C# Cairo.CurveTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo
的用法示例。
在下文中一共展示了Cairo.CurveTo方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawCurvedRectangle
static void DrawCurvedRectangle(Cairo.Context gr, int x, int y, int width, int height)
{
gr.Save ();
gr.MoveTo (x, y + height / 2);
gr.CurveTo (x, y, x, y, x + width / 2, y);
gr.CurveTo (x + width, y, x + width, y, x + width, y + height / 2);
gr.CurveTo (x + width, y + height, x + width, y + height, x + width / 2, y + height);
gr.CurveTo (x, y + height, x, y + height, x, y + height / 2);
gr.Restore ();
}
示例2: DrawCurvedRectangle
/// <summary>
/// The draw curved rectangle.
/// </summary>
protected void DrawCurvedRectangle(Cairo.Context gr, double x, double y, double width, double height)
{
gr.Save();
gr.MoveTo(x, y + height / 2);
gr.CurveTo(x, y, x, y, x + width / 2, y);
gr.CurveTo(x + width, y, x + width, y, x + width, y + height / 2);
gr.CurveTo(x + width, y + height, x + width, y + height, x + width / 2, y + height);
gr.CurveTo(x, y + height, x, y + height, x, y + height / 2);
gr.Restore();
}
示例3: draw
static void draw (Cairo.Context gr, int width, int height)
{
double x=0.1, y=0.5;
double x1=0.4, y1=0.9, x2=0.6, y2=0.1, x3=0.9, y3=0.5;
gr.Scale (width, height);
gr.LineWidth = 0.04;
gr.MoveTo ( new PointD (x, y) );
gr.CurveTo ( new PointD (x1, y1),
new PointD (x2, y2),
new PointD (x3, y3)
);
gr.Stroke ();
gr.Color = new Color (1, 0.2, 0.2, 0.6);
gr.LineWidth = 0.03;
gr.MoveTo ( new PointD (x, y) );
gr.LineTo ( new PointD (x1, y1) );
gr.MoveTo ( new PointD (x2, y2) );
gr.LineTo ( new PointD (x3, y3) );
gr.Stroke ();
}
示例4: draw
static void draw (Cairo.Context gr, int width, int height)
{
gr.Scale (width, height);
gr.LineWidth = 0.04;
gr.MoveTo ( new PointD (0.5, 0.1) );
gr.LineTo ( new PointD (0.9, 0.9) );
gr.RelLineTo ( new Distance (-0.4, 0.0) );
gr.CurveTo ( new PointD (0.2, 0.9),
new PointD ( 0.2, 0.5),
new PointD (0.5, 0.5)
);
gr.ClosePath ();
gr.MoveTo ( new PointD (0.25, 0.1) );
gr.RelLineTo ( new Distance (0.2, 0.2) );
gr.RelLineTo ( new Distance ( -0.2, 0.2) );
gr.RelLineTo ( new Distance (-0.2, -0.2) );
gr.ClosePath ();
gr.Color = new Color (0, 0, 1, 1);
gr.FillPreserve ();
gr.Color = new Color ( 0, 0, 0, 1);
gr.Stroke ();
}
示例5: CurvedRectangle
public static void CurvedRectangle(Cairo.Context c, RectangleD rect, double radius)
{
if (rect.Width < (radius * 2.0) ) {
radius = rect.Width/2.0;
}
if (rect.Height < (radius * 2.0) ) {
radius = rect.Height/2.0;
}
c.MoveTo (rect.X, rect.Y+radius);
c.LineTo (rect.X, rect.Y2-radius);
c.CurveTo (rect.X, rect.Y2-radius, rect.X, rect.Y2, rect.X+radius, rect.Y2);
c.LineTo (rect.X2-radius, rect.Y2);
c.CurveTo (rect.X2-radius, rect.Y2, rect.X2, rect.Y2, rect.X2, rect.Y2-radius);
c.LineTo (rect.X2, rect.Y+radius);
c.CurveTo (rect.X2, rect.Y+radius, rect.X2, rect.Y, rect.X2-radius, rect.Y);
c.LineTo (rect.X+radius, rect.Y);
c.CurveTo (rect.X+radius, rect.Y, rect.X, rect.Y, rect.X, rect.Y+radius);
}
示例6: onDraw
protected override void onDraw(Cairo.Context gr)
{
gr.Save ();
int spacing = (Parent as TabView).Spacing;
gr.MoveTo (0.5, TabTitle.Slot.Bottom-0.5);
gr.LineTo (TabTitle.Slot.Left - spacing, TabTitle.Slot.Bottom-0.5);
gr.CurveTo (
TabTitle.Slot.Left - spacing / 2, TabTitle.Slot.Bottom-0.5,
TabTitle.Slot.Left - spacing / 2, 0.5,
TabTitle.Slot.Left, 0.5);
gr.LineTo (TabTitle.Slot.Right, 0.5);
gr.CurveTo (
TabTitle.Slot.Right + spacing / 2, 0.5,
TabTitle.Slot.Right + spacing / 2, TabTitle.Slot.Bottom-0.5,
TabTitle.Slot.Right + spacing, TabTitle.Slot.Bottom-0.5);
gr.LineTo (Slot.Width-0.5, TabTitle.Slot.Bottom-0.5);
gr.LineTo (Slot.Width-0.5, Slot.Height-0.5);
gr.LineTo (0.5, Slot.Height-0.5);
gr.ClosePath ();
gr.LineWidth = 2;
Foreground.SetAsSource (gr);
gr.StrokePreserve ();
gr.Clip ();
base.onDraw (gr);
gr.Restore ();
}
示例7: LayoutTabBorder
void LayoutTabBorder (Cairo.Context ctx, Gdk.Rectangle allocation, int contentWidth, int px, int margin, bool active = true)
{
double x = 0.5 + (double)px;
double y = (double) allocation.Height + 0.5 - BottomBarPadding + margin;
double height = allocation.Height - TopBarPadding - BottomBarPadding;
x += TabSpacing + margin;
contentWidth -= (TabSpacing + margin) * 2;
double rightx = x + contentWidth;
int lean = Math.Min (LeanWidth, contentWidth / 2);
int halfLean = lean / 2;
int smoothing = 2;
if (active) {
ctx.MoveTo (0, y + 0.5);
ctx.LineTo (0, y);
ctx.LineTo (x - halfLean, y);
} else {
ctx.MoveTo (x - halfLean, y + 0.5);
ctx.LineTo (x - halfLean, y);
}
ctx.CurveTo (new PointD (x + smoothing, y),
new PointD (x - smoothing, y - height),
new PointD (x + halfLean, y - height));
ctx.LineTo (rightx - halfLean, y - height);
ctx.CurveTo (new PointD (rightx + smoothing, y - height),
new PointD (rightx - smoothing, y),
new PointD (rightx + halfLean, y));
if (active) {
ctx.LineTo (allocation.Width, y);
ctx.LineTo (allocation.Width, y + 0.5);
} else {
ctx.LineTo (rightx + halfLean, y + 0.5);
}
}
示例8: DrawPiece
public static void DrawPiece (Cairo.Context cairo,
Cairo.Color fill,
FigureManager fm,
FigureType fig, int x, int y,
int size)
{
//fill = new Cairo.Color (0, 0, 0, 1);
ArrayList list = fm.GetPoints (fig);
for (int i = 0; i < list.Count; i++)
{
SvgInfo info = (SvgInfo) list[i];
if (info.cmd == 'M')
{
cairo.MoveTo (x + info.x,
y + info.y);
continue;
}
else if (info.cmd == 'L')
{
cairo.LineTo (x + info.x,
y + info.y);
continue;
}
else if (info.cmd == 'z')
{
continue;
}
SvgInfo info2 = (SvgInfo) list[++i];
SvgInfo info3 = (SvgInfo) list[++i];
cairo.CurveTo (x + info.x, y + info.y,
x + info2.x, y + info2.y,
x + info3.x, y + info3.y);
}
cairo.Color = fill;
cairo.Fill ();
}
示例9: DrawRoundRectangle
public static void DrawRoundRectangle (Cairo.Context cr, bool topLeftRound, bool topRightRound, bool bottomLeftRound, bool bottomRightRound, double x, double y, double r, double w, double h)
{
// UA****BQ
// H C
// * *
// G D
// TF****ES
cr.NewPath ();
if (topLeftRound) {
cr.MoveTo (x + r, y); // Move to A
} else {
cr.MoveTo (x, y); // Move to U
}
if (topRightRound) {
cr.LineTo (x + w - r, y); // Straight line to B
cr.CurveTo (x + w, y,
x + w, y,
x + w, y + r); // Curve to C, Control points are both at Q
} else {
cr.LineTo (x + w, y); // Straight line to Q
}
if (bottomRightRound) {
cr.LineTo (x + w, y + h - r); // Move to D
cr.CurveTo (x + w, y + h,
x + w, y + h,
x + w - r, y + h); // Curve to E
} else {
cr.LineTo (x + w, y + h); // Move to S
}
if (bottomLeftRound) {
cr.LineTo (x + r, y + h); // Line to F
cr.CurveTo (x, y + h,
x, y + h ,
x, y + h - r); // Curve to G
} else {
cr.LineTo (x, y + h); // Line to T
}
if (topLeftRound) {
cr.LineTo (x, y + r); // Line to H
cr.CurveTo (x, y,
x , y,
x + r, y); // Curve to A
} else {
cr.LineTo (x, y); // Line to U
}
cr.ClosePath ();
}
示例10: DrawCurveTabs
void DrawCurveTabs (Cairo.Context cr, Cairo.Rectangle rectangle)
{
if (IsSeparator)
return;
cr.MoveTo (rectangle.X, rectangle.Y);
double bottom = rectangle.Y + rectangle.Height - 1;
cr.CurveTo (
rectangle.X + SpacerWidth / 2, rectangle.Y,
rectangle.X + SpacerWidth / 2, bottom,
rectangle.X + SpacerWidth, bottom);
cr.LineTo (rectangle.X + rectangle.Width - SpacerWidth, bottom);
cr.CurveTo (
rectangle.X + rectangle.Width - SpacerWidth / 2, bottom,
rectangle.X + rectangle.Width - SpacerWidth / 2, rectangle.Y,
rectangle.X + rectangle.Width, rectangle.Y);
cr.Color = (HslColor)parent.Style.Dark (StateType.Normal);
cr.StrokePreserve ();
cr.ClosePath ();
if (Active) {
cr.Color = (HslColor)parent.Style.Background (StateType.Prelight);
} else if (HoverPosition.X >= 0) {
double rx = rectangle.X + HoverPosition.X;
double ry = rectangle.Y + HoverPosition.Y;
Cairo.RadialGradient gradient = new Cairo.RadialGradient (rx, ry, rectangle.Height * 1.5,
rx, ry, 2);
var color = (HslColor)parent.Style.Mid (StateType.Normal);
color.L *= 1.05;
gradient.AddColorStop (0, color);
color.L *= 1.07;
gradient.AddColorStop (1, color);
cr.Pattern = gradient;
} else {
cr.Color = (HslColor)parent.Style.Mid (StateType.Normal);
}
cr.Fill ();
cr.Save ();
cr.Translate (rectangle.X + (rectangle.Width - w) / 2, (rectangle.Height - h) / 2);
cr.Color = (HslColor)parent.Style.Text (StateType.Normal);
cr.ShowLayout (layout);
cr.Restore ();
}
示例11: draw
static void draw (Cairo.Context gr, int width, int height)
{
double x0 = 0.1;
double y0 = 0.1;
double rect_width = 0.8;
double rect_height = 0.8;
double radius = 0.4;
double x1,y1;
gr.Scale (width, height);
gr.LineWidth = 0.04;
x1=x0+rect_width;
y1=y0+rect_height;
if (rect_width == 0 || rect_height == 0)
return;
if (rect_width/2<radius) {
if (rect_height/2<radius) {
gr.MoveTo( new PointD(x0, (y0 + y1)/2) );
gr.CurveTo ( new PointD (x0 ,y0),
new PointD (x0, y0),
new PointD ((x0 + x1)/2, y0)
);
gr.CurveTo ( new PointD (x1, y0 ),
new PointD (x1, y0 ),
new PointD (x1, (y0 + y1)/2)
);
gr.CurveTo ( new PointD (x1, y1),
new PointD (x1, y1),
new PointD ((x1 + x0)/2, y1)
);
gr.CurveTo ( new PointD (x0, y1),
new PointD (x0, y1),
new PointD (x0, (y0 + y1)/2)
);
}
else {
gr.MoveTo ( new PointD (x0, y0 + radius) );
gr.CurveTo ( new PointD (x0 ,y0),
new PointD (x0, y0),
new PointD ((x0 + x1)/2, y0)
);
gr.CurveTo ( new PointD (x1, y0),
new PointD (x1, y0),
new PointD (x1, y0 + radius)
);
gr.LineTo ( new PointD (x1 , y1 - radius) );
gr.CurveTo ( new PointD (x1, y1),
new PointD (x1, y1),
new PointD ((x1 + x0)/2, y1)
);
gr.CurveTo ( new PointD (x0, y1),
new PointD (x0, y1),
new PointD (x0, y1- radius)
);
}
}
else {
if (rect_height/2<radius) {
gr.MoveTo ( new PointD (x0, (y0 + y1)/2) );
gr.CurveTo ( new PointD (x0 , y0),
new PointD (x0 , y0),
new PointD (x0 + radius, y0)
);
gr.LineTo ( new PointD (x1 - radius, y0) );
gr.CurveTo ( new PointD (x1, y0),
new PointD (x1, y0),
new PointD (x1, (y0 + y1)/2)
);
gr.CurveTo ( new PointD (x1, y1),
new PointD (x1, y1),
new PointD (x1 - radius, y1)
);
gr.LineTo ( new PointD (x0 + radius, y1) );
gr.CurveTo ( new PointD ( x0, y1),
new PointD (x0, y1),
new PointD (x0, (y0 + y1)/2)
);
}
else {
gr.MoveTo ( new PointD (x0, y0 + radius) );
gr.CurveTo ( new PointD (x0 , y0),
//.........这里部分代码省略.........
示例12: DrawConnection
private void DrawConnection(Cairo.Context gc, PointD start, PointD c1, PointD c2, PointD end)
{
gc.Save();
gc.LineWidth = (2.0 / this.ScaleFactor);
gc.Color = connectionGreen;
gc.MoveTo(start.X, start.Y);
gc.CurveTo(c1.X, c1.Y, c2.X, c2.Y, end.X, end.Y);
gc.Stroke();
gc.Restore();
}