1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:17:44 +00:00

LibGfx: Add simple VectorGraphic abstract base class

This is currently very bare-bones with just the size and a few methods
to rasterize/draw the graphic.
This commit is contained in:
MacDue 2023-07-05 19:02:00 +01:00 committed by Andreas Kling
parent aaf1b762ea
commit 16b487c270
3 changed files with 66 additions and 0 deletions

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefCounted.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Size.h>
namespace Gfx {
class VectorGraphic : public RefCounted<VectorGraphic> {
public:
virtual IntSize intrinsic_size() const = 0;
virtual void draw_transformed(Painter&, AffineTransform) const = 0;
IntSize size() const { return intrinsic_size(); }
IntRect rect() const { return { {}, size() }; }
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> bitmap(IntSize size, AffineTransform = {}) const;
void draw_into(Painter&, IntRect const& dest, AffineTransform = {}) const;
virtual ~VectorGraphic() = default;
};
};