| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_GFX_COLOR_TRANSFORM_H_ | 5 #ifndef UI_GFX_COLOR_TRANSFORM_H_ |
| 6 #define UI_GFX_COLOR_TRANSFORM_H_ | 6 #define UI_GFX_COLOR_TRANSFORM_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include "base/macros.h" |
| 9 #include <stdint.h> | |
| 10 | |
| 11 #include "build/build_config.h" | |
| 12 #include "ui/gfx/color_space.h" | 9 #include "ui/gfx/color_space.h" |
| 13 #include "ui/gfx/geometry/point3_f.h" | 10 #include "ui/gfx/geometry/point3_f.h" |
| 14 #include "ui/gfx/gfx_export.h" | 11 #include "ui/gfx/gfx_export.h" |
| 15 | 12 |
| 16 namespace gfx { | 13 namespace gfx { |
| 17 | 14 |
| 18 class GFX_EXPORT ColorTransform { | 15 class GFX_EXPORT ColorTransform { |
| 19 public: | 16 public: |
| 20 enum class Intent { INTENT_ABSOLUTE, INTENT_PERCEPTUAL, TEST_NO_OPT }; | 17 enum class Intent { INTENT_ABSOLUTE, INTENT_PERCEPTUAL, TEST_NO_OPT }; |
| 21 | 18 |
| 22 // TriStimulus is a color coordinate in any color space. | 19 // TriStimulus is a color coordinate in any color space. |
| 23 // Channel order is XYZ, RGB or YUV. | 20 // Channel order is XYZ, RGB or YUV. |
| 24 typedef Point3F TriStim; | 21 typedef Point3F TriStim; |
| 25 | 22 |
| 26 virtual ~ColorTransform() {} | 23 ColorTransform(); |
| 24 virtual ~ColorTransform(); |
| 27 | 25 |
| 28 // Perform transformation of colors, |colors| is both input and output. | 26 // Perform transformation of colors, |colors| is both input and output. |
| 29 virtual void transform(TriStim* colors, size_t num) = 0; | 27 virtual void Transform(TriStim* colors, size_t num) = 0; |
| 28 |
| 29 virtual size_t NumberOfStepsForTesting() const = 0; |
| 30 | 30 |
| 31 static std::unique_ptr<ColorTransform> NewColorTransform( | 31 static std::unique_ptr<ColorTransform> NewColorTransform( |
| 32 const ColorSpace& from, | 32 const ColorSpace& from, |
| 33 const ColorSpace& to, | 33 const ColorSpace& to, |
| 34 Intent intent); | 34 Intent intent); |
| 35 | 35 |
| 36 static float ToLinearForTesting(ColorSpace::TransferID id, float v); | 36 private: |
| 37 static float FromLinearForTesting(ColorSpace::TransferID id, float v); | 37 DISALLOW_COPY_AND_ASSIGN(ColorTransform); |
| 38 }; | 38 }; |
| 39 |
| 39 } // namespace gfx | 40 } // namespace gfx |
| 40 | 41 |
| 41 #endif // UI_GFX_COLOR_TRANSFORM_H_ | 42 #endif // UI_GFX_COLOR_TRANSFORM_H_ |
| OLD | NEW |