Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow all color types for PixelArray methods and mask.from_threshold #3164

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

damusss
Copy link
Contributor

@damusss damusss commented Oct 10, 2024

I understand why slice-assignment of pixelarrays limits the allowed types, but this was likely not intended for the replace() and extract() methods, as they were typehinted with ColorValue but don't currently allow all color values.
This PR adds a C function specifically for those methods, making the typehints true.

The same thing applies to mask.from_threshold.

If you think they should not accept all color types, I can change the PR to change the typehints instead, of course.

@damusss damusss added PixelArray pygame.PixelArray bugfix PR that fixes bug labels Oct 10, 2024
@damusss damusss requested a review from a team as a code owner October 10, 2024 17:14
Copy link
Member

@ankith26 ankith26 left a comment

Choose a reason for hiding this comment

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

As a matter of personal preference, I would like to have consistent handling within pixelarray for color values. As it is sort of documented at the module level, it would make sense to keep that behaviour everywhere in the module. Therefore I think this case is a "stubs should be fixed" thing

The mask change on the other hand, I am fine with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix PR that fixes bug PixelArray pygame.PixelArray
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants