Editing bmps for BlitzMax

BlitzMax Forums/BlitzMax Beginners Area/Editing bmps for BlitzMax

DonovanD(Posted 2013) [#1]
Hi everyone,

I am new to programming in general let alone blitzmax and I feel like this problem is something obvious that I just cannot see.

I am trying to put together a quick prototype for a game idea so I decided to use a few sprites (came a cd with a book I bought) as place holders. The only problem with the sprites was their orientation as they were facing upward. I simply opened them in preview (I'm using a mac) and rotated them so they were facing to the right.

Now for some reason I cannot draw them to the screen and I get an error saying "Unhandled Exception:Pixmap coordinates out of bounds."

If I attempt to draw them to the screen before I edit them they work fine. However, when I simply rotate them in any editor and then try to draw them again I get the error. This makes absolutely no sense to me because I checked the file info and I'm not changing the integrity of the file, I am simply editing them. What could possibly change in the file for them not to work anymore?

Is there a special way to save files for use with blitzmax other than making sure they are a .bmp? Sorry if I have not illustrated my problem very well I am very tired. Help would be appreciated :)


Midimaster(Posted 2013) [#2]
first, save images as PNG files for BlitzMax, they are smaller faster and have an alpha channel possibility. Perhaps this removes also the problem with error.

Do you use LoadImage() or LoadPixmap()in BlitzMax? Prefer LoadImage()!

You should publish a piece of your code and a link to the bmp file, so somebody can check it.


GfK(Posted 2013) [#3]
What's probably going on is that when you rotate the image, whatever program you're using to do it, does not save it in a BMP format which Blitzmax can parse(there are numerous variations on the BMP format).

Anyway - what Midimaster said. You want to be using PNG format, as it's the best all-round image format in terms of quality, filesize and compatibility. Other than that, you should also be using LoadImage and DrawImage. If you're using LoadPixmap and DrawPixmap, that's exponentially slower than DrawImage (because the raw image data is being shovelled onto the GPU every draw cycle).


DonovanD(Posted 2013) [#4]
So I was using LoadImage() because I had read in another topic that it was easier on memory and I converted the files to PNG before you guys responded and this completely resolved the issue. However, I was still bothered that I didn't understand why the bitmaps were not working after editing them. (I like to know why problems happened even after a solution presents itself... this is how we learn!) Your responses helped me understand why and I greatly appreciate it! :) Next time I will include a piece of code to better illustrate my problem.

Thanks a lot MidiMaster and Gfk! I will definitely be returning to this forum for help in the future :)

P.S. love the name MidiMaster, my first technical computer endeavor was/is in music production.


xlsior(Posted 2013) [#5]
BMP has a number of sub-formats: 8-bit, 24-but, with and without runtime length encoding (RLE), Windows & OS/2 color palet, etc.

IIRC not all of these are supported by native blitzmax, although there are some add-on image loader modules that can add support for them.