-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Create Color<->rgba utils on all platforms #45365
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Summary: ## Changelog As a followup to facebook#45139 There I only implemented `hostPlatformColorFromRGBA` and `alpha/red/green/blueFromHostPlatformColor` on cxx platform, then used cxx platform specific method at some places. but really I should implement and use methods in `Color.h` that are platform agnostic * cxx/android: platform color format is int32_t, RGBA are 8bit unsigned int ([0,255]) * windows: platform color format is `winrt::Windows::UI::Color` where RGBA props are 8bit unsigned ints ([0,255]) * apple: platform color format is `UIColor` where RGBA props are floats in [0,1] [Internal] previous change D58872165 Differential Revision: D59593659
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D59593659 |
Base commit: 0fd4a94 |
Contributor
|
This pull request has been merged in 97882a1. |
|
This pull request was successfully merged by @zeyap in 97882a1 When will my fix make it into a release? | How to file a pick request? |
zeyap
added a commit
to zeyap/react-native
that referenced
this pull request
Jul 16, 2024
Summary: ## Changelog the new functions I introduced in facebook#45365 to read color channel value, like `alphaFromColor`, will return float between 0~255 on iOS and 8bit unsigned ints on other platforms, because of different platform implementation. However that way we cannot assume consistent return value across platforms, which kind of contradicts with RN's cross platform design. so here I make `alphaFromColor` in Color.h (the cross platform method) to always return uint8_t, while still allow `alphaFromHostPlatformColor` to return different result Differential Revision: D59826142
facebook-github-bot
pushed a commit
that referenced
this pull request
Jul 16, 2024
Summary: Pull Request resolved: #45485 ## Changelog: the new functions I introduced in #45365 to read color channel value, like `alphaFromColor`, will return float between 0~255 on iOS and 8bit unsigned ints on other platforms, because of different platform implementation. However that way we cannot assume consistent return value across platforms, which kind of contradicts with RN's cross platform design. so here I make `alphaFromColor` in Color.h (the cross platform method) to always return uint8_t, while still allow `alphaFromHostPlatformColor` to return different result [Internal] [Fixed] - Reviewed By: christophpurrer Differential Revision: D59826142 fbshipit-source-id: 4401918be29980474bdc8601443ae33155710f22
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Merged
This PR has been merged.
p: Facebook
Partner: Facebook
Partner
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Changelog
As a followup to #45139
There I only implemented
hostPlatformColorFromRGBAandalpha/red/green/blueFromHostPlatformColoron cxx platform, then used cxx platform specific method at some places. but really I should implement and use methods inColor.hthat are platform agnosticwinrt::Windows::UI::Colorwhere RGBA props are 8bit unsigned ints ([0,255])UIColorwhere RGBA props are floats in [0,1][Internal]
Differential Revision: D59593659