X Tutup
Skip to content

GRAPHICS: Add ColorQuantizer class#6379

Merged
bluegr merged 2 commits intoscummvm:masterfrom
eriktorbjorn:graphics-color-quantizer
Jan 1, 2025
Merged

GRAPHICS: Add ColorQuantizer class#6379
bluegr merged 2 commits intoscummvm:masterfrom
eriktorbjorn:graphics-color-quantizer

Conversation

@eriktorbjorn
Copy link
Member

This simply moves the new ColorQuantizer class out of the SCUMM engine and into the Graphics namespace 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 Graphics it will be easier for others to reuse and improve on it. I first envisioned it as being part of Surface (which is why I didn't dare to put it in Graphics straight 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.

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.
Copy link
Member

@bluegr bluegr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! LGTM

@bluegr
Copy link
Member

bluegr commented Jan 1, 2025

Looks good now, thanks!

@bluegr bluegr merged commit 5d3b85a into scummvm:master Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup