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

Extract the alpha component as a wrapper type #22

Merged
merged 1 commit into from
Jan 27, 2016
Merged

Extract the alpha component as a wrapper type #22

merged 1 commit into from
Jan 27, 2016

Conversation

Ogeon
Copy link
Owner

@Ogeon Ogeon commented Jan 23, 2016

This closes #11 by adding a wrapper type that bolts the alpha component to any color. This works well because of how passive the alpha is in most of the calculations and conversions, and results in a relatively low amount of code duplication.

Each color space (and Color) has a sibling type alias with an a added to the name, such as Rgba. Those are alias for Alpha<C<T>, T>, where C is the color space type, and can be used more or less in the same way as their non-alpha variants. Conversion between alpha types and non-alpha types is as easy as always.

This is a breaking change, since the alpha component is removed from every color and constructors are moved and/or renamed. The new constructors follows the same convention as the constructors in Srgb and GammaRgb, which is new for float values and new_u8 for u8 values. The constructors on Color are roughly the same as before, with the exception of changing things like rgb8 to rgb_u8.

@Ogeon Ogeon force-pushed the alpha branch 3 times, most recently from 38a06a4 to 24a26ec Compare January 24, 2016 12:30
@homu
Copy link
Contributor

homu commented Jan 24, 2016

☔ The latest upstream changes (presumably #24) made this pull request unmergeable. Please resolve the merge conflicts.

@Ogeon Ogeon force-pushed the alpha branch 3 times, most recently from 27ef843 to b83418a Compare January 25, 2016 16:00
@Ogeon Ogeon changed the title [WIP] Extract the alpha component in a wrapper type Extract the alpha component as a wrapper type Jan 27, 2016
@Ogeon
Copy link
Owner Author

Ogeon commented Jan 27, 2016

@homu r+

@homu
Copy link
Contributor

homu commented Jan 27, 2016

📌 Commit 95a51dc has been approved by Ogeon

@homu
Copy link
Contributor

homu commented Jan 27, 2016

⚡ Test exempted - status

@homu homu merged commit 95a51dc into master Jan 27, 2016
homu added a commit that referenced this pull request Jan 27, 2016
Extract the alpha component as a wrapper type

This closes #11 by adding a wrapper type that bolts the alpha component to any color. This works well because of how passive the alpha is in most of the calculations and conversions, and results in a relatively low amount of code duplication.

Each color space (and `Color`) has a sibling type alias with an `a` added to the name, such as `Rgba`. Those are alias for `Alpha<C<T>, T>`, where `C` is the color space type, and can be used more or less in the same way as their non-alpha variants. Conversion between alpha types and non-alpha types is as easy as always.

This is a breaking change, since the alpha component is removed from every color and constructors are moved and/or renamed. The new constructors follows the same convention as the constructors in `Srgb` and `GammaRgb`, which is `new` for float values and `new_u8` for `u8` values. The constructors on `Color` are roughly the same as before, with the exception of changing things like `rgb8` to `rgb_u8`.
@Ogeon Ogeon deleted the alpha branch January 27, 2016 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find a good way to decouple the alpha channel
2 participants