本文整理汇总了C#中PaintDotNet.Surface.SuperSamplingFitSurface方法的典型用法代码示例。如果您正苦于以下问题:C# Surface.SuperSamplingFitSurface方法的具体用法?C# Surface.SuperSamplingFitSurface怎么用?C# Surface.SuperSamplingFitSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PaintDotNet.Surface
的用法示例。
在下文中一共展示了Surface.SuperSamplingFitSurface方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderCompositionTo
protected void RenderCompositionTo(Surface dst, bool highQuality, bool forceUpToDate)
{
if (forceUpToDate)
{
UpdateComposition(false);
}
if (dst.Width == this.compositionSurface.Width &&
dst.Height == this.compositionSurface.Height)
{
dst.ClearWithCheckboardPattern();
new UserBlendOps.NormalBlendOp().Apply(dst, this.compositionSurface);
}
else if (highQuality)
{
Surface thumb = new Surface(dst.Size);
thumb.SuperSamplingFitSurface(this.compositionSurface);
dst.ClearWithCheckboardPattern();
new UserBlendOps.NormalBlendOp().Apply(dst, thumb);
thumb.Dispose();
}
else
{
this.surfaceBox.RenderTo(dst);
}
}
示例2: RenderThumbnail
public override Surface RenderThumbnail(int maxEdgeLength)
{
Size thumbSize = Utility.ComputeThumbnailSize(this.Size, maxEdgeLength);
Surface thumb = new Surface(thumbSize);
thumb.SuperSamplingFitSurface(this.surface);
Surface thumb2 = new Surface(thumbSize);
thumb2.ClearWithCheckboardPattern();
UserBlendOps.NormalBlendOp nbop = new UserBlendOps.NormalBlendOp();
nbop.Apply(thumb2, thumb);
thumb.Dispose();
thumb = null;
return thumb2;
}
示例3: DoSave
//.........这里部分代码省略.........
{
using (new WaitCursorChanger(this))
{
Utility.GCFullCollect();
const int maxDim = 256;
Surface thumb;
Surface flattened = BorrowScratchSurface(this.GetType().Name + ".DoSave() preparing embedded thumbnail");
try
{
Document.Flatten(flattened);
if (Document.Width > maxDim || Document.Height > maxDim)
{
int width;
int height;
if (Document.Width > Document.Height)
{
width = maxDim;
height = (Document.Height * maxDim) / Document.Width;
}
else
{
height = maxDim;
width = (Document.Width * maxDim) / Document.Height;
}
int thumbWidth = Math.Max(1, width);
int thumbHeight = Math.Max(1, height);
thumb = new Surface(thumbWidth, thumbHeight);
thumb.SuperSamplingFitSurface(flattened);
}
else
{
thumb = new Surface(flattened.Size);
thumb.CopySurface(flattened);
}
}
finally
{
ReturnScratchSurface(flattened);
}
Document thumbDoc = new Document(thumb.Width, thumb.Height);
BitmapLayer thumbLayer = new BitmapLayer(thumb);
BitmapLayer backLayer = new BitmapLayer(thumb.Width, thumb.Height);
backLayer.Surface.Clear(ColorBgra.Transparent);
thumb.Dispose();
thumbDoc.Layers.Add(backLayer);
thumbDoc.Layers.Add(thumbLayer);
MemoryStream thumbPng = new MemoryStream();
PropertyBasedSaveConfigToken pngToken = PdnFileTypes.Png.CreateDefaultSaveConfigToken();
PdnFileTypes.Png.Save(thumbDoc, thumbPng, pngToken, null, null, false);
byte[] thumbBytes = thumbPng.ToArray();
string thumbString = Convert.ToBase64String(thumbBytes, Base64FormattingOptions.None);
thumbDoc.Dispose();
string thumbXml = "<thumb png=\"" + thumbString + "\" />";
Document.CustomHeaders = thumbXml;
}
}