blob: d134ad50de105b47cb861f22fdb944f649b7ad6a [file] [log] [blame]
Xianzhu Wang3ffdb1d42022-10-26 23:22:251// Copyright 2022 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef UI_GFX_GEOMETRY_DECOMPOSED_TRANSFORM_H_
6#define UI_GFX_GEOMETRY_DECOMPOSED_TRANSFORM_H_
7
Alexander Cooperae2b9d02025-01-06 20:50:398#include <array>
9
Kalvin Leeba222e72024-11-21 04:18:4410#include "base/component_export.h"
Xianzhu Wang3ffdb1d42022-10-26 23:22:2511#include "base/dcheck_is_on.h"
Xianzhu Wang3ffdb1d42022-10-26 23:22:2512#include "ui/gfx/geometry/quaternion.h"
13
14namespace gfx {
15
16// Contains the components of a factored transform. These components may be
17// blended and recomposed.
Kalvin Leeba222e72024-11-21 04:18:4418struct COMPONENT_EXPORT(GEOMETRY) DecomposedTransform {
Xianzhu Wang3ffdb1d42022-10-26 23:22:2519 // The default constructor initializes the components in such a way that
20 // will compose the identity transform.
Alexander Cooperae2b9d02025-01-06 20:50:3921 std::array<double, 3u> translate = {0, 0, 0};
22 std::array<double, 3u> scale = {1, 1, 1};
23 std::array<double, 3u> skew = {0, 0, 0};
24 std::array<double, 4u> perspective = {0, 0, 0, 1};
Xianzhu Wang3ffdb1d42022-10-26 23:22:2525 Quaternion quaternion;
26
27 std::string ToString() const;
28};
29
30// This is declared here for use in gtest-based unit tests but is defined in
31// the //ui/gfx:test_support target. Depend on that to use this in your unit
32// test. This should not be used in production code - call ToString() instead.
33void PrintTo(const DecomposedTransform&, ::std::ostream* os);
34
35} // namespace gfx
36
37#endif // UI_GFX_GEOMETRY_DECOMPOSED_TRANSFORM_H_