本文整理汇总了C#中PaintDotNet.Surface.CreateWindow方法的典型用法代码示例。如果您正苦于以下问题:C# Surface.CreateWindow方法的具体用法?C# Surface.CreateWindow怎么用?C# Surface.CreateWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PaintDotNet.Surface
的用法示例。
在下文中一共展示了Surface.CreateWindow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlacedSurface
public PlacedSurface(Surface source, Rectangle roi)
{
where = roi.Location;
Surface window = source.CreateWindow(roi);
what = new Surface(window.Size);
what.CopySurface(window);
window.Dispose();
}
示例2: Main
//.........这里部分代码省略.........
1,
new UnfocusEffect(),
new AmountEffectConfigToken(i),
surface));
}
benchmarks.Add(
new EffectBenchmark(
"Motion Blur, Horizontal",
1,
new MotionBlurEffect(),
new MotionBlurEffectConfigToken(0, 100, true),
surface));
benchmarks.Add(
new EffectBenchmark(
"Motion Blur, Vertical",
1,
new MotionBlurEffect(),
new MotionBlurEffectConfigToken(90, 100, true),
surface));
#endif
Surface dst = new Surface(surface.Width * 4, surface.Height * 4);
#if RESIZE
// Resize benchmarks
for (int i = 1; i < 8; i += 2)
{
int newWidth = i * (dst.Width / 8);
int newHeight = i * (dst.Height / 8);
Surface dstWindow = dst.CreateWindow(new Rectangle(0, 0, newWidth, newHeight));
benchmarks.Add(new ResizeBenchmark("Resize from " + surface.Width + "x" + surface.Height + " to " + newWidth + "x" + newHeight, surface, dstWindow));
benchmarks.Add(new ResizeBenchmark("Resize from " + newWidth + "x" + newHeight + " to " + surface.Width + "x" + surface.Height, dstWindow, surface));
}
#endif
#if GRADIENT
// Gradient benchmarks
benchmarks.Add(new GradientBenchmark(
"Linear reflected gradient @ " + dst.Width + "x" + dst.Height + " (5x)",
dst,
new GradientRenderers.LinearReflected(false, new UserBlendOps.NormalBlendOp()),
2));
benchmarks.Add(new GradientBenchmark(
"Conical gradient @ " + dst.Width + "x" + dst.Height + " (5x)",
dst,
new GradientRenderers.Conical(false, new UserBlendOps.NormalBlendOp()),
2));
benchmarks.Add(new GradientBenchmark(
"Radial gradient @ " + dst.Width + "x" + dst.Height + " (5x)",
dst,
new GradientRenderers.Radial(false, new UserBlendOps.NormalBlendOp()),
2));
#endif
#if COMPOSITION
// Composition benchmarks
Document doc1 = new Document(surface.Size);
BitmapLayer layer1 = Layer.CreateBackgroundLayer(doc1.Width, doc1.Height);
layer1.Surface.CopySurface(surface);
doc1.Layers.Add(layer1);
示例3: CopySurface
/// <summary>
/// Copies the contents of the given surface to the upper left of this surface.
/// </summary>
/// <param name="source">The surface to copy pixels from.</param>
/// <param name="sourceRoi">
/// The region of the source to copy from. The upper left of this rectangle
/// will be mapped to (0,0) on this surface.
/// The source surface does not need to have the same dimensions as this surface. Clipping
/// will be handled automatically. No resizing will be done.
/// </param>
public void CopySurface(Surface source, Rectangle sourceRoi)
{
if (disposed)
{
throw new ObjectDisposedException("Surface");
}
sourceRoi.Intersect(source.Bounds);
int copiedWidth = Math.Min(this.width, sourceRoi.Width);
int copiedHeight = Math.Min(this.Height, sourceRoi.Height);
if (copiedWidth == 0 || copiedHeight == 0)
{
return;
}
using (Surface src = source.CreateWindow(sourceRoi))
{
CopySurface(src);
}
}