09-21-2023, 01:42 AM
(09-21-2023, 12:29 AM)SMcNeill Wrote:(09-20-2023, 10:06 PM)bplus Wrote:(09-20-2023, 07:51 PM)SMcNeill Wrote: BMP files at offset 28 in the header, stores 2 bytes which represent your image type...
"the number of bits per pixel, which is the color depth of the image. Typical values are 1, 4, 8, 16, 24 and 32."
So 32-bit BMPs are supported, which allows you to make any transparency level alpha you want in your image. They're just not very common as 24-bit tends to be used with most BMPs.
@SMcNeill I am using your SaveImage Bi and BM and modified your demo to my purpose. And I am guessing, no I will bet real money, your setup for .BMP's was for 24 bit.
Is my money safe?
Aye. You can see from the source:
Code: (Select All)CASE 4
temp = SPACE$(3)
OffsetBITS& = 54 'no palette in 24/32 bit
BMP.BPP = 24
I remember asking back when I first put out the SaveImage library if anyone wanted/needed the 32-bit version where you could save the Alpha info. Folks told me to skip it as it'd just add to the complexity of things and would make the image files 33% larger. Since I also didn't bother to work up the cheesy little RLE compression, files could get a little large with full screen captures, and for some reason QB64 tends to attract a certain crowd where anything larger than 1 byte offends them.
"I don't need an IDE! I can make QB64 1.23 bytes smaller without it, and only ever use CLI!"
"Whut?! Why don't we support the -compressMyAssOff flag?! It only takes 3 weeks to compile Hello World, but it can break it down to being 2 bits smaller!"
"Whuuuttt?!! Make a flexible library would an user could specify whether they want to save alpha levels, or not? Require an extra parameter?!! Add 20 lines of code to ALL my programs?!! I'll never need that! It's just BLOAT!! BLOAT I TELL YOU!! IT'S AGAIST TEH SPITIRT OF BASIC!!!!!"
And so, I produced the most universal and simplest of interfaces for the greatest majority of folks to use. Just the ultra bare bones for image saving.
Your money is safe. My library only does 256 color or 24-bit image saves. (In BMP mode. PNGs still save the full 32-bits of information.)
I am sure before my need for transparent backgrounds was experienced, if polled I wouldn't know WTH any choice of 24 or 32 or both would mean. Of course if you used 32 all the people using 24 would cry it's not the standard for bmp (yet). Now both is the answer but yah no so easy from just the .bmp extension to know. Maybe *32.bmp or *24.bmp so a whole new parameter is not needed. Going to make file names a little funny but seeing 24 or 32 is useful info about the file.
b = b + ...