Transformation.h 799 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibGfx/Matrix4x4.h>
  8. #include <LibWeb/CSS/Angle.h>
  9. #include <LibWeb/CSS/CalculatedOr.h>
  10. #include <LibWeb/CSS/Length.h>
  11. #include <LibWeb/CSS/PercentageOr.h>
  12. #include <LibWeb/CSS/TransformFunctions.h>
  13. namespace Web::CSS {
  14. using TransformValue = Variant<AngleOrCalculated, LengthPercentage, NumberPercentage>;
  15. class Transformation {
  16. public:
  17. Transformation(TransformFunction function, Vector<TransformValue>&& values);
  18. TransformFunction function() const { return m_function; }
  19. ErrorOr<Gfx::FloatMatrix4x4> to_matrix(Optional<Painting::PaintableBox const&>) const;
  20. private:
  21. TransformFunction m_function;
  22. Vector<TransformValue> m_values;
  23. };
  24. }