Ive got an image loaded into a Bitmap object, and I need to slice it into 256x256 pieces to load as Direct3D textures.
Currently it works by creating a new Bitmap object, getting the Graphics object from it, and then doing g.DrawImage() with the specified part of the
source drawn onto the new Bitmap object.
As the current method, this is much too slow. It can take 5+ seconds to load a larger image. I have tried using BitBlt, however it produces empty bitmap objects...any ideas?
Aaron
Currently it works by creating a new Bitmap object, getting the Graphics object from it, and then doing g.DrawImage() with the specified part of the
source drawn onto the new Bitmap object.
Code:
Bitmap b = new Bitmap(256, 256);
Graphics g = Graphics.FromImage(b);
g.DrawImage(this.pic, new Rectangle(0, 0, 256, 256),
new Rectangle(this.xLoad * 256, this.yLoad * 256,
256, 256), GraphicsUnit.Pixel);
this.sprites[this.xLoad, this.yLoad] = new MySprite(d, b);
b.Dispose();
g.Dispose();
As the current method, this is much too slow. It can take 5+ seconds to load a larger image. I have tried using BitBlt, however it produces empty bitmap objects...any ideas?
Aaron
Last edited by a moderator: