本文整理汇总了C#中Cairo.Rectangle类的典型用法代码示例。如果您正苦于以下问题:C# Rectangle类的具体用法?C# Rectangle怎么用?C# Rectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rectangle类属于Cairo命名空间,在下文中一共展示了Rectangle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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};
}
示例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 ();
}
示例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;
}
示例8: WarpSpiral
public WarpSpiral(Rectangle rect)
{
if (rect == null)
throw new ArgumentNullException("rect");
_rect = rect;
}
示例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;
}
示例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;
}
示例11: DrawShape
protected override Rectangle DrawShape(Rectangle r, Layer l)
{
Document doc = PintaCore.Workspace.ActiveDocument;
doc.Selection.CreateEllipseSelection(l.Surface, r);
return r;
}
示例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};
}
示例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);
}
示例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 ();
}
示例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 ();
}