Skip to content

function enum_pixels #2107

Open
Open
@Python-ZZY

Description

pygame's pixel processing is sometimes necessary, and it can be difficult and slow to process every pixel on a surface. I wonder if there's a faster way.
If so, I suggest adding a function enum_pixels. Here's what I expect:
enum_pixels(func, *sufaces) -> None
Enumerates pixels on multiple surfaces and calls func several times for processing. The func function returns a value in the form of a generator to make changes to the pixel.

def func(pos, *colors):
    for color in colors:
        yield (255-color[0], 255-color[1], 255-color[2]) #reverse color
pg.enum_pixels(func, surface)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions