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


C# Surface.FitSurface方法代码示例

本文整理汇总了C#中PaintDotNet.Surface.FitSurface方法的典型用法代码示例。如果您正苦于以下问题:C# Surface.FitSurface方法的具体用法?C# Surface.FitSurface怎么用?C# Surface.FitSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PaintDotNet.Surface的用法示例。


在下文中一共展示了Surface.FitSurface方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: resize

 private static BitmapEx resize(Bitmap bitmap, int width, int height, Rectangle? clipRectangle)
 {
     using (var src = Surface.CopyFromBitmap(bitmap))
     {
         var dest = new Surface(width, height);
         BitmapEx res = new BitmapEx();
         res.surface = dest;
         dest.FitSurface(ResamplingAlgorithm.SuperSampling, src);
         if (clipRectangle == null)
             res.Bitmap = dest.CreateAliasedBitmap();
         else
             res.Bitmap = dest.CreateAliasedBitmap(clipRectangle.Value);
         return res;
     }
 }
开发者ID:BackupTheBerlios,项目名称:molecule-svn,代码行数:15,代码来源:BitmapExtensions.cs

示例2: OnSetRenderInfo

        protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
        {
            Rectangle selection = EnvironmentParameters.GetSelection(srcArgs.Surface.Bounds).GetBoundsInt();

            Surface selectionSurface = new Surface(selection.Width, selection.Height);
            selectionSurface.CopySurface(srcArgs.Surface, selection);

            Surface stretchedSurface = new Surface(selection.Width * 2, selection.Height);
            stretchedSurface.FitSurface(ResamplingAlgorithm.Bicubic, selectionSurface);

            processedSurface = new Surface(srcArgs.Surface.Size);

            ColorBgra t;
            for (int y = 0; y < stretchedSurface.Height; y++)
            {
                if (IsCancelRequested) return;
                int v = selection.Left;
                for (int x = 0; x < stretchedSurface.Width; x += 2)
                {
                    if (x % 2 == 0)
                    {
                        t.R = stretchedSurface[x, y].R;
                        t.G = stretchedSurface[x + 1, y].G;
                        if (x != stretchedSurface.Width - 2)
                        {
                            t.B = stretchedSurface[x + 2, y].B;
                        }
                        else
                        {
                            t.B = (byte)((stretchedSurface[stretchedSurface.Width - 1, y].B + stretchedSurface[stretchedSurface.Width - 2, y].B) >> 1);
                        }
                        processedSurface[v, y + selection.Top] = ColorBgra.FromBgr(t.B, t.G, t.R);
                        v++;
                    }
                }
            }

            base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
        }
开发者ID:toehead2001,项目名称:pdn-sublcd,代码行数:39,代码来源:SubLCD.cs


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