当前位置: 首页>>代码示例>>C#>>正文


C# Cairo.Restore方法代码示例

本文整理汇总了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();
        }
开发者ID:dineshkummarc,项目名称:longomatch,代码行数:26,代码来源:Cairo.cs

示例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 ();
        }
开发者ID:jpbruyere,项目名称:Crow,代码行数:28,代码来源:Border.cs

示例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 ();
        }
开发者ID:jpbruyere,项目名称:Crow,代码行数:30,代码来源:BmpPicture.cs

示例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 ();
        }
开发者ID:jpbruyere,项目名称:Crow,代码行数:29,代码来源:SvgPicture.cs

示例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 ();
 }
开发者ID:elsupergomez,项目名称:monoreports,代码行数:9,代码来源:SectionRenderer.cs

示例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 ();
 }
开发者ID:mooxh,项目名称:The-Birds,代码行数:10,代码来源:Main.cs

示例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();
 }
开发者ID:skinitimski,项目名称:Reverence,代码行数:10,代码来源:Shapes.cs

示例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();
 }
开发者ID:willy40,项目名称:testmono,代码行数:13,代码来源:CBaseControl.cs

示例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;
 }
开发者ID:knocte,项目名称:banshee,代码行数:11,代码来源:LinearProgress.cs

示例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 ();
 }
开发者ID:elsupergomez,项目名称:monoreports,代码行数:11,代码来源:SubreportRenderer.cs

示例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();
 }
开发者ID:skinitimski,项目名称:Reverence,代码行数:11,代码来源:Shapes.cs

示例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();
 }
开发者ID:jonasoster,项目名称:smul,代码行数:11,代码来源:Canvas.cs

示例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();
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:13,代码来源:Shapes.cs

示例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();
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:14,代码来源:Text.cs

示例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 ();

		}
开发者ID:halleyxu,项目名称:monodevelop,代码行数:14,代码来源:MessageBubbleTextMarker_IconBar.cs


注:本文中的Cairo.Restore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。