So here's the glitch, fixed: [ You are not allowed to view this attachment ]
And, there's good news and bad news with this fix.
Good news: It doesn't appear that there's an issue with SaveImage which I have to address at all.
Bad news: _PUTIMAGE isn't working here, just as it wasn't working in the JPEG area earlier, either. You can't simply put a 256 color image onto a 32bit color screen, without things going all goofy. QB64 has some sort of internal conversion which wants to convert 256 color images to 32-bit images automatically, but...
I dunno what to say about it!
Somehow, we display the proper junk in QB64 with this auto-conversion, but things don't _PUTMAGE properly, or reference properly, for saving to files at all!
In your program,
@Petr, make the following change and see if things don't work like you'd expect them to for you:
Xps = 0
b
= _BLUE(p
, ANIMACE
(PF
)) '_PUTIMAGE (Xps, 0)-(Xps + ResX, ResY), ANIMACE(PF), san
Xps = Xps + ResX
result
= SaveImage
(soubor$
, san
, 0, 0, _WIDTH(san
), _HEIGHT(san
))
info
= MsgBox
("Oznámení" + CHR$(0), "Vaše práce byla uložena do " + soubor$
+ CHR$(0), 0, 4, 1, 4096):
EXIT DO ' Work saved correctly info
= MsgBox
("Oznámení" + CHR$(0), "Pøi ukládání souboru došlo k chybì:" + STR$(result
) + CHR$(0), 0, 1, 1, 4096):
EXIT DO ' Some error between saving file
As you can see, I've remarked out the _PUTIMAGE command, and I'm once again manually copying pixel by pixel from one image over to the other -- and this works.
No changes are necessary to SaveImage; just the change to remove that _PUTIMAGE and manually copy the sprites onto the sheet manually. I'm astounded, once again, that there's no errors being tossed for trying to copy 256-color images onto a 32-bit image, but everything *appears* to work properly -- and, oddly enough, it does, in fact, work in QB64. WTH it's doing to make things all goofy/glitchy with SaveImage is beyond me, but something certainly doesn't play nice when trying to save the image to file, and I have no clue what it is.
Patch is rather simple though: Remove the _PUTIMAGE and just manually convert and copy pixels from your 256-color image over to the 32-bit version.
Edit: And I'd still love to learn how the heck QB64 can read that file and decode it properly, when nothing else in the world can. Exactly how the heck does our internal auto-conversion junk work? Why don't we load the file just as glitched as every other program out in the world does??
We may have a fix for the program which generates the image in question, but the whole underlying problem is still a complete head scratcher, as far as I'm concerned.