本文整理汇总了C#中Cairo.Restore方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.Restore方法的具体用法?C# Cairo.Restore怎么用?C# Cairo.Restore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo
的用法示例。
在下文中一共展示了Cairo.Restore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawRoundedRectangle
public static void DrawRoundedRectangle(Cairo.Context gr, double x, double y,
double width, double height, double radius,
Cairo.Color color, Cairo.Color borderColor)
{
gr.Save();
if((radius > height / 2) || (radius > width / 2))
radius = Math.Min(height / 2, width / 2);
gr.MoveTo(x, y + radius);
gr.Arc(x + radius, y + radius, radius, Math.PI, -Math.PI / 2);
gr.LineTo(x + width - radius, y);
gr.Arc(x + width - radius, y + radius, radius, -Math.PI / 2, 0);
gr.LineTo(x + width, y + height - radius);
gr.Arc(x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
gr.LineTo(x + radius, y + height);
gr.Arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
gr.ClosePath();
gr.Restore();
gr.LineJoin = LineJoin.Round;
gr.Color = borderColor;
gr.StrokePreserve();
gr.Color = color;
gr.Fill();
}
示例2: onDraw
protected override void onDraw(Cairo.Context gr)
{
Rectangle rBack = new Rectangle (Slot.Size);
//rBack.Inflate (-Margin);
// if (BorderWidth > 0)
// rBack.Inflate (-BorderWidth / 2);
Background.SetAsSource (gr, rBack);
CairoHelpers.CairoRectangle(gr, rBack, CornerRadius);
gr.Fill ();
if (BorderWidth > 0) {
Foreground.SetAsSource (gr, rBack);
CairoHelpers.CairoRectangle(gr, rBack, CornerRadius, BorderWidth);
}
gr.Save ();
if (ClipToClientRect) {
//clip to client zone
CairoHelpers.CairoRectangle (gr, ClientRectangle,Math.Max(0.0, CornerRadius-Margin));
gr.Clip ();
}
if (child != null)
child.Paint (ref gr);
gr.Restore ();
}
示例3: Paint
public override void Paint(Cairo.Context gr, Rectangle rect, string subPart = "")
{
float widthRatio = 1f;
float heightRatio = 1f;
if (Scaled){
widthRatio = (float)rect.Width / Dimensions.Width;
heightRatio = (float)rect.Height / Dimensions.Height;
}
if (KeepProportions) {
if (widthRatio < heightRatio)
heightRatio = widthRatio;
else
widthRatio = heightRatio;
}
gr.Save ();
gr.Translate (rect.Left,rect.Top);
gr.Scale (widthRatio, heightRatio);
gr.Translate ((rect.Width/widthRatio - Dimensions.Width)/2, (rect.Height/heightRatio - Dimensions.Height)/2);
using (ImageSurface imgSurf = new ImageSurface (image, Format.Argb32,
Dimensions.Width, Dimensions.Height, 4 * Dimensions.Width)) {
gr.SetSourceSurface (imgSurf, 0,0);
gr.Paint ();
}
gr.Restore ();
}
示例4: Paint
public override void Paint(Cairo.Context gr, Rectangle rect, string subPart = "")
{
float widthRatio = 1f;
float heightRatio = 1f;
if (Scaled) {
widthRatio = (float)rect.Width / Dimensions.Width;
heightRatio = (float)rect.Height / Dimensions.Height;
}
if (KeepProportions) {
if (widthRatio < heightRatio)
heightRatio = widthRatio;
else
widthRatio = heightRatio;
}
gr.Save ();
gr.Translate (rect.Left,rect.Top);
gr.Scale (widthRatio, heightRatio);
gr.Translate (((float)rect.Width/widthRatio - Dimensions.Width)/2f, ((float)rect.Height/heightRatio - Dimensions.Height)/2f);
if (string.IsNullOrEmpty (subPart))
hSVG.RenderCairo (gr);
else
hSVG.RenderCairoSub (gr, "#" + subPart);
gr.Restore ();
}
示例5: Render
public void Render(Cairo.Context c, MonoReports.Model.Controls.Control control)
{
Section section = control as Section;
Rectangle borderRect;
c.Save ();
borderRect = new Rectangle (section.Location.X * unitMulitipier , section.Location.Y * unitMulitipier , section.Width * unitMulitipier, section.Height * unitMulitipier);
c.FillRectangle (borderRect, section.BackgroundColor.ToCairoColor());
c.Restore ();
}
示例6: 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 ();
}
示例7: RenderLine
public static void RenderLine(Cairo.Context g, Cairo.Color c, double lw, double x0, double y0, double x1, double y1)
{
g.Save();
g.Color = c;
g.LineWidth = 3;
g.MoveTo(x0, y0);
g.LineTo(x1, y1);
g.Stroke();
g.Restore();
}
示例8: 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();
}
示例9: OnDrawn
protected override bool OnDrawn(Cairo.Context cr)
{
cr.Save ();
Gdk.RGBA color = Hyena.Gui.GtkUtilities.ColorBlend (
StyleContext.GetBackgroundColor (StateFlags.Normal),
StyleContext.GetColor (StateFlags.Normal));
cr.SetSourceRGBA (color.Red, color.Green, color.Blue, color.Alpha);
DrawCairo (cr);
cr.Restore ();
return false;
}
示例10: Render
public void Render(Cairo.Context c, MonoReports.Model.Controls.Control control)
{
SubReport subreport = control as SubReport;
Rectangle borderRect;
c.Save ();
borderRect = new Rectangle (subreport.Location.X, subreport.Location.Y, subreport.Width, subreport.Height);
c.ClipRectangle (borderRect);
borderRect = new Rectangle (subreport.Location.X, subreport.Location.Y, subreport.Width, subreport.Height);
c.FillRectangle (borderRect, subreport.BackgroundColor.ToCairoColor ());
c.Restore ();
}
示例11: RenderCircle
public static void RenderCircle(Cairo.Context g, Cairo.Color c, double r, double x, double y)
{
g.Save();
g.Color = c;
g.MoveTo(x, y);
g.Arc(x, y, r, 0, 6.28);
g.LineWidth = 3;
g.ClosePath();
g.Fill();
g.Restore();
}
示例12: Draw
public override void Draw(Cairo.Context cr)
{
cr.Save();
cr.Color = new Color(1.0, 1.0, 1.0);
cr.Rectangle(X0, Y0, X1 - X0, Y1 - Y0);
cr.Fill();
cr.Color = new Color(0.0, 0.0, 0.0);
cr.Rectangle(X0, Y0, X1 - X0, Y1 - Y0);
cr.Stroke();
cr.Restore();
}
示例13: RenderInvertedTriangle
public static void RenderInvertedTriangle(Cairo.Context g, Cairo.Color c, double x, double y, int side)
{
g.Save();
g.Color = c;
g.MoveTo(x, y);
g.LineTo(x - side / 2, y - side);
g.LineTo(x + side / 2, y - side);
g.LineTo(x, y);
g.Fill();
g.Restore();
}
示例14: ShadowedText
public static void ShadowedText(Cairo.Context g, Cairo.Color c, string text, double x, double y)
{
g.Save();
g.MoveTo(x + SHADOW_SPACING, y + SHADOW_SPACING);
g.Color = Colors.BLACK;
g.ShowText(text);
g.MoveTo(x, y);
g.Color = c;
g.ShowText(text);
g.Restore();
}
示例15:
void IIconBarMarker.DrawIcon (TextEditor ed, Cairo.Context cr, DocumentLine line, int lineNumber, double x, double y, double width, double height)
{
cr.Save ();
cr.Translate (
x + 0.5 + (width - cache.errorPixbuf.Width) / 2,
y + 0.5 + (height - cache.errorPixbuf.Height) / 2
);
Gdk.CairoHelper.SetSourcePixbuf (
cr,
errors.Any (e => e.IsError) ? cache.errorPixbuf : cache.warningPixbuf, 0, 0);
cr.Paint ();
cr.Restore ();
}