Пример #1
0
        public static GBitmap[,] Cut(Image image, int w, int h)
        {
            int XTiles = image.Width / w;
            int YTiles = image.Height / h;

            GBitmap[,] Sprites = new GBitmap[XTiles, YTiles];
            Bitmap BM = new Bitmap(image);
            Bitmap Temp;

            for (int x = 0; x < XTiles; ++x)
            {
                for (int y = 0; y < YTiles; ++y)
                {
                    Temp = new Bitmap(w, h, PixelFormat.Format32bppPArgb);

                    Graphics g = Graphics.FromImage(Temp);
                    g.DrawImage(BM, new Rectangle(0, 0, w, h), new Rectangle(x * w, y * h, w, h), GraphicsUnit.Pixel);
                    g.Dispose();

                    Sprites[x, y] = new GBitmap(Temp);
                }
            }

            return(Sprites);
        }
Пример #2
0
 public override void Render(Gfx.GBitmap screen)
 {
     if (Team == Teams.Blu)
     {
         screen.Blit(Art.GRAPHICS[4, 18], iX, iY);
     }
     else
     {
         screen.Blit(Art.GRAPHICS[5, 18], iX, iY);
     }
     base.Render(screen);
 }
Пример #3
0
        public static GBitmap Rotate(GBitmap image, int Angle)
        {
            Bitmap   BM = new Bitmap(image.Width, image.Height);
            Graphics g  = Graphics.FromImage(BM);

            g.TranslateTransform((float)BM.Width / 2, (float)BM.Height / 2);
            g.RotateTransform((float)Angle);
            g.TranslateTransform(-(float)BM.Width / 2, -(float)BM.Height / 2);
            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            g.DrawImage(image.GetFullImage(), new Point(0, 0));
            g.Dispose();

            return(new GBitmap(BM));
        }
Пример #4
0
 public void Blit(GBitmap source, int x, int y)
 {
     Blit(source.GetFullImage(), x, y);
 }