mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
LibGfx: Make Color formattable
This commit is contained in:
parent
709b3ccb0a
commit
63dcd59fa5
Notes:
sideshowbarker
2024-07-19 01:42:13 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/63dcd59fa5d Pull-request: https://github.com/SerenityOS/serenity/pull/3857
2 changed files with 13 additions and 0 deletions
|
@ -433,3 +433,8 @@ bool IPC::decode(IPC::Decoder& decoder, Color& color)
|
|||
color = Color::from_rgba(rgba);
|
||||
return true;
|
||||
}
|
||||
|
||||
void AK::Formatter<Gfx::Color>::format(TypeErasedFormatParams& params, FormatBuilder& builder, const Gfx::Color& value)
|
||||
{
|
||||
Formatter<StringView>::format(params, builder, value.to_string());
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibIPC/Forward.h>
|
||||
|
@ -295,6 +296,13 @@ const LogStream& operator<<(const LogStream&, Color);
|
|||
|
||||
using Gfx::Color;
|
||||
|
||||
namespace AK {
|
||||
template<>
|
||||
struct Formatter<Gfx::Color> : public Formatter<StringView> {
|
||||
void format(TypeErasedFormatParams& params, FormatBuilder& builder, const Gfx::Color& value);
|
||||
};
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
bool encode(Encoder&, const Gfx::Color&);
|
||||
bool decode(Decoder&, Gfx::Color&);
|
||||
|
|
Loading…
Add table
Reference in a new issue