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


C# Cairo.Rectangle方法代码示例

本文整理汇总了C#中Cairo.Rectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.Rectangle方法的具体用法?C# Cairo.Rectangle怎么用?C# Cairo.Rectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cairo的用法示例。


在下文中一共展示了Cairo.Rectangle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: DrawPaper

 protected void DrawPaper(Cairo.Context cr, double x, double y, double w, double h)
 {
     // make the background white with a line around
     cr.Rectangle(x+shadowOffset*2,y+shadowOffset*2,w-shadowOffset*2,h-shadowOffset*2);
     cr.Color = shadowColor;
     cr.Fill();
     GetInnerRegion(ref x,ref y,ref w,ref h);
     cr.Rectangle(x,y,w,h);
     cr.Color  = new Cairo.Color(0, 0, 0);
     cr.StrokePreserve();
     cr.Color  = new Cairo.Color(1, 1, 1);
     cr.Fill();
 }
开发者ID:konne88,项目名称:MyInventory,代码行数:13,代码来源:PaperPreview.cs

示例3: draw

	static void draw (Cairo.Context gr, int width, int height)
	{
		gr.Scale (width, height);
		gr.LineWidth = 0.04;
		LinearGradient pat;		
		
		pat = new LinearGradient (0.0, 0.0,  0.0, 1.0);
		pat.AddColorStop (1, new Color (0, 0, 0, 1) );
		pat.AddColorStop (0, new Color (1, 1, 1, 1) );
		gr.Rectangle ( new PointD (0, 0),
			       1, 1
			       );
		
		gr.Pattern =  pat;
		gr.Fill ();
		pat.Destroy ();

		RadialGradient pat2 = new RadialGradient (0.45, 0.4, 0.1,
				     0.4,  0.4, 0.5);
		
		pat2.AddColorStop (0, new Color (1, 1, 1, 1) );
		pat2.AddColorStop (1, new Color (0, 0, 0, 1) );
		gr.Pattern =  pat2;
		gr.Arc (0.5, 0.5, 0.3, 0, 2 * M_PI);
		gr.Fill ();
		pat2.Destroy ();
	}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:27,代码来源:gradient.cs

