<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                Swirl Filter Swirl 濾鏡是實現圖像圍繞中心點(cenX,cenY)扭曲旋轉的效果,效果圖如下: [![](https://box.kancloud.cn/2016-01-05_568b3325bd6f9.jpg)](http://www.zealpixel.com/data/attachment/portal/201507/22/180505r368gml8r6yzlwdu.jpg) 原圖 [![](https://box.kancloud.cn/2016-01-05_568b3325d55c9.png)](http://www.zealpixel.com/data/attachment/portal/201507/22/180503in1w3vgh3b3zhs8a.png) 效果圖 代碼如下: ~~~ /// Swirl Filter /// /// Source image. /// The X position of Swirl. /// The Y position of Swirl. /// The degree of swirl,0-360. /// The result image. private Bitmap SwirlFilterProcess(Bitmap srcBitmap, int cenX, int cenY, int swilDegree) { Bitmap a = new Bitmap(srcBitmap); int w = a.Width; int h = a.Height; int radius = 0; swilDegree = Math.Max(0, Math.Min(360, swilDegree)); double k = swilDegree / 3600.0; Bitmap dst = new Bitmap(w, h); System.Drawing.Imaging.BitmapData srcData = a.LockBits(new Rectangle(0, 0, w, h), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb); System.Drawing.Imaging.BitmapData dstData = dst.LockBits(new Rectangle(0, 0, w, h), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb); unsafe { byte* pIn = (byte*)srcData.Scan0.ToPointer(); byte* pOut = (byte*)dstData.Scan0.ToPointer(); byte* p = null; int stride = srcData.Stride - w * 4; int offsetX = 0, offsetY = 0; int newX = 0, newY = 0; double radian = 0; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { offsetX = x - cenX; offsetY = y - cenY; radian = Math.Atan2(offsetY, offsetX); radius = (int)(Math.Sqrt(offsetX * offsetX + offsetY * offsetY)); newX = (int)(radius * Math.Cos(radian + k * radius)) + cenX; newY = (int)(radius * Math.Sin(radian + k * radius)) + cenY; newX = Math.Min(w - 1, Math.Max(0, newX)); newY = Math.Min(h - 1, Math.Max(0, newY)); p = pIn + newY * srcData.Stride + newX * 4; pOut[0] = (byte)p[0]; pOut[1] = (byte)p[1]; pOut[2] = (byte)p[2]; pOut[3] = (byte)255; pOut += 4; } pOut += stride; } a.UnlockBits(srcData); dst.UnlockBits(dstData); } return dst; } ~~~ 最后放上一個完整的C#程序Demo下載地址:http://www.zealpixel.com/thread-58-1-1.html,另外,推薦一個網址www.zealpixel.com,有很多不錯的圖像處理開源代碼!
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看