VectorGraphic.h 753 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2023, MacDue <macdue@dueutil.tech>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/RefCounted.h>
  8. #include <LibGfx/Bitmap.h>
  9. #include <LibGfx/Forward.h>
  10. #include <LibGfx/Size.h>
  11. namespace Gfx {
  12. class VectorGraphic : public RefCounted<VectorGraphic> {
  13. public:
  14. virtual IntSize intrinsic_size() const = 0;
  15. virtual void draw_transformed(Painter&, AffineTransform) const = 0;
  16. IntSize size() const { return intrinsic_size(); }
  17. IntRect rect() const { return { {}, size() }; }
  18. ErrorOr<NonnullRefPtr<Gfx::Bitmap>> bitmap(IntSize size, AffineTransform = {}) const;
  19. void draw_into(Painter&, IntRect const& dest, AffineTransform = {}) const;
  20. virtual ~VectorGraphic() = default;
  21. };
  22. };