mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
LibGfx: Add formatters for Gfx::Color's different representations
This makes debugging these values a bit easier
This commit is contained in:
parent
1f88ca2a03
commit
29b70485fc
2 changed files with 30 additions and 0 deletions
|
@ -375,3 +375,18 @@ ErrorOr<void> AK::Formatter<Gfx::Color>::format(FormatBuilder& builder, Gfx::Col
|
||||||
{
|
{
|
||||||
return Formatter<StringView>::format(builder, value.to_byte_string());
|
return Formatter<StringView>::format(builder, value.to_byte_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ErrorOr<void> AK::Formatter<Gfx::YUV>::format(FormatBuilder& builder, Gfx::YUV value)
|
||||||
|
{
|
||||||
|
return Formatter<FormatString>::format(builder, "{} {} {}"sv, value.y, value.u, value.v);
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorOr<void> AK::Formatter<Gfx::HSV>::format(FormatBuilder& builder, Gfx::HSV value)
|
||||||
|
{
|
||||||
|
return Formatter<FormatString>::format(builder, "{} {} {}"sv, value.hue, value.saturation, value.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorOr<void> AK::Formatter<Gfx::Oklab>::format(FormatBuilder& builder, Gfx::Oklab value)
|
||||||
|
{
|
||||||
|
return Formatter<FormatString>::format(builder, "{} {} {}"sv, value.L, value.a, value.b);
|
||||||
|
}
|
||||||
|
|
|
@ -626,6 +626,21 @@ struct Formatter<Gfx::Color> : public Formatter<StringView> {
|
||||||
ErrorOr<void> format(FormatBuilder&, Gfx::Color);
|
ErrorOr<void> format(FormatBuilder&, Gfx::Color);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct Formatter<Gfx::YUV> : public Formatter<FormatString> {
|
||||||
|
ErrorOr<void> format(FormatBuilder&, Gfx::YUV);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct Formatter<Gfx::HSV> : public Formatter<FormatString> {
|
||||||
|
ErrorOr<void> format(FormatBuilder&, Gfx::HSV);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct Formatter<Gfx::Oklab> : public Formatter<FormatString> {
|
||||||
|
ErrorOr<void> format(FormatBuilder&, Gfx::Oklab);
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace IPC {
|
namespace IPC {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue