mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:22:43 +00:00 
			
		
		
		
	 909bcfe9a4
			
		
	
	
		909bcfe9a4
		
	
	
	
	
		
			
			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.
		
			
				
	
	
		
			31 lines
		
	
	
	
		
			813 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			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&);
 | |
| };
 | |
| 
 | |
| }
 |