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


C# Bitmap.Paste方法代碼示例

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


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

示例1: GetImage

 protected override void GetImage(out Bitmap bac)
 {
     if (TEXT.IndexOf("Blade") != -1 || TEXT.IndexOf("Swashplate") != -1)
     {
         double time = Game.TIME;
         double angle = time;
         if (TEXT.IndexOf("Blade") != -1)
         {
             double limit = UpgradeInfo.DataBase.BladeUpgradeValues[INDEX];
             if (limit != double.MaxValue)
             {
                 angle %= 2.0 * limit;
                 if (angle > limit) angle = 2.0 * limit - angle;
                 angle -= 0.5 * limit;
             }
             angle *= 2.0;
         }
         else if (TEXT.IndexOf("Swashplate") != -1)
         {
             angle = 0.5 * Math.Cos(Math.PI * time / UpgradeInfo.DataBase.SwashplateUpgradeValues[INDEX]) * Math.PI;
         }
         Bitmap bmp = Pod_Frame.Pod.GenerateImage(angle, Math.PI * Game.TIME);
         BITMAP.New(out bac,50, 50, Color.FromArgb(0, 0, 128));
         bac.Paste(bmp, bac.Half() - bmp.Half(), ImagePasteMode.Transparent);
         bac = bac.Resize(2.0);
         BitmapData data_bac = bac.GetBitmapData();
         DrawLOCKED(data_bac);
         bac.UnlockBits(data_bac);
     }
     else
     {
         Bitmap bmp; base.GetImage(out bmp);
         BITMAP.New(out bac,bmp.Width, bmp.Height, Color.FromArgb(0, 0, 128));
         bac.Paste(bmp, new Point(0, 0), ImagePasteMode.Transparent);
     }
 }
開發者ID:fsps60312,項目名稱:Digging-Game-2,代碼行數:36,代碼來源:Upgrade+Plant.cs

示例2: Get_Image

 static Bitmap Get_Image(out Bitmap bac)
 {
     bac = new Bitmap(EMPTY);
     BitmapData data_bac = bac.GetBitmapData();
     if (VALUE >= CRITICAL_SHRINK * MAXIMUM)
     {
         using (Bitmap bmp1 = new Bitmap(FUEL))
         {
             double ratio = (VALUE / MAXIMUM - CRITICAL_SHRINK) / (1.0 - CRITICAL_SHRINK);
             int y = (int)Math.Round(DOWN_Y * (1.0 - ratio));
             bmp1.Paste(TOP_SURFACE, new Point(0, y), ImagePasteMode.Transparent);
             using (Bitmap bmp2 = bmp1.SubBitmap(new Rectangle(0, y, bmp1.Width, bmp1.Height - y)).Transparentize(Color.FromArgb(255, 255, 255)))
             {
                 data_bac.Paste(bmp2, new Point(1, 1 + y), ImagePasteMode.Transparent);
             }
         }
         data_bac.Paste(FRAME, new Point(0, 0), ImagePasteMode.Transparent);
     }
     else
     {
         Bitmap bmp = TOP_SURFACE.Resize(VALUE / MAXIMUM / CRITICAL_SHRINK);
         if (bmp != null)
         {
             bmp = bmp.Transparentize(Color.FromArgb(255, 255, 255));
             data_bac.Paste(bmp, new PointD(1, 1 + DOWN_Y) + TOP_SURFACE.Half() - bmp.Half(), ImagePasteMode.Transparent);
             //bmp.Dispose();
         }
         data_bac.Paste(FRAME, new Point(0, 0), ImagePasteMode.Transparent);
     }
     data_bac.Add_R_Minus_GB((RED_VALUE * 100.0).Round());
     bac.UnlockBits(data_bac);
     return bac;
 }
開發者ID:fsps60312,項目名稱:Digging-Game-2,代碼行數:33,代碼來源:Gas+Gauge.cs

示例3: Get_Image

 public static void Get_Image(out Bitmap bac)
 {
     Background.Get_Image(out bac);
     if(EARTHQUAKE>0.0)
     {
         Pod.PAUSED = true;
         bac.Merge_RGB(Color.FromArgb(0, 0, 0), EARTHQUAKE);
         Bitmap bmp;
         using (Font font = new Font("微軟正黑體", 40, FontStyle.Bold))
         {
             bmp = "EARTHQUAKE!!!".ToBitmap(font, Color.FromArgb(255, 255, 255));
         }
         bac.Paste(bmp.Multiply_A(EARTHQUAKE), bac.Half() - bmp.Half(), ImagePasteMode.Gradient);
         //bmp.Dispose();
     }
     else if (FORM_CLOSING)
     {
         Bitmap bmp; Get_GoodBye_Image(out bmp);
         if (FORM_CLOSING_TIME >= FORM_CLOSING_PERIOD) System.Diagnostics.Process.GetCurrentProcess().Kill();
         else if (FORM_CLOSING_TIME >= FORM_CLOSING_MERGE_PERIOD) bac = bmp;
         else
         {
             double ratio = FORM_CLOSING_TIME / FORM_CLOSING_MERGE_PERIOD;
             bmp = bmp.Multiply_A(ratio);
             bac = bac.Paste(bmp, new Point(0, 0), ImagePasteMode.Gradient);
         }
     }
 }
開發者ID:fsps60312,項目名稱:Digging-Game-2,代碼行數:28,代碼來源:Game.cs


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