• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Cairo.Rectangle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: DrawRectangle

		// Most of these functions return an affected area
		// This can be ignored if you don't need it
		
		#region context
		public static Rectangle DrawRectangle (this Context g, Rectangle r, Color color, int lineWidth)
		{
			// Put it on a pixel line
			if (lineWidth == 1)
				r = new Rectangle (r.X - 0.5, r.Y - 0.5, r.Width, r.Height);
			
			g.Save ();
			
			g.MoveTo (r.X, r.Y);
			g.LineTo (r.X + r.Width, r.Y);
			g.LineTo (r.X + r.Width, r.Y + r.Height);
			g.LineTo (r.X, r.Y + r.Height);
			g.LineTo (r.X, r.Y);
			
			g.Color = color;
			g.LineWidth = lineWidth;
			g.LineCap = LineCap.Square;
			
			Rectangle dirty = g.StrokeExtents ();
			g.Stroke ();
			
			g.Restore ();
			
			return dirty;
		}
开发者ID:myersBR,项目名称:My-FyiReporting,代码行数:29,代码来源:CairoExtensions.cs


示例2: Contains

        /// <summary>
        /// Determines whether the inner rectangle is completely inside the outer one.
        /// </summary>
        /// <param name="outerRectangle">The rectangle.</param>
        /// <param name="innerRectangle">The inner rectangle.</param>
        /// <returns>
        ///   <c>true</c> if [contains] [the specified rectangle]; otherwise, <c>false</c>.
        /// </returns>
        public static bool Contains(
			this Rectangle outerRectangle,
			Rectangle innerRectangle)
        {
            // If the inner rectangle starts outside of the outer, then return false.
            if (outerRectangle.X > innerRectangle.X
                || outerRectangle.Y > innerRectangle.Y)
            {
                return false;
            }

            // Make sure the right and bottom sides are within the outer.
            double innerRight = innerRectangle.X + innerRectangle.Width;
            double outerRight = outerRectangle.X + outerRectangle.Width;
            double innerBottom = innerRectangle.Y + innerRectangle.Height;
            double outerBottom = outerRectangle.Y + outerRectangle.Height;

            if (innerRight > outerRight
                || innerBottom > outerBottom)
            {
                return false;
            }

            // At this point, the inner rectangle is completely inside the outer.
            return true;
        }
开发者ID:dmoonfire,项目名称:mfgames-gtkext-cil,代码行数:34,代码来源:CairoRectangleExtensions.cs


示例3: ImageView

 public ImageView(MonoReports.Model.Controls.Image image,ImageRenderer renderer, SectionView parentSection)
     : base(image)
 {
     this.ParentSection = parentSection;
     AbsoluteBound = new Rectangle (parentSection.AbsoluteDrawingStartPoint.X + image.Location.X, parentSection.AbsoluteDrawingStartPoint.Y + image.Location.Y, image.Width, image.Height);
     ImageRenderer = renderer;
 }
开发者ID:elsupergomez,项目名称:monoreports,代码行数:7,代码来源:ImageView.cs


示例4: DrawShape

        protected override Rectangle DrawShape(Rectangle rect, Layer l)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            Rectangle dirty;

            using (Context g = new Context (l.Surface)) {
                g.AppendPath (doc.Selection.SelectionPath);
                g.FillRule = FillRule.EvenOdd;
                g.Clip ();

                g.Antialias = UseAntialiasing ? Antialias.Subpixel : Antialias.None;

                dirty = rect;

                if (FillShape && StrokeShape)
                    dirty = g.FillStrokedEllipse (rect, fill_color, outline_color, BrushWidth);
                else if (FillShape)
                    dirty = g.FillEllipse (rect, outline_color);
                else
                    dirty = g.DrawEllipse (rect, outline_color, BrushWidth);
            }

            return dirty;
        }
开发者ID:JoeyScarr,项目名称:Pinta,代码行数:25,代码来源:EllipseTool.cs


示例5: ImageView

 public ImageView(MonoReports.Model.Controls.Image image, SectionView parentSection, PixbufRepository pixbufRepository)
     : base(image)
 {
     this.ParentSection = parentSection;
     AbsoluteBound = new Rectangle (parentSection.AbsoluteDrawingStartPoint.X + image.Location.X, parentSection.AbsoluteDrawingStartPoint.Y + image.Location.Y, image.Width, image.Height);
     ImageRenderer = new ImageRenderer(){ PixbufRepository = pixbufRepository, DesignMode = true};
 }
开发者ID:modesto,项目名称:monoreports,代码行数:7,代码来源:ImageView.cs


