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

Fix or relax some color ranges and clamping #25

Merged
merged 4 commits into from
Jan 28, 2016
Merged

Fix or relax some color ranges and clamping #25

merged 4 commits into from
Jan 28, 2016

Conversation

Ogeon
Copy link
Owner

@Ogeon Ogeon commented Jan 27, 2016

The ColorSpace trait has been repurposed as a trait for checking limits and clamping, and is now called Limited. The limits of Xyz has been changed to use the white point as its maximum (closing #10), and the maximum of Lch.chroma has been removed, since it's not very well defined. The ranges of Lch stays as they are, for the sake of consistency.

Extra clamping is also added when converting RGB colors to u8 based pixel representation, to prevent float shenanigans when multiplying values with 255.0. It's impossible to know what a type T will do when it's asked to convert 255.12312312 or whatever to u8. This closes #19.

This is a breaking change, since it changes the ranges of some color spaces and renames the ColorSpace trait to Limited.

@Ogeon
Copy link
Owner Author

Ogeon commented Jan 28, 2016

@homu r+

@homu
Copy link
Contributor

homu commented Jan 28, 2016

📌 Commit b7dd6ae has been approved by Ogeon

@homu homu merged commit b7dd6ae into master Jan 28, 2016
@homu
Copy link
Contributor

homu commented Jan 28, 2016

⚡ Test exempted - status

homu added a commit that referenced this pull request Jan 28, 2016
Fix or relax some color ranges and clamping

The `ColorSpace` trait has been repurposed as a trait for checking limits and clamping, and is now called `Limited`. The limits of `Xyz` has been changed to use the white point as its maximum (closing #10), and the maximum of `Lch.chroma` has been removed, since it's not very well defined. The ranges of `Lch` stays as they are, for the sake of consistency.

Extra clamping is also added when converting RGB colors to `u8` based pixel representation, to prevent float shenanigans when multiplying values with 255.0. It's impossible to know what a type `T` will do when it's asked to convert `255.12312312` or whatever to `u8`. This closes #19.

This is a breaking change, since it changes the ranges of some color spaces and renames the `ColorSpace` trait to `Limited`.
@Ogeon Ogeon deleted the color_ranges branch February 15, 2016 22:22
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.

Add and Substract - clamp after operations?
2 participants