Hello everyone! I've been working of functions that can load, draw and alter uncompressed 24bit bitmap files onto a canvas. Note, the loader uses only the width and height bytes in the header and basically ignores the rest of the header. My functions can load, scale up, flip, rotate by n*90 degrees, add/subtract color, invert colors, and conver to greyscale any compatible bitmap it is fed. The drawing function treats black as a transparent color.
To use them properly, first use:
- load_bmp24("file_name"); The file MUST be in the same location as the program.
Then use these if you want:
- invert_bmp24(); to invert the image's colors. (reuse to undo change)
- greyscale_bmp24(); to convert the image to a greyscale. (Converts image data, you must reload if you want the original again)
- RGBadd_bmp24(red, green, blue); to add or subtract color from the image. (Converts image data, you must reload if you want the original again)
Then, when you are ready to draw:
-draw_bmp24(positionX, positionY, Scale factor(positive integers only), flip image value (positive is normal, negative flips), number of 90degCW rotations);
The current image limits are that it can't have an area larger than that given by 320*240 pixels. You may increase it by modifying my codes slightly. Using these for realtime anymation is strongly discouraged because it is very demanding on the CPU. I would use these for seldomly updated and stationary elements like healthbars (non animated), and other such things as menu graphics, since it avoids creating numerous actors for very simple things.
I hope this may prove helpful to some of you out there!
ttyl! --Pyro