Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Detecting color depth-16 color, 256 color, or 32 bit color
#15
(08-16-2024, 09:26 PM)SMcNeill Wrote: Set a flag.  That checks for 16 NON-BLACK colors.

If theres a black in those first palette entries, and then 16 other colors, that's NOT a 16-color palette.

For example:

Black
Red
Blue
Green
White
Black * 250

The above would count as 4 non-black colors, but there's a valid Black in the 5-color palette.  I wouldn't call that a 4-color image.

The <= 16 check is for:
  standard 16 color palette (black + 15 others)
OR
  non-black palette (someone swapped black for midnight blue.)

But it's going to glitch with:
  Black + 16 other colors, which is actually a 17-color palette and probably a 256 color image.



Subtle glitch, but one that a library function should account for.  You never know who or where a library ends up being exposed to.  Wink
I think I'm getting dense in my old age. I've re-read this a few times and can't wrap my head around what you are getting at. Isn't the variable c already counting the valid colors?

Could you modify the function I created that shows the code you are referring to that needs to be added?
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
RE: Detecting color depth-16 color, 256 color, or 32 bit color - by TerryRitchie - 08-16-2024, 09:38 PM



Users browsing this thread: 4 Guest(s)