1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 21:05:07 +00:00
serenity/Userland/Libraries/LibWeb/Painting/SVGGraphicsPaintable.h
MacDue 909bcfe9a4 LibWeb: Resolve and paint simple SVG masks
This allows applying SVG <mask>s to elements. It is only implemented for
the simplest (and default) case:

	- mask-type = luminance
 	- maskContentUnits = maskContentUnits
 	- maskUnits = objectBoundingBox
	- Default masking area

It should be possible to extend to cover more cases. Though the layout
for maskContentUnits = objectBoundingBox will be tricky to figure out.
2023-09-19 10:46:05 +02:00

31 lines
813 B
C++

/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Layout/SVGGraphicsBox.h>
#include <LibWeb/Painting/SVGPaintable.h>
namespace Web::Painting {
class SVGGraphicsPaintable : public SVGPaintable {
JS_CELL(SVGGraphicsPaintable, SVGPaintable);
public:
static JS::NonnullGCPtr<SVGGraphicsPaintable> create(Layout::SVGGraphicsBox const&);
Layout::SVGGraphicsBox const& layout_box() const;
virtual bool forms_unconnected_subtree() const override;
virtual Optional<CSSPixelRect> get_masking_area() const override;
virtual void apply_mask(PaintContext&, Gfx::Bitmap& target, CSSPixelRect const& masking_area) const override;
protected:
SVGGraphicsPaintable(Layout::SVGGraphicsBox const&);
};
}