Detecting color depth-16 color, 256 color, or 32 bit color - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: Detecting color depth-16 color, 256 color, or 32 bit color (/showthread.php?tid=2950) |
RE: Detecting color depth-16 color, 256 color, or 32 bit color - TerryRitchie - 08-17-2024 (08-17-2024, 02:17 AM)Pete Wrote: Terry,Yep, sure is. But in the other thread RhoSigma made a good point about how using ON ERROR the way I am will not preserve any previous ON ERROR label that may have existed. It looks like I'll need to remove the .BI file and ON ERROR statement completely any way. As I said in the other thread, what is really needed is a way to verify that image handles are valid. _VALIDIMAGE(Handle&) or something similar. Image handles can't exist above -2 but there is no way to check if a number within the valid handle range actually contains an image. This would be useful for another reason too. When you free an image (_FREEIMAGE) any associated variable that contains the handle value still retains that value. I've made it a habit after freeing an image to also set any associated variable to -1. _FREEIMAGE(MySprite&) MySprite& = -1 This way checks for -2 or less will catch this as an invalid image handle since it was previously removed. |