mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 05:38:24 +00:00
LibGfx: Add Color::from_utf16_string()
This commit is contained in:
parent
fd066d2b58
commit
a9862d60bf
Notes:
github-actions[bot]
2025-07-24 11:20:13 +00:00
Author: https://github.com/gmta
Commit: a9862d60bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5574
Reviewed-by: https://github.com/trflynn89 ✅
2 changed files with 7 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
||||||
#include <AK/Optional.h>
|
#include <AK/Optional.h>
|
||||||
#include <AK/StringConversions.h>
|
#include <AK/StringConversions.h>
|
||||||
#include <AK/Swift.h>
|
#include <AK/Swift.h>
|
||||||
|
#include <AK/Utf16View.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <LibGfx/Color.h>
|
#include <LibGfx/Color.h>
|
||||||
#include <LibIPC/Decoder.h>
|
#include <LibIPC/Decoder.h>
|
||||||
|
@ -367,6 +368,11 @@ Optional<Color> Color::from_string(StringView string)
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Optional<Color> Color::from_utf16_string(Utf16View const& string)
|
||||||
|
{
|
||||||
|
return from_string(string.to_utf8_but_should_be_ported_to_utf16());
|
||||||
|
}
|
||||||
|
|
||||||
Vector<Color> Color::shades(u32 steps, float max) const
|
Vector<Color> Color::shades(u32 steps, float max) const
|
||||||
{
|
{
|
||||||
float shade = 1.f;
|
float shade = 1.f;
|
||||||
|
|
|
@ -491,6 +491,7 @@ public:
|
||||||
ByteString to_byte_string() const;
|
ByteString to_byte_string() const;
|
||||||
ByteString to_byte_string_without_alpha() const;
|
ByteString to_byte_string_without_alpha() const;
|
||||||
static Optional<Color> from_string(StringView);
|
static Optional<Color> from_string(StringView);
|
||||||
|
static Optional<Color> from_utf16_string(Utf16View const&);
|
||||||
static Optional<Color> from_named_css_color_string(StringView);
|
static Optional<Color> from_named_css_color_string(StringView);
|
||||||
|
|
||||||
constexpr HSV to_hsv() const
|
constexpr HSV to_hsv() const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue