Ejemplo n.º 1
0
 protected override void Get_PANEL_Image(out Bitmap bac)
 {
     base.Get_PANEL_Image(out bac);
     BitmapData data_bac = bac.GetBitmapData();
     Display_All_Numbers(data_bac);
     Display_Gas_Gauge(data_bac);
     bac.UnlockBits(data_bac);
 }
Ejemplo n.º 2
0
 Block(string name, bool drillable, int price, double hardness, Normal_Distribute distribute, int x = -1, int y = -1)
 {
     NAME = name;
     PRICE = price;
     DRILLABLE = drillable;
     HARDNESS = hardness;
     DISTRIBUTE = distribute;
     BMP = BITMAP.FromFile(@"Picture\Block\" + NAME + ".png");
     BMP_DATA = BMP.GetBitmapData();
     if (BMP.Size != Size) { throw new ArgumentException("Size of Block's Image must be " + Size.ToString()); }
     X = x;
     Y = y;
 }
Ejemplo n.º 3
0
 void ProduceGearImage(out Bitmap bac)
 {
     bac = new Bitmap(IMAGES["GearO"]);
     Bitmap bmp = IMAGES["GearB"];
     int h1=bac.Height;
     bac = bac.Rotate(GEAR_ANGLE);
     bac = bac.TakeCenter(bmp.Size);
     bac.DrawOpaque(bmp);
     int h2=bac.Height;
     int h = (bmp.Height * Health.RATIO - 0.5 * (h1 - h2)).Round();
     if (h > 0)
     {
         BitmapData data_bac = bac.GetBitmapData(new Rectangle(0, Math.Max(0, bac.Height - h), bac.Width, Math.Min(bac.Height, h)));
         data_bac.DrawGray(COLOR.FromRToG(Health.RATIO));
         bac.UnlockBits(data_bac);
     }
 }
Ejemplo n.º 4
0
 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;
 }
 protected override void Get_PANEL_Image(out Bitmap bmp)
 {
     base.Get_PANEL_Image(out bmp);
     BitmapData data_bmp = bmp.GetBitmapData( LAYOUT_RECT);
     Draw_Table_Image(data_bmp);
     bmp.UnlockBits(data_bmp);
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 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);
     }
 }
Ejemplo n.º 8
0
 protected override void GetImage(out Bitmap bmp)
 {
     bmp=ITEM[ITEM_EQUIPPED].GET_IMAGE();bmp=bmp.Resize(GetSize());
     BitmapData data_bmp = bmp.GetBitmapData();
     DrawLOCKED(data_bmp);
     bmp.UnlockBits(data_bmp);
 }
Ejemplo n.º 9
0
 //public new Bitmap Image { get { return GetImage(); } }
 protected override void GetImage(out Bitmap bmp)
 {
     bmp = new Bitmap(BACKGROUND);
     BitmapData data_bmp = bmp.GetBitmapData();
     data_bmp.Paste(IMAGE, new Point(0, 0), ImagePasteMode.Overwrite);
     DrawName(data_bmp);
     DrawPrice(data_bmp);
     DrawOwned(data_bmp);
     DrawDescription(data_bmp);
     DrawLOCKED(data_bmp);
     bmp.UnlockBits(data_bmp);
 }
Ejemplo n.º 10
0
 protected override void GetImage(out Bitmap bac)
 {
     if (BLOOD <= 0.0 && DEAD_TIME >= DEAD_PERIOD) bac= null;
     base.GetImage(out bac); bac = new Bitmap(bac);
     BitmapData data_bac = bac.GetBitmapData();
     data_bac.Merge_RGB(Color.FromArgb(255, 0, 0), RED_RATIO);
     data_bac.Paste(TEXT, data_bac.Half(), Color.FromArgb(255, 255, 255), TEXT.MaxFont(data_bac), StringAlign.Middle, StringRowAlign.Middle);
     if (BLOOD <= 0.0) data_bac.Multiply_A(1.0 - DEAD_TIME / DEAD_PERIOD);
     bac.UnlockBits(data_bac);
 }
Ejemplo n.º 11
0
 static Bitmap Get_GoodBye_Image(out Bitmap bac)
 {
     bac = new Bitmap(Properties.Resources.GoodBye);
     BitmapData data_bac=bac.GetBitmapData();
     data_bac.Merge(Color.FromArgb(255, 255, 255), 0.5);
     using (Font font = new Font("微軟正黑體", 40, FontStyle.Bold | FontStyle.Italic))
     {
         data_bac.Paste("Good Bye~~~", new Point(bac.Width, bac.Height - 10), Color.FromArgb(255, 64, 0), font, StringAlign.Right, StringRowAlign.Down);
     }
     string s=Properties.Resources.GoodByeInformation;
     s += "\r\nClose in " + (FORM_CLOSING_PERIOD - FORM_CLOSING_TIME).ToString("F2") + " Secs";
     Bitmap bmp;
     using (Font font = new Font("微軟正黑體", 20, FontStyle.Bold))
     {
         bmp = s.ToBitmap(data_bac.Width, font, Color.FromArgb(128, 0, 128), StringAlign.Right);
     }
     data_bac.Paste(bmp, new Point(data_bac.Width - bmp.Width, 0), ImagePasteMode.Transparent);
     bac.UnlockBits(data_bac);
     return bac;
 }
Ejemplo n.º 12
0
 static Bitmap Get_Image()
 {
     Bitmap ans;
     using (Bitmap bmp = new Bitmap(FULL))
     {
         Point p = new Point(0, ((1.0 - RATIO) * bmp.Height).Round());
         Size sz = new Size(bmp.Width, bmp.Height - p.Y);
         using (Bitmap bac = new Bitmap(EMPTY))
         {
             BitmapData data_bac = bac.GetBitmapData();
             data_bac.Paste(bmp, new Point(0, 0), ImagePasteMode.Transparent, new Rectangle(p, sz));
             data_bac.Add_RGB(-(BLACK_VALUE * 100.0).Round());
             double healthratio = VALUE / MAXIMUM;
             string text = (healthratio * 100.0).ToString("F2") + " %";
             Color textcolor = Color.FromArgb(0, 255, 0).Merge(Color.FromArgb(0, 0, 0), BLACK_VALUE);
             using (Font font = new Font("微軟正黑體", 14, FontStyle.Bold))
             {
                 data_bac.Paste(text, data_bac.Half(), textcolor, font, StringAlign.Middle, StringRowAlign.Middle);
             }
             bac.UnlockBits(data_bac);
             ans = bac.Resize(SIZE_RATIO);
         }
     }
     return ans;
 }