| 
									
										
										
										
											2023-10-13 17:25:23 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <LibGfx/Matrix4x4.h>
 | 
					
						
							|  |  |  | #include <LibWeb/CSS/Angle.h>
 | 
					
						
							|  |  |  | #include <LibWeb/CSS/CalculatedOr.h>
 | 
					
						
							|  |  |  | #include <LibWeb/CSS/Length.h>
 | 
					
						
							|  |  |  | #include <LibWeb/CSS/PercentageOr.h>
 | 
					
						
							|  |  |  | #include <LibWeb/CSS/TransformFunctions.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::CSS { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-08 18:51:19 +01:00
										 |  |  | using TransformValue = Variant<AngleOrCalculated, LengthPercentage, NumberPercentage>; | 
					
						
							| 
									
										
										
										
											2023-10-13 17:25:23 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | class Transformation { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     Transformation(TransformFunction function, Vector<TransformValue>&& values); | 
					
						
							| 
									
										
										
										
											2024-01-06 18:05:21 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     TransformFunction function() const { return m_function; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ErrorOr<Gfx::FloatMatrix4x4> to_matrix(Optional<Painting::PaintableBox const&>) const; | 
					
						
							| 
									
										
										
										
											2023-10-13 17:25:23 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     TransformFunction m_function; | 
					
						
							|  |  |  |     Vector<TransformValue> m_values; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |