OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 APP_GFX_COLOR_UTILS_H_ | 5 #ifndef APP_GFX_COLOR_UTILS_H_ |
6 #define APP_GFX_COLOR_UTILS_H_ | 6 #define APP_GFX_COLOR_UTILS_H_ |
7 | 7 |
8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
9 | 9 |
10 class SkBitmap; | 10 class SkBitmap; |
11 | 11 |
(...skipping 10 matching lines...) Expand all Loading... |
22 struct LabColor { | 22 struct LabColor { |
23 int L; | 23 int L; |
24 int a; | 24 int a; |
25 int b; | 25 int b; |
26 }; | 26 }; |
27 | 27 |
28 // Note: these transformations assume sRGB as the source color space | 28 // Note: these transformations assume sRGB as the source color space |
29 | 29 |
30 // Convert between different color spaces | 30 // Convert between different color spaces |
31 void SkColorToCIEXYZ(SkColor c, CIE_XYZ* xyz); | 31 void SkColorToCIEXYZ(SkColor c, CIE_XYZ* xyz); |
32 void CIEXYZToLabColor(const CIE_XYZ& xyz, LabColor* lab); | |
33 | |
34 SkColor CIEXYZToSkColor(SkAlpha alpha, const CIE_XYZ& xyz); | 32 SkColor CIEXYZToSkColor(SkAlpha alpha, const CIE_XYZ& xyz); |
35 void LabColorToCIEXYZ(const LabColor& lab, CIE_XYZ* xyz); | |
36 | 33 |
37 void SkColorToLabColor(SkColor c, LabColor* lab); | 34 void SkColorToLabColor(SkColor c, LabColor* lab); |
38 SkColor LabColorToSkColor(const LabColor& lab, SkAlpha alpha); | 35 SkColor LabColorToSkColor(const LabColor& lab, SkAlpha alpha); |
39 | 36 |
| 37 void CIEXYZToLabColor(const CIE_XYZ& xyz, LabColor* lab); |
| 38 void LabColorToCIEXYZ(const LabColor& lab, CIE_XYZ* xyz); |
| 39 |
40 // Determine if a given alpha value is nearly completely transparent. | 40 // Determine if a given alpha value is nearly completely transparent. |
41 bool IsColorCloseToTransparent(SkAlpha alpha); | 41 bool IsColorCloseToTransparent(SkAlpha alpha); |
42 | 42 |
43 // Determine if a color is near grey. | 43 // Determine if a color is near grey. |
44 bool IsColorCloseToGrey(int r, int g, int b); | 44 bool IsColorCloseToGrey(int r, int g, int b); |
45 | 45 |
46 // Gets a color representing a bitmap. The definition of "representing" is the | 46 // Gets a color representing a bitmap. The definition of "representing" is the |
47 // average color in the bitmap. The color returned is modified to have the | 47 // average color in the bitmap. The color returned is modified to have the |
48 // specified alpha. | 48 // specified alpha. |
49 SkColor GetAverageColorOfFavicon(SkBitmap* bitmap, SkAlpha alpha); | 49 SkColor GetAverageColorOfFavicon(SkBitmap* bitmap, SkAlpha alpha); |
(...skipping 11 matching lines...) Expand all Loading... |
61 SkColor PickMoreReadableColor(SkColor foreground1, | 61 SkColor PickMoreReadableColor(SkColor foreground1, |
62 SkColor foreground2, | 62 SkColor foreground2, |
63 SkColor background); | 63 SkColor background); |
64 | 64 |
65 // Gets a Windows system color as a SkColor | 65 // Gets a Windows system color as a SkColor |
66 SkColor GetSysSkColor(int which); | 66 SkColor GetSysSkColor(int which); |
67 | 67 |
68 } // namespace color_utils | 68 } // namespace color_utils |
69 | 69 |
70 #endif // APP_GFX_COLOR_UTILS_H_ | 70 #endif // APP_GFX_COLOR_UTILS_H_ |
OLD | NEW |