/* * Copyright (c) 2024, Aliaksandr Kalenik * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #ifdef AK_OS_MACOS # include #endif class SkCanvas; class SkSurface; namespace Gfx { class PaintingSurface : public RefCounted { public: static NonnullRefPtr create_with_size(RefPtr context, Gfx::IntSize size, Gfx::BitmapFormat color_type, Gfx::AlphaType alpha_type); static NonnullRefPtr wrap_bitmap(Bitmap&); #ifdef AK_OS_MACOS static NonnullRefPtr wrap_metal_surface(Core::MetalTexture&, RefPtr); #endif RefPtr create_snapshot() const; void read_into_bitmap(Bitmap&); IntSize size() const; IntRect rect() const; SkCanvas& canvas() const; SkSurface& sk_surface() const; void flush() const; ~PaintingSurface(); private: struct Impl; PaintingSurface(NonnullOwnPtr&&); NonnullOwnPtr m_impl; }; }