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