DOMMatrix.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2023, Luke Wilde <lukew@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Geometry/DOMMatrixReadOnly.h>
  8. namespace Web::Geometry {
  9. // https://drafts.fxtf.org/geometry/#dommatrix
  10. class DOMMatrix : public DOMMatrixReadOnly {
  11. WEB_PLATFORM_OBJECT(DOMMatrix, Bindings::PlatformObject);
  12. public:
  13. static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMMatrix>> construct_impl(JS::Realm&, Optional<Variant<String, Vector<double>>> const& init);
  14. static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMMatrix>> create_from_dom_matrix_2d_init(JS::Realm&, DOMMatrix2DInit& init);
  15. static JS::NonnullGCPtr<DOMMatrix> create_from_dom_matrix_read_only(JS::Realm&, DOMMatrixReadOnly const& read_only_matrix);
  16. virtual ~DOMMatrix() override;
  17. static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMMatrix>> from_matrix(JS::VM&, DOMMatrixInit other = {});
  18. void set_m11(double value);
  19. void set_m12(double value);
  20. void set_m13(double value);
  21. void set_m14(double value);
  22. void set_m21(double value);
  23. void set_m22(double value);
  24. void set_m23(double value);
  25. void set_m24(double value);
  26. void set_m31(double value);
  27. void set_m32(double value);
  28. void set_m33(double value);
  29. void set_m34(double value);
  30. void set_m41(double value);
  31. void set_m42(double value);
  32. void set_m43(double value);
  33. void set_m44(double value);
  34. void set_a(double value);
  35. void set_b(double value);
  36. void set_c(double value);
  37. void set_d(double value);
  38. void set_e(double value);
  39. void set_f(double value);
  40. JS::NonnullGCPtr<DOMMatrix> invert_self();
  41. private:
  42. DOMMatrix(JS::Realm&, double m11, double m12, double m21, double m22, double m41, double m42);
  43. DOMMatrix(JS::Realm&, Optional<Variant<String, Vector<double>>> const& init);
  44. DOMMatrix(JS::Realm&, DOMMatrixReadOnly const& read_only_matrix);
  45. virtual void initialize(JS::Realm&) override;
  46. };
  47. }