本文整理汇总了C#中PaintDotNet.PdnRegion.GetRegionScansReadOnlyInt方法的典型用法代码示例。如果您正苦于以下问题:C# PdnRegion.GetRegionScansReadOnlyInt方法的具体用法?C# PdnRegion.GetRegionScansReadOnlyInt怎么用?C# PdnRegion.GetRegionScansReadOnlyInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PaintDotNet.PdnRegion
的用法示例。
在下文中一共展示了PdnRegion.GetRegionScansReadOnlyInt方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Invert
public void Invert(PdnRegion region)
{
foreach (Rectangle rect in region.GetRegionScansReadOnlyInt())
{
Invert(rect);
}
}
示例2: Set
public void Set(PdnRegion region, bool newValue)
{
foreach (Rectangle rect in region.GetRegionScansReadOnlyInt())
{
Set(rect, newValue);
}
}
示例3: Apply
public void Apply(Surface surface, PdnRegion roi)
{
Apply(surface, roi.GetRegionScansReadOnlyInt());
}
示例4: Invalidate
/// <summary>
/// Invalidates a portion of the document. The given region is then tagged
/// for rerendering during the next call to Update.
/// </summary>
/// <param name="roi">The region of interest to be invalidated.</param>
public void Invalidate(PdnRegion roi)
{
Dirty = true;
foreach (Rectangle rect in roi.GetRegionScansReadOnlyInt())
{
rect.Intersect(this.Bounds);
updateRegion.Add(rect);
if (!rect.IsEmpty)
{
InvalidateEventArgs iea = new InvalidateEventArgs(rect);
OnInvalidated(iea);
}
}
}
示例5: OnPaint
protected override void OnPaint(PaintEventArgs e)
{
if (this.surface != null)
{
PdnRegion clipRegion = null;
Rectangle[] rects = this.realUpdateRects;
if (rects == null)
{
clipRegion = new PdnRegion(e.Graphics.Clip, true);
clipRegion.Intersect(e.ClipRectangle);
rects = clipRegion.GetRegionScansReadOnlyInt();
}
if (this.justPaintWhite > 0)
{
PdnGraphics.FillRectangles(e.Graphics, Color.White, rects);
}
else
{
foreach (Rectangle rect in rects)
{
if (e.Graphics.IsVisible(rect))
{
PaintEventArgs2 e2 = new PaintEventArgs2(e.Graphics, rect);
OnPaintImpl(e2);
}
}
}
if (clipRegion != null)
{
clipRegion.Dispose();
clipRegion = null;
}
}
if (this.justPaintWhite > 0)
{
--this.justPaintWhite;
}
base.OnPaint(e);
}
示例6: UpdateHistogram
public void UpdateHistogram(Surface surface, PdnRegion roi)
{
Clear();
foreach (Rectangle rect in roi.GetRegionScansReadOnlyInt())
{
AddSurfaceRectangleToHistogram(surface, rect);
}
OnHistogramUpdated();
}
示例7: FromRegion
public static PdnGraphicsPath FromRegion(PdnRegion region)
{
Rectangle[] scans = region.GetRegionScansReadOnlyInt();
if (scans.Length == 1)
{
PdnGraphicsPath path = new PdnGraphicsPath();
path.AddRectangle(scans[0]);
path.CloseFigure();
return path;
}
else
{
Rectangle bounds = region.GetBoundsInt();
BitVector2D stencil = new BitVector2D(bounds.Width, bounds.Height);
for (int i = 0; i < scans.Length; ++i)
{
Rectangle rect = scans[i];
rect.X -= bounds.X;
rect.Y -= bounds.Y;
stencil.SetUnchecked(rect, true);
}
PdnGraphicsPath path = PathFromStencil(stencil, new Rectangle(0, 0, stencil.Width, stencil.Height));
using (Matrix matrix = new Matrix())
{
matrix.Reset();
matrix.Translate(bounds.X, bounds.Y);
path.Transform(matrix);
}
return path;
}
}
示例8: FromRegions
public static PdnGraphicsPath FromRegions(PdnRegion lhs, CombineMode combineMode, PdnRegion rhs)
{
Rectangle lhsBounds = lhs.GetBoundsInt();
Rectangle rhsBounds = rhs.GetBoundsInt();
int left = Math.Min(lhsBounds.Left, rhsBounds.Left);
int top = Math.Min(lhsBounds.Top, rhsBounds.Top);
int right = Math.Max(lhsBounds.Right, rhsBounds.Right);
int bottom = Math.Max(lhsBounds.Bottom, rhsBounds.Bottom);
Rectangle bounds = Rectangle.FromLTRB(left, top, right, bottom);
BitVector2D stencil = new BitVector2D(bounds.Width, bounds.Height);
Rectangle[] lhsScans = lhs.GetRegionScansReadOnlyInt();
Rectangle[] rhsScans = rhs.GetRegionScansReadOnlyInt();
switch (combineMode)
{
case CombineMode.Complement:
case CombineMode.Intersect:
case CombineMode.Replace:
throw new ArgumentException("combineMode can't be Complement, Intersect, or Replace");
default:
break;
}
for (int i = 0; i < lhsScans.Length; ++i)
{
Rectangle rect = lhsScans[i];
rect.X -= bounds.X;
rect.Y -= bounds.Y;
stencil.SetUnchecked(rect, true);
}
for (int i = 0; i < rhsScans.Length; ++i)
{
Rectangle rect = rhsScans[i];
rect.X -= bounds.X;
rect.Y -= bounds.Y;
switch (combineMode)
{
case CombineMode.Xor:
stencil.InvertUnchecked(rect);
break;
case CombineMode.Union:
stencil.SetUnchecked(rect, true);
break;
case CombineMode.Exclude:
stencil.SetUnchecked(rect, false);
break;
}
}
PdnGraphicsPath path = PathFromStencil(stencil, new Rectangle(0, 0, stencil.Width, stencil.Height));
using (Matrix matrix = new Matrix())
{
matrix.Reset();
matrix.Translate(bounds.X, bounds.Y);
path.Transform(matrix);
}
return path;
}
示例9: Render
/// <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, PdnRegion roi)
{
Rectangle roiBounds = roi.GetBoundsInt();
if (!IsInBounds(roiBounds))
{
throw new ArgumentOutOfRangeException("roi");
}
Rectangle[] rects = roi.GetRegionScansReadOnlyInt();
RenderImpl(args, rects);
}
示例10: Invalidate
/// <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(PdnRegion roi)
{
foreach (Rectangle rect in roi.GetRegionScansReadOnlyInt())
{
Invalidate(rect);
}
}
示例11: CopySurface
/// <summary>
/// Copies a region of the given surface to this surface.
/// </summary>
/// <param name="source">The surface to copy pixels from.</param>
/// <param name="region">The region to clip copying to.</param>
/// <remarks>
/// The upper left corner of the source surface will be mapped to the upper left of this
/// surface, and only those pixels that are defined by the region will be copied.
/// The source surface does not need to have the same dimensions as this surface. Clipping
/// will be handled automatically. No resizing will be done.
/// </remarks>
public void CopySurface(Surface source, PdnRegion region)
{
if (disposed)
{
throw new ObjectDisposedException("Surface");
}
Rectangle[] scans = region.GetRegionScansReadOnlyInt();
for (int i = 0; i < scans.Length; ++i)
{
Rectangle rect = scans[i];
rect.Intersect(this.Bounds);
rect.Intersect(source.Bounds);
if (rect.Width == 0 || rect.Height == 0)
{
continue;
}
unsafe
{
for (int y = rect.Top; y < rect.Bottom; ++y)
{
ColorBgra *dst = this.GetPointAddressUnchecked(rect.Left, y);
ColorBgra *src = source.GetPointAddressUnchecked(rect.Left, y);
Memory.Copy(dst, src, (ulong)rect.Width * (ulong)ColorBgra.SizeOf);
}
}
}
}
示例12: Clear
public void Clear(PdnRegion region, ColorBgra color)
{
foreach (Rectangle rect in region.GetRegionScansReadOnlyInt())
{
Clear(rect, color);
}
}
示例13: RenderGradient
private void RenderGradient(Surface surface, PdnRegion clipRegion, CompositingMode compositingMode,
PointF startPointF, ColorBgra startColor, PointF endPointF, ColorBgra endColor)
{
GradientRenderer gr = AppEnvironment.GradientInfo.CreateGradientRenderer();
gr.StartColor = startColor;
gr.EndColor = endColor;
gr.StartPoint = startPointF;
gr.EndPoint = endPointF;
gr.AlphaBlending = (compositingMode == CompositingMode.SourceOver);
gr.BeforeRender();
Rectangle[] oldRois = clipRegion.GetRegionScansReadOnlyInt();
Rectangle[] newRois;
if (oldRois.Length == 1)
{
newRois = new Rectangle[Processor.LogicalCpuCount];
Utility.SplitRectangle(oldRois[0], newRois);
}
else
{
newRois = oldRois;
}
RenderContext rc = new RenderContext();
rc.surface = surface;
rc.rois = newRois;
rc.renderer = gr;
WaitCallback wc = new WaitCallback(rc.Render);
for (int i = 0; i < Processor.LogicalCpuCount; ++i)
{
if (i == Processor.LogicalCpuCount - 1)
{
wc(BoxedConstants.GetInt32(i));
}
else
{
PaintDotNet.Threading.ThreadPool.Global.QueueUserWorkItem(wc, BoxedConstants.GetInt32(i));
}
}
PaintDotNet.Threading.ThreadPool.Global.Drain();
}