/// <summary> /// Causes a portion of the layer surface to be invalidated. /// </summary> /// <param name="roi">The region of interest to be invalidated.</param> public void Invalidate(GeometryRegion roi) { foreach (Rectangle rect in roi.GetRegionScansReadOnlyInt()) { Invalidate(rect); } }
public void Invert(GeometryRegion region) { foreach (Rectangle rect in region.GetRegionScansReadOnlyInt()) { Invert(rect); } }
public void UnsafeSet(GeometryRegion region, bool newValue) { foreach (Rectangle rect in region.GetRegionScansReadOnlyInt()) { UnsafeSet(rect, newValue); } }
/// <summary> /// Causes the layer to render a given region of interest (roi) to the given destination surface. /// </summary> /// <param name="args">Contains information about which objects to use for rendering</param> /// <param name="roi">The region to be rendered.</param> public void Render(RenderArgs args, GeometryRegion roi) { Rectangle roiBounds = roi.GetBoundsInt(); if (!IsInBounds(roiBounds)) { throw new ArgumentOutOfRangeException("roi"); } Rectangle[] rects = roi.GetRegionScansReadOnlyInt(); RenderImpl(args, rects); }
protected override void OnPaint(PaintEventArgs e) { if (this._surface != null) { GeometryRegion clipRegion = null; Rectangle[] rects = this._realUpdateRects; if (rects == null) { clipRegion = new GeometryRegion(e.Graphics.Clip, true); clipRegion.Intersect(e.ClipRectangle); rects = clipRegion.GetRegionScansReadOnlyInt(); } if (this._justPaintWhite > 0) { PtnGraphics.FillRectangles(e.Graphics, Color.White, rects); } else { foreach (Rectangle rect in rects) { if (e.Graphics.IsVisible(rect)) { var drawArg = new DrawArgs(e.Graphics, rect); Draw(drawArg); } } } if (clipRegion != null) { clipRegion.Dispose(); } } if (this._justPaintWhite > 0) { --this._justPaintWhite; } base.OnPaint(e); }
public void Apply(Surface surface, GeometryRegion roi) { Apply(surface, roi.GetRegionScansReadOnlyInt()); }
/// <summary> /// Allows you to find the bounding box for a Region object without requiring /// the presence of a Graphics object. /// (Region.GetBounds takes a Graphics instance as its only parameter.) /// </summary> /// <param name="region">The region you want to find a bounding box for.</param> /// <returns>A RectangleF structure that surrounds the Region.</returns> public static Rectangle GetRegionBounds(GeometryRegion region) { Rectangle[] rects = region.GetRegionScansReadOnlyInt(); return(GetRegionBounds(rects, 0, rects.Length)); }