當前位置: 首頁>>代碼示例>>C#>>正文


C# PointD.ToString方法代碼示例

本文整理匯總了C#中System.Drawing.PointD.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# PointD.ToString方法的具體用法?C# PointD.ToString怎麽用?C# PointD.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Drawing.PointD的用法示例。


在下文中一共展示了PointD.ToString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Fold

 unsafe static Bitmap Fold(Bitmap bmp, double angle)
 {
     double sin = Math.Sin(angle), cos = Math.Cos(angle);
     double wc = (double)(bmp.Width - 1) / 2, hc = (double)(bmp.Height - 1) / 2;
     double min = wc - hc, max = wc + hc;
     PointD dis = new PointD(wc * (1.0 - cos), Math.Min(hc, max * sin));
     Bitmap ans; BITMAP.New(out ans,Math.Max(1, (bmp.Width * cos).Ceiling()), (bmp.Height + min * sin - dis.Y).Ceiling());
     BitmapData data_bmp = bmp.GetBitmapData();
     BitmapData data_ans = ans.GetBitmapData();
     byte* ptr_bmp = data_bmp.GetPointer();
     byte* ptr_ans = data_ans.GetPointer();
     PointD center = new PointD(wc, hc);
     PointD now = (new PointD(0.0, 0.0)) - center;
     double sqrt2 = Math.Sqrt(2.0);
     for (int h = 0; h < bmp.Height; h++, now.Y += 1.0)
     {
         double l = (bmp.Height - 1 - h) + min;
         for (int w = 0; w < bmp.Width; w++, ptr_bmp += 4, now.X += 1.0)
         {
             double ratio = (now / center).Hypot() / sqrt2;
             int y = (h + l * ratio * sin - dis.Y).Round();
             int x = (wc + (w - wc) * cos - dis.X).Round();
             if (y == -1) y++;
             else if (y == ans.Height) y--;
             if (x == -1) x++;
             else if (x == ans.Width) x--;
             if (!x.AtRange(0, ans.Width - 1) || !y.AtRange(0, ans.Height - 1))
             {
                 string msg = "error" + ans.Size.ToString() + new Point(w, h).ToString() + new Point(x, y).ToString();
                 msg += "\r\n" + ratio.ToString() + now.ToString() + center.ToString();
                 MessageBox.Show(msg);
                 continue;
             }
             int i = data_ans.Stride * y + 4 * x;
             if (ptr_ans[i + 3] != 0) continue;
             ptr_ans[i + 0] = ptr_bmp[0];
             ptr_ans[i + 1] = ptr_bmp[1];
             ptr_ans[i + 2] = ptr_bmp[2];
             ptr_ans[i + 3] = ptr_bmp[3];
         }
         ptr_bmp += data_bmp.Stride - 4 * bmp.Width;
         now.X = -center.X;
     }
     ptr_ans = data_ans.GetPointer();
     for (int h = (hc - dis.Y).Round(), w = ans.Width / 2; h < ans.Height; h++)
     {
         int i = data_ans.Stride * h + 4 * w;
         if (ptr_ans[i + 3] != 0) continue;
         ptr_ans[i + 0] = 100;
         ptr_ans[i + 1] = 100;
         ptr_ans[i + 2] = 100;
         ptr_ans[i + 3] = 255;
     }
     bmp.UnlockBits(data_bmp);
     ans.UnlockBits(data_ans);
     return ans;
 }
開發者ID:fsps60312,項目名稱:Digging-Game-2,代碼行數:57,代碼來源:Propel.cs


注:本文中的System.Drawing.PointD.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。