示例6: OnMouseMove

        protected override Gdk.Rectangle OnMouseMove(int x, int y, int lastX, int lastY)
        {
            int size = Random.Next (2, (int)G.LineWidth);
            Rectangle r = new Rectangle (x - Random.Next (-15, 15), y - Random.Next (-15, 15), size, size);

            double rx = r.Width / 2;
            double ry = r.Height / 2;
            double cx = r.X + rx;
            double cy = r.Y + ry;
            double c1 = 0.552285;

            G.Save ();

            G.MoveTo (cx + rx, cy);

            G.CurveTo (cx + rx, cy - c1 * ry, cx + c1 * rx, cy - ry, cx, cy - ry);
            G.CurveTo (cx - c1 * rx, cy - ry, cx - rx, cy - c1 * ry, cx - rx, cy);
            G.CurveTo (cx - rx, cy + c1 * ry, cx - c1 * rx, cy + ry, cx, cy + ry);
            G.CurveTo (cx + c1 * rx, cy + ry, cx + rx, cy + c1 * ry, cx + rx, cy);

            G.ClosePath ();

            Rectangle dirty = G.StrokeExtents ();

            G.Fill ();
            G.Restore ();

            return dirty.ToGdkRectangle ();
        }
开发者ID:rolandixor,项目名称:Pinta,代码行数:29,代码来源:SplatterBrush.cs


示例7: OnExposeEvent

        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            using (Context cg = Gdk.CairoHelper.Create (args.Window))
            {
                Win32GDI GDI_Win32 = Win32GDI.getInstance();

                if (GDI_Win32.isAvailable())
                {
                    System.Drawing.Graphics wg = Gtk.DotNet.Graphics.FromDrawable(this.GdkWindow, true);
                    IntPtr hdc = wg.GetHdc();

                    int i = 0;
                    int n = 3;
                    int w = 16;
                    int h = 16;

                    Rect[] rects = new Rect[n];

                    /* Test Case 1 */
                    rects[i].x1 = 0;
                    rects[i].y1 = 0;
                    rects[i].x2 = w;
                    rects[i].y2 = h;
                    i++;

                    /* Test Case 2 */
                    rects[i].x1 = w * i + 3;
                    rects[i].y1 = 0;
                    rects[i].x2 = w * (i + 1) - 3;
                    rects[i].y2 = h;
                    i++;

                    /* Test Case 3 */
                    rects[i].x1 = w * i;
                    rects[i].y1 = 0 + 3;
                    rects[i].x2 = w * (i + 1);
                    rects[i].y2 = h - 3;
                    i++;

                    /* Fill Area with White */
                    cg.Color = new Cairo.Color(255,255,255);
                    Cairo.Rectangle rect = new Cairo.Rectangle(0, 0, n * w, h);
                    cg.Rectangle(rect);
                    cg.Fill();
                    cg.Stroke();

                    IntPtr blackSolidBrush = GDI_Win32.CreateSolidBrush(0);
                    IntPtr oldBrush = GDI_Win32.SelectObject(hdc, blackSolidBrush);

                    for (i = 0; i < n; i++)
                    {
                        GDI_Win32.Ellipse(hdc, rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);

                        dumpText += "unsigned char ellipse_case_" + (i + 1) + "[" + w * h + "] = \n";
                        dumpText += dumpPixelArea(GDI_Win32, hdc, i * w, 0, w, h) + "\n";
                    }
                }
            }
            return true;
        }
开发者ID:awakecoding,项目名称:GdiTest,代码行数:60,代码来源:EllipseDrawingArea.cs


示例8: WarpSpiral

		public WarpSpiral(Rectangle rect)
		{
			if (rect == null)
				throw new ArgumentNullException("rect");

			_rect = rect;
		}
开发者ID:pruiz,项目名称:Mono.CairoWarp,代码行数:7,代码来源:WarpSpiral.cs


示例9: WarpCurl

		public WarpCurl(TextExtents text, Rectangle rect)
		{
			if (text == null) throw new ArgumentNullException("text");
			if (rect == null) throw new ArgumentNullException("rect");

			_rect = rect;
			_extents = text;
		}
开发者ID:pruiz,项目名称:Mono.CairoWarp,代码行数:8,代码来源:WarpCurl.cs


示例10: SubreportView

 public SubreportView(MonoReports.Model.Controls.SubReport subreport,SubreportRenderer renderer, SectionView parentSection)
     : base(subreport)
 {
     this.subreport = subreport;
     this.ParentSection = parentSection;
     AbsoluteBound = new Rectangle (parentSection.AbsoluteDrawingStartPoint.X + subreport.Location.X, parentSection.AbsoluteDrawingStartPoint.Y + subreport.Location.Y, subreport.Width, subreport.Height);
     SubreportRenderer = renderer;
 }
开发者ID:elsupergomez,项目名称:monoreports,代码行数:8,代码来源:SubreportView.cs


示例11: DrawShape

        protected override Rectangle DrawShape(Rectangle r, Layer l)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            doc.Selection.CreateEllipseSelection(l.Surface, r);

            return r;
        }
开发者ID:Kharevich,项目名称:Pinta,代码行数:8,代码来源:EllipseSelectTool.cs


示例12: TextBlockView

 public TextBlockView(TextBlock textBlock,SectionView parentSection)
     : base(textBlock)
 {
     this.ParentSection = parentSection;
     AbsoluteBound = new Rectangle (parentSection.AbsoluteDrawingStartPoint.X + textBlock.Location.X,
                                     parentSection.AbsoluteDrawingStartPoint.Y + textBlock.Location.Y, textBlock.Width, textBlock.Height);
     TextBlockRenderer = new TextBlockRenderer(){ DesignMode = true};
 }
