mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 15:16:14 +00:00
LibWeb: Update CRC2D .fillStyle and .strokeStyle to accept gradients
While doing add some structures to hold these new fill styles and plumb them over to the painter.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@@ -39,4 +40,21 @@ bool CanvasState::is_context_lost()
|
||||
return m_context_lost;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Gfx::PaintStyle> CanvasState::FillOrStrokeStyle::to_gfx_paint_style()
|
||||
{
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Gfx::Color CanvasState::FillOrStrokeStyle::to_color_but_fixme_should_accept_any_paint_style() const
|
||||
{
|
||||
return as_color().value_or(Gfx::Color::Black);
|
||||
}
|
||||
|
||||
Optional<Gfx::Color> CanvasState::FillOrStrokeStyle::as_color() const
|
||||
{
|
||||
if (auto* color = m_fill_or_stoke_style.get_pointer<Gfx::Color>())
|
||||
return *color;
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user