/* * Copyright (c) 2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Web::HTML { class HTMLCanvasElement final : public HTMLElement { public: using WrapperType = Bindings::HTMLCanvasElementWrapper; HTMLCanvasElement(DOM::Document&, QualifiedName); virtual ~HTMLCanvasElement() override; const Gfx::Bitmap* bitmap() const { return m_bitmap; } Gfx::Bitmap* bitmap() { return m_bitmap; } bool create_bitmap(); CanvasRenderingContext2D* get_context(String type); unsigned width() const; unsigned height() const; String to_data_url(const String& type, Optional quality) const; private: virtual RefPtr create_layout_node() override; RefPtr m_bitmap; RefPtr m_context; }; }