mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Implement <feComposite> SVG filter
This commit is contained in:
parent
bbfc3a0f5e
commit
a00e7cb20b
Notes:
github-actions[bot]
2025-09-30 21:34:29 +00:00
Author: https://github.com/tcl3
Commit: a00e7cb20b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5744
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/konradekk
15 changed files with 303 additions and 0 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include <LibGfx/SkiaUtils.h>
|
||||
#include <core/SkBlendMode.h>
|
||||
#include <core/SkColorFilter.h>
|
||||
#include <core/SkScalar.h>
|
||||
#include <effects/SkColorMatrix.h>
|
||||
#include <effects/SkImageFilters.h>
|
||||
|
||||
|
|
@ -41,6 +42,16 @@ FilterImpl const& Filter::impl() const
|
|||
return *m_impl;
|
||||
}
|
||||
|
||||
Filter Filter::arithmetic(Optional<Filter const&> background, Optional<Filter const&> foreground, float k1, float k2, float k3, float k4)
|
||||
{
|
||||
sk_sp<SkImageFilter> background_skia = background.has_value() ? background->m_impl->filter : nullptr;
|
||||
sk_sp<SkImageFilter> foreground_skia = foreground.has_value() ? foreground->m_impl->filter : nullptr;
|
||||
|
||||
auto filter = SkImageFilters::Arithmetic(
|
||||
SkFloatToScalar(k1), SkFloatToScalar(k2), SkFloatToScalar(k3), SkFloatToScalar(k4), false, move(background_skia), move(foreground_skia));
|
||||
return Filter(Impl::create(filter));
|
||||
}
|
||||
|
||||
Filter Filter::compose(Filter const& outer, Filter const& inner)
|
||||
{
|
||||
auto inner_skia = inner.m_impl->filter;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue