mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibGfx: Add Color::from_cmyk
This commit is contained in:
parent
f2d2f3fae7
commit
f4941f5940
Notes:
sideshowbarker
2024-07-18 17:26:29 +09:00
Author: https://github.com/mattco98 Commit: https://github.com/SerenityOS/serenity/commit/f4941f59408 Pull-request: https://github.com/SerenityOS/serenity/pull/7436 Reviewed-by: https://github.com/alimpfard
@ -71,6 +71,15 @@ public:
|
||||
static constexpr Color from_rgb(unsigned rgb) { return Color(rgb | 0xff000000); }
|
||||
static constexpr Color from_rgba(unsigned rgba) { return Color(rgba); }
|
||||
|
||||
static constexpr Color from_cmyk(float c, float m, float y, float k)
|
||||
{
|
||||
auto r = static_cast<u8>(255.0f * (1.0f - c) * (1.0f - k));
|
||||
auto g = static_cast<u8>(255.0f * (1.0f - m) * (1.0f - k));
|
||||
auto b = static_cast<u8>(255.0f * (1.0f - y) * (1.0f - k));
|
||||
|
||||
return Color(r, g, b);
|
||||
}
|
||||
|
||||
constexpr u8 red() const { return (m_value >> 16) & 0xff; }
|
||||
constexpr u8 green() const { return (m_value >> 8) & 0xff; }
|
||||
constexpr u8 blue() const { return m_value & 0xff; }
|
||||
|
Loading…
Reference in New Issue
Block a user