开发者ID:modesto,项目名称:monoreports,代码行数:8,代码来源:TextBlockView.cs


示例13: DrawShape

        protected override Rectangle DrawShape(Rectangle r, Layer l)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            doc.Selection.CreateRectangleSelection(l.Surface, r);

            // Add some padding for invalidation
            return new Rectangle (r.X, r.Y, r.Width + 2, r.Height + 2);
        }
开发者ID:bodicsek,项目名称:Pinta,代码行数:9,代码来源:RectangleSelectTool.cs


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


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


示例16: DrawShape

        protected override Rectangle DrawShape(Rectangle r, Layer l)
        {
            Path path = PintaCore.Layers.SelectionPath;

            using (Context g = new Context (l.Surface))
                PintaCore.Layers.SelectionPath = g.CreateEllipsePath (r);

            (path as IDisposable).Dispose ();

            return r;
        }
开发者ID:asbjornu,项目名称:Pinta,代码行数:11,代码来源:EllipseSelectTool.cs


示例17: DrawShape

        protected override Rectangle DrawShape(Rectangle r, Layer l)
        {
            Path path = PintaCore.Layers.SelectionPath;

            using (Context g = new Context (l.Surface))
                PintaCore.Layers.SelectionPath = g.CreateRectanglePath (r);

            (path as IDisposable).Dispose ();

            // Add some padding for invalidation
            return new Rectangle (r.X, r.Y, r.Width + 2, r.Height + 2);
        }
开发者ID:xxgreg,项目名称:Pinta,代码行数:12,代码来源:RectangleSelectTool.cs


示例18: Render

        public static void Render (Context cr, Rectangle box,
            double xalign, double yalign, Color innerColor, Color outerColor)
        {
            // virtual size of the figure we will draw below on the 1:1 scale
            double original_width = 8;
            double original_height = 12;

            // figure out the scale dimensions of the bounding box and the glyph
            double box_size = Math.Min (box.Width, box.Height);
            double original_size = Math.Max (original_width, original_height);

            // create a scale for the box (ratio between virtual glyph size and the box),
            // then re-scale to account for the extra size that will be added via stroke.
            // glyph_scale is the stroke width and the actual transformation size
            double box_scale = box_size / original_size;
            double glyph_scale = Math.Floor ((box_size - box_scale) / original_size);

            // compute the alignment to the pixel grid for the stroke/scale
            double pixel_align = Math.Floor (glyph_scale + 0.5) / 2.0;

            // figure out the actual size in pixels of the glyph
            double actual_width = glyph_scale * original_width + 2 * Math.Floor (pixel_align);
            double actual_height = glyph_scale * original_height + 2 * Math.Floor (pixel_align);

            // compute the offset accounting for box, grid alignment, and figure alignment
            double tx = box.X + pixel_align + Math.Round ((box.Width - actual_width) * xalign);
            double ty = box.Y + pixel_align + Math.Round ((box.Height - actual_height) * yalign);

            // save the context, and transform the current/new context
            cr.Save ();
            cr.Translate (tx, ty);
            cr.Scale (glyph_scale, glyph_scale);

            // define how the strokes look
            cr.LineWidth = 1;
            cr.LineCap = LineCap.Round;
            cr.LineJoin = LineJoin.Round;

            // inner 'b' note
            cr.Color = innerColor;
            cr.MoveTo (0, 2);
            cr.LineTo (2, 0);
            cr.Arc (4, 8, 2, Math.PI, Math.PI * 3);
            cr.Stroke ();

            // outer 'cut' circle
            cr.Color = outerColor;
            cr.Arc (4, 8, 4, Math.PI * 1.5, Math.PI * 1.12);
            cr.Stroke ();

            cr.Restore ();
        }
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:52,代码来源:BansheeLineLogo.cs


示例19: DrawShape

        protected override Rectangle DrawShape(Rectangle r, Layer l)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            Path path = doc.SelectionPath;

            using (Context g = new Context (l.Surface))
                doc.SelectionPath = g.CreateEllipsePath (r);

            (path as IDisposable).Dispose ();

            return r;
        }
开发者ID:jobernolte,项目名称:Pinta,代码行数:13,代码来源:EllipseSelectTool.cs


示例20: CheckPoint

		private void CheckPoint (Rectangle rect, PointD point)
		{	
			if (point.X < rect.X) {
				point.X = rect.X;
			} else if (point.X > rect.X + rect.Width) {
				point.X = rect.X + rect.Width;
			}
			
			if (point.Y < rect.Y) {
				point.Y = rect.Y;
			} else if (point.Y > rect.Y + rect.Height) {
				point.Y = rect.Y + rect.Height;
			}
		}	
开发者ID:msiyer,项目名称:Pinta,代码行数:14,代码来源:HistogramWidget.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Cairo.Surface类代码示例发布时间:2022-05-24
下一篇:
C# Cairo.PointD类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap