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

Implement ability to get Texture's average colour #6077

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EVAST9919
Copy link
Contributor

Some design elements require sampling colour from the texture. This implementation covers this functionality in the simplest way possible - getting average colour of non-transparent pixels.

However I'm marking this as a draft due to this issue ppy/osu#9307. Basically looks like iterating over pixel data may cause performance issues.

@EVAST9919 EVAST9919 marked this pull request as draft December 7, 2023 06:18
@peppy
Copy link
Sponsor Member

peppy commented Dec 7, 2023

Where is this intended to be used? Also are you sure we want average colour? Generally things like this prefer a smarter algorithm, which picks the accent colours from an image.

@EVAST9919
Copy link
Contributor Author

EVAST9919 commented Dec 7, 2023

Where is this intended to be used?

It's used in the song-select for beatmap panels
Снимок экрана 2023-12-07 100546

Also are you sure we want average colour? Generally things like this prefer a smarter algorithm, which picks the accent colours from an image.

Smarter algo would be better, yes. But at first I would like to be sure that I'm putting things in the right place (and if so - probably would be better to combine with ComputeOpacity to avoid 2 loops over pixels in worst case scenario).
May be we want to expose pixel data somehow and compute the colour osu-side upon request or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants