Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / docmodel / color / Transformation.hxx
blob7a05d88aa9e9efaafffb261f3aaeeb33e7d818b0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 */
11 #pragma once
13 #include <docmodel/dllapi.h>
14 #include <vector>
15 #include <o3tl/hash_combine.hxx>
17 namespace model
19 /** Color transformation type */
20 enum class TransformationType
22 Undefined,
23 Red,
24 RedMod,
25 RedOff,
26 Green,
27 GreenMod,
28 GreenOff,
29 Blue,
30 BlueMod,
31 BlueOff,
32 Alpha,
33 AlphaMod,
34 AlphaOff,
35 Hue,
36 HueMod,
37 HueOff,
38 Sat,
39 SatMod,
40 SatOff,
41 Lum,
42 LumMod,
43 LumOff,
44 Shade,
45 Tint,
46 Gray,
47 Comp,
48 Inv,
49 Gamma,
50 InvGamma
53 /** Definition of a color transformation.
55 * This just defines how a color should be transformed (changed). The
56 * type defines what kind of transformation should occur and the value
57 * defines by how much.
59 struct DOCMODEL_DLLPUBLIC Transformation
61 TransformationType meType = TransformationType::Undefined;
63 sal_Int16 mnValue = 0; /// percentage value -10000 to +10000
65 bool operator==(const Transformation& rTransformation) const
67 return meType == rTransformation.meType && mnValue == rTransformation.mnValue;
70 std::size_t getHash() const
72 std::size_t seed = 0;
73 o3tl::hash_combine(seed, meType);
74 o3tl::hash_combine(seed, mnValue);
75 return seed;
79 } // end of namespace model
81 namespace std
83 template <> struct hash<model::Transformation>
85 std::size_t operator()(model::Transformation const& rTransformation) const
87 return rTransformation.getHash();
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */