Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ ColorComponents colorComponentsFromColor(SharedColor sharedColor) {
}

// Read alpha channel in [0, 255] range
float alphaFromColor(SharedColor color) {
return alphaFromHostPlatformColor(*color);
uint8_t alphaFromColor(SharedColor color) {
return static_cast<uint8_t>(std::round(alphaFromHostPlatformColor(*color)));
}

// Read red channel in [0, 255] range
float redFromColor(SharedColor color) {
return redFromHostPlatformColor(*color);
uint8_t redFromColor(SharedColor color) {
return static_cast<uint8_t>(std::round(redFromHostPlatformColor(*color)));
}

// Read green channel in [0, 255] range
float greenFromColor(SharedColor color) {
return greenFromHostPlatformColor(*color);
uint8_t greenFromColor(SharedColor color) {
return static_cast<uint8_t>(std::round(greenFromHostPlatformColor(*color)));
}

// Read blue channel in [0, 255] range
float blueFromColor(SharedColor color) {
return blueFromHostPlatformColor(*color);
uint8_t blueFromColor(SharedColor color) {
return static_cast<uint8_t>(std::round(blueFromHostPlatformColor(*color)));
}

// Create Color with RGBA values in [0, 255] range
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ bool isColorMeaningful(const SharedColor& color) noexcept;
SharedColor colorFromComponents(ColorComponents components);
ColorComponents colorComponentsFromColor(SharedColor color);

float alphaFromColor(SharedColor color);
float redFromColor(SharedColor color);
float greenFromColor(SharedColor color);
float blueFromColor(SharedColor color);
uint8_t alphaFromColor(SharedColor color);
uint8_t redFromColor(SharedColor color);
uint8_t greenFromColor(SharedColor color);
uint8_t blueFromColor(SharedColor color);
SharedColor colorFromRGBA(uint8_t r, uint8_t g, uint8_t b, uint8_t a);

SharedColor clearColor();
Expand Down