-
Notifications
You must be signed in to change notification settings - Fork 619
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
Add missing map2/apply2 functions to Pixel
trait
#2241
Comments
The Pixel trait already having a lot of functions is a reason to avoid adding more. Could you share a bit more on what cases these methods would be needed for, and whether there are alternatives ways to implement those? |
The description mentions an example, which is image math (e.g. taking a Laplacian transform and subtracting that from an image's original content, where we want to preserve alpha but operate on the color channels. These seem like elementary operations that are missing, not exactly extra cruft. Is there another way to perform those operations with comparable performance? If so, why are any of the pixel-wise operations present? |
Yes there are other ways to get as good, if not better, performance. The trait exposes the underlying components and if you don't need to be generic over all implementations of From looking closer at the PR, it would actually require a breaking change to add these methods because the |
Can you give a discrete example of how to accomplish |
Overview
The
Pixel
trait has many elementary functions for modifying their values, but a few combinations of useful implementations do not exist. Namely:map2_with_alpha
andapply2_with_alpha
map2_without_alpha
andapply2_without_alpha
Good for a first-time contributor, this would make it easier for users to implement their own simple image editing operations, such as image math, where often the alpha channel should be treated differently (e.g. pick
self
orother
alpha value, even when summing RGB channels).Already implemented in #2239
The text was updated successfully, but these errors were encountered: