|
How to load a bitmap???? |
boulifb
Member #7,281
May 2006
|
Hello guys, I'm a newbie in using allegro. I have created a bitmap that contains frames of a character in 4 gray color set with a tool I wrote myself in .NET. The tool can encode 8x8, 16x16 or 32x32 sprites. The bitmap that contains the frames is a 24bppRGB format and the size is 16x16. The .NET function loos like this: private void ExportToWindows(string fileName) { int width = _ilTiles.Images[0].Width; int height = _ilTiles.Images[0].Height; Bitmap bmp = new Bitmap(_ilTiles.Images.Count * width, height, PixelFormat.Format24bppRgb); Graphics g = Graphics.FromImage(bmp); for (int i=0; i < _ilTiles.Images.Count; i++) { Rectangle rect = new Rectangle(i * width, 0, width, height); g.DrawImage(_ilTiles.Images<i>, rect); } bmp.Save(fileName); } So, for loading the bitmap with allegro, I have used the set_color_depth() function with 24 as mode before calling the load_bitmap function. The problem I have is that I ALWAYS get a NULL pointer when I try to load the bitmap file, thus, no matter the format I use to encode the bitmap. Can anybody help me please and tell me how to load correctly the bmp please??? Best regards. Fred. |
gnolam
Member #2,030
March 2002
|
Double-check that the bitmap is in the right directory. Then show us your Allegro code. -- |
A J
Member #3,025
December 2002
|
is is a STANDARD bmp ? ___________________________ |
boulifb
Member #7,281
May 2006
|
Actually, the format of the bitmap was incorrect. bmp.Save(fileName, ImageFormat.Bmp); and it works fine this way. Thanks Fred. |
|