当前位置: 首页>>代码示例>>C#>>正文


C# Surface.SuperSamplingFitSurface方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:herbqiao,项目名称:paint.net,代码行数:29,代码来源:DocumentView.cs

示例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;
        }
开发者ID:herbqiao,项目名称:paint.net,代码行数:17,代码来源:BitmapLayer.cs

示例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;
                    }
                }
开发者ID:herbqiao,项目名称:paint.net,代码行数:67,代码来源:DocumentWorkspace.cs


注:本文中的PaintDotNet.Surface.SuperSamplingFitSurface方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。