After 2D canvas stops using Gfx::Painter as its drawing backend, the base Painter interface only needs to describe bitmap compositing work that still happens outside PainterSkia. Narrow the interface to clear_rect, fill_rect and draw_bitmap, which covers GIF/APNG frame compositing, CSS cursor bitmap painting, canvas readback and the Android UI blit.
29 lines
658 B
C++
29 lines
658 B
C++
/*
|
|
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/RefCounted.h>
|
|
#include <LibGfx/AffineTransform.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(PainterSkia&) const = 0;
|
|
|
|
IntSize size() const { return intrinsic_size(); }
|
|
IntRect rect() const { return { {}, size() }; }
|
|
|
|
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> bitmap(IntSize size, AffineTransform = {}) const;
|
|
|
|
virtual ~VectorGraphic() = default;
|
|
};
|
|
|
|
};
|