Change how quantize counts colors.#6
Open
AlfredJKwack wants to merge 1 commit intoolivierlesnicki:masterfrom
AlfredJKwack:patch-1
Open
Change how quantize counts colors.#6AlfredJKwack wants to merge 1 commit intoolivierlesnicki:masterfrom AlfredJKwack:patch-1
AlfredJKwack wants to merge 1 commit intoolivierlesnicki:masterfrom
AlfredJKwack:patch-1
Conversation
The inner function used by quantize was counting the number of colors added to the palette, starting from 1. This only works when the PQueue passed contains only 1 VBox; but the iter function is called twice, and the second time, the VBox contains more than one color. This means that in some circumstances it was counting the number of colors added incorrectly, and so quantize.js would sometimes return the wrong number of colors . This commit changes iter to start counting at the actual number of colors in the PQueue, so that it always returns the number of colors requested.
|
Hej, @olivierlesnicki! Can we revive this zombie and merge to master? :) |
|
I've created Mocha tests (in #10 ) that show this change is a significant improvement. The quantize function will return the exact color count requested for all values of maximumColorCount. |
gaymeowing
added a commit
to gaymeowing/quantize-luau
that referenced
this pull request
Feb 12, 2024
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.


The inner function used by quantize was counting the number of colors added to the palette, starting from 1. This only works when the PQueue passed contains only 1 VBox; but the iter function is called twice, and the second time, the VBox contains more than one color. This means that in some circumstances it was counting the number of colors added incorrectly, and so quantize.js would sometimes return the wrong number of colors . This commit changes iter to start counting at the actual number of colors in the PQueue, so that it always returns the number of colors requested.