GRAPHICS: Add ColorQuantizer class#6379
Merged
bluegr merged 2 commits intoscummvm:masterfrom Jan 1, 2025
Merged
Conversation
This simply moves the new ColorQuantizer class out of the SCUMM engine and into the Graphics namespace where I think it belongs. It reduces a potentially large number of colors into a reasonable palette of the desired size. The SCUMM engine uses this so that the Mac versions can present the thumbnail image (which is at least 16 bpp) stored in savegames.
OMGPizzaGuy
reviewed
Jan 1, 2025
Member
|
Looks good now, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This simply moves the new ColorQuantizer class out of the SCUMM engine and into the
Graphicsnamespace where I think it belongs.The SCUMM engine uses this so that the later Mac versions can present the savegame thumbail (at least 16 bpp) in 256 colors, minus whatever is allocated for the Mac GUI itself. There are several methods of reducing an image down to a palette, but this particular one uses an octree.
I honestly don't know how well it works though it seems fine for the aforementioned thumbnails. But I figured that if it's in
Graphicsit will be easier for others to reuse and improve on it. I first envisioned it as being part ofSurface(which is why I didn't dare to put it inGraphicsstraight away, because I was worried about conflicts with other changes there. But now it makes more sense to me to have it as its own class, because all the world is not a surface.The implementation is heavily based on "Color Quantization using Octrees" by Dean Clark, published in - I think - the January 1996 issue of Dr. Dobb's Journal.