當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。