示例4: ClippedRender

        protected override void ClippedRender (Cairo.Context cr)
        {
            Brush brush = Background;
            if (!brush.IsValid) {
                return;
            }

            double x = Double.IsNaN (brush.Width)
                ? 0
                : (RenderSize.Width - brush.Width) * XAlign;

            double y = Double.IsNaN (brush.Height)
                ? 0
                : (RenderSize.Height - brush.Height) * YAlign;

            cr.Rectangle (0, 0, RenderSize.Width, RenderSize.Height);
            cr.ClipPreserve ();

            if (x != 0 || y != 0) {
                cr.Translate (x, y);
            }

            cr.Antialias = Cairo.Antialias.None;
            brush.Apply (cr);
            cr.Fill ();
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:26,代码来源:Image.cs

示例5: Fill

 public static void Fill(Cairo.Context context, int width, int height, Cairo.Color color)
 {
     context.NewPath();
     context.Color = color;
     context.Rectangle(0, 0, width, height);
     context.Fill();
 }
开发者ID:bvssvni,项目名称:csharp-utils,代码行数:7,代码来源:CairoFillModule.cs

示例6: draw

	static void draw (Cairo.Context gr, int width, int height)
	{
		int w, h;
		ImageSurface image;
		
		gr.Scale (width, height);
		gr.LineWidth = 0.04;
		
		gr.Arc (0.5, 0.5, 0.3, 0, 2*M_PI);
		gr.Clip ();
		gr.NewPath ();
		
		image = new ImageSurface("data/e.png");
		w = image.Width;
		h = image.Height;
		
		gr.Scale (1.0/w, 1.0/h);
		
		image.Show (gr, 0, 0);
		
		image.Destroy();
		
		gr.Arc (0.5, 0.5, 0.3, 0, 2 * M_PI);
		gr.Clip ();
		
		gr.NewPath ();
		gr.Rectangle (new PointD (0, 0), 1, 1);
		gr.Fill ();
		gr.Color = new Color (0, 1, 0, 1);
		gr.MoveTo ( new PointD (0, 0) );
		gr.LineTo ( new PointD (1, 1) );
		gr.MoveTo ( new PointD (1, 0) );
		gr.LineTo ( new PointD (0, 1) );
		gr.Stroke ();
	}
开发者ID:nlhepler,项目名称:mono,代码行数:35,代码来源:clip_img.cs

示例7: OnDrawn

        protected override bool OnDrawn(Cairo.Context cr)
        {
            double step_width = Allocation.Width / (double)steps;
            double step_height = Allocation.Height / (double)steps;
            double h = 1.0;
            double s = 0.0;

            for (int xi = 0, i = 0; xi < steps; xi++) {
                for (int yi = 0; yi < steps; yi++, i++) {
                    double bg_b = (double)(i / 255.0);
                    double fg_b = 1.0 - bg_b;

                    double x = xi * step_width;
                    double y = yi * step_height;

                    cr.Rectangle (x, y, step_width, step_height);
                    cr.Color = CairoExtensions.ColorFromHsb (h, s, bg_b);
                    cr.Fill ();

                    int tw, th;
                    Pango.Layout layout = new Pango.Layout (PangoContext);
                    layout.SetText (((int)(bg_b * 255.0)).ToString ());
                    layout.GetPixelSize (out tw, out th);

                    cr.Translate (0.5, 0.5);
                    cr.MoveTo (x + (step_width - tw) / 2.0, y + (step_height - th) / 2.0);
                    cr.Color = CairoExtensions.ColorFromHsb (h, s, fg_b);
                    PangoCairoHelper.ShowLayout (cr, layout);
                    cr.Translate (-0.5, -0.5);
                }
            }

            return true;
        }
开发者ID:knocte,项目名称:hyena,代码行数:34,代码来源:ShadingTestWindow.cs

示例8: OnDrawn

		protected override bool OnDrawn(Cairo.Context cr)
		{
			bool ret = true;
			var rect = this.Allocation;
			if (rect.Width > 0 && rect.Height > 0)
			{
				var arrowWidth = popupButton.Allocation.Width;
				var arrowPos = rect.Width - arrowWidth;
				var arrowSize = 10;

				StyleContext.Save();
				StyleContext.AddClass("entry");
				StyleContext.RenderBackground(cr, 0, 0, rect.Width, rect.Height);

				ret = base.OnDrawn(cr);

				StyleContext.RenderArrow(cr, Math.PI, arrowPos, (rect.Height - arrowSize) / 2, arrowSize);

				cr.SetSourceColor(new Cairo.Color(.8, .8, .8));
				cr.Rectangle(arrowPos - 5, 2, 1, rect.Height - 4);
				cr.Fill();

				Entry.StyleContext.RenderFrame(cr, 0, 0, rect.Width, rect.Height);
				StyleContext.Restore();

			}
			return ret;
		}
开发者ID:mhusen,项目名称:Eto,代码行数:28,代码来源:BaseComboBox.cs

示例9:

		bool IFoldMarginMarker.DrawBackground (TextEditor e, double marginWidth, Cairo.Context cr, Cairo.Rectangle area, DocumentLine documentLine, int line, double x, double y, double lineHeight)
		{
			if (cache.CurrentSelectedTextMarker != null && cache.CurrentSelectedTextMarker != this)
				return false;
			cr.Rectangle (x, y, marginWidth, lineHeight);
			cr.Color = LineColor.Color;
			cr.Fill ();
			return true;
		}
开发者ID:halleyxu,项目名称:monodevelop,代码行数:9,代码来源:MessageBubbleTextMarker_FoldMarker.cs

示例10: DrawBackground

		public override bool DrawBackground (MonoTextEditor editor, Cairo.Context cr, LineMetrics metrics)
		{
			if (metrics.SelectionStart > 0)
				return true;
			cr.SetSourceColor (color);
			cr.Rectangle (metrics.TextRenderStartPosition, metrics.LineYRenderStartPosition, metrics.TextRenderEndPosition - metrics.TextRenderStartPosition, editor.LineHeight);
			cr.Fill ();
			return true;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:9,代码来源:LineBackgroundMarker.cs

示例11: BasicDraw

        public override void BasicDraw(Cairo.Context context)
        {
            context.Rectangle(DisplayBox.X, DisplayBox.Y,
                              DisplayBox.Width, DisplayBox.Height);

            context.Stroke();

            classname.BasicDraw(context);
        }
开发者ID:mono,项目名称:monohotdraw,代码行数:9,代码来源:ClassFigure.cs

示例12: DrawBackground

		public override bool DrawBackground (TextEditor editor, Cairo.Context cr, double y, LineMetrics metrics)
		{
			if (metrics.SelectionStart > 0)
				return true;
			cr.Color = color;
			cr.Rectangle (metrics.TextRenderStartPosition, y, metrics.TextRenderEndPosition - metrics.TextRenderStartPosition, editor.LineHeight);
			cr.Fill ();
			return true;
		}
开发者ID:wickedshimmy,项目名称:monodevelop,代码行数:9,代码来源:LineBackgroundMarker.cs

示例13: DrawMarginBackground

		void DrawMarginBackground (Cairo.Context cr, int line, double x, double y, double lineHeight)
		{
			if (editor.Caret.Line == line) {
				editor.TextViewMargin.DrawCaretLineMarker (cr, x, y, Width, lineHeight);
				return;
			}
			cr.Rectangle (x, y, Width, lineHeight);
			cr.SetSourceColor (editor.ColorStyle.LineNumbers.Background);
			cr.Fill ();
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:10,代码来源:ActionMargin.cs

示例14: Render

        public virtual void Render(Cairo.Context cr, Layout layout, double x, double y, double w, double h)
        {
            cr.Save();
            cr.Translate (x,y);

            // make the background white
            cr.Color  = new Cairo.Color(1, 1, 1);
            cr.Rectangle(0,0,w,h);
            cr.Fill();

            // calc some values
            int lw;
            string prefix = "INV-"+InventoryAbbreviation+"-";
            string idString = Id.ToString("0000000000");

            // basic text stuff
            layout.FontDescription = FontDescription.FromString(CalcFont(Layout,layout,h));
            layout.Width = (int)(w*Scale.PangoScale);
            layout.Alignment = Alignment.Center;

            // draw the description
            int descH = 0;
            if(Layout.UseDescription){
                Layout descLayout = layout.Copy();
                descLayout.SetText (Description);
                descLayout.GetPixelSize(out lw, out descH);
                layout.Ellipsize = EllipsizeMode.Middle;
                layout.Justify = true;
                cr.Color = new Cairo.Color(0, 0, 0);
                Pango.CairoHelper.ShowLayout (cr, descLayout);
            }

            // draw the barcode	text
            int codeH = 0;
            if(Layout.UseBarcodeText){
                Layout codeLayout = layout.Copy();
                codeLayout.SetText (prefix+idString);
                codeLayout.GetPixelSize(out lw, out codeH);
                cr.MoveTo(0,h-(double)codeH);
                cr.Color = new Cairo.Color(0, 0, 0);
                Pango.CairoHelper.ShowLayout (cr, codeLayout);
            }

            // draw the barcode
            if(Layout.UseBarcode){
                double barcodeH = h-((double)codeH+(double)descH+Layout.SpacingSize*2);
                if(barcodeH>0){
                    IBarcode bc = new Code128();
                    bc.WriteString(prefix+idString);
                    bc.WriteEnd();
                    RenderBarcode(bc,cr,0,descH+Layout.SpacingSize,w,barcodeH);
                }
            }
            cr.Restore();
        }
开发者ID:konne88,项目名称:MyInventory,代码行数:55,代码来源:LabelRenderer.cs

示例15: DrawFrame

 protected override void DrawFrame (Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor)
 {
     RectangleD rect = DisplayBox;
     rect.OffsetDot5();
     context.Rectangle(GdkCairoHelper.CairoRectangle(rect));
     context.Color = fillColor;
     context.FillPreserve();
     context.Color = lineColor;
     context.LineWidth = lineWidth;
     context.Stroke();
 }
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:11,代码来源:CompositeComponentControl.cs


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