OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UTILS_H_ | 5 #ifndef UI_GFX_COLOR_UTILS_H_ |
6 #define UI_GFX_COLOR_UTILS_H_ | 6 #define UI_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 #include "ui/gfx/gfx_export.h" | 9 #include "ui/gfx/gfx_export.h" |
10 | 10 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 // bitmap are all the same brightness. | 87 // bitmap are all the same brightness. |
88 GFX_EXPORT double CalculateBoringScore(const SkBitmap& bitmap); | 88 GFX_EXPORT double CalculateBoringScore(const SkBitmap& bitmap); |
89 | 89 |
90 // Returns a blend of the supplied colors, ranging from |background| (for | 90 // Returns a blend of the supplied colors, ranging from |background| (for |
91 // |alpha| == 0) to |foreground| (for |alpha| == 255). The alpha channels of | 91 // |alpha| == 0) to |foreground| (for |alpha| == 255). The alpha channels of |
92 // the supplied colors are also taken into account, so the returned color may | 92 // the supplied colors are also taken into account, so the returned color may |
93 // be partially transparent. | 93 // be partially transparent. |
94 GFX_EXPORT SkColor AlphaBlend(SkColor foreground, SkColor background, | 94 GFX_EXPORT SkColor AlphaBlend(SkColor foreground, SkColor background, |
95 SkAlpha alpha); | 95 SkAlpha alpha); |
96 | 96 |
97 // Returns an AlphaBlend of the specified colors, using the alpha component of | |
98 // the foreground color for the alpha and with the alpha of the foreground color | |
Evan Stade
2016/09/08 14:50:47
I think the most intuitive way to explain this mig
Elly Fong-Jones
2016/09/08 16:06:12
Done.
| |
99 // set to 1.0. | |
100 GFX_EXPORT SkColor ImplicitAlphaBlend(SkColor foreground, SkColor background); | |
101 | |
97 // Returns true if the luma of |color| is closer to black than white. | 102 // Returns true if the luma of |color| is closer to black than white. |
98 GFX_EXPORT bool IsDark(SkColor color); | 103 GFX_EXPORT bool IsDark(SkColor color); |
99 | 104 |
100 // Makes a dark color lighter or a light color darker by blending |color| with | 105 // Makes a dark color lighter or a light color darker by blending |color| with |
101 // white or black depending on its current luma. |alpha| controls the amount of | 106 // white or black depending on its current luma. |alpha| controls the amount of |
102 // white or black that will be alpha-blended into |color|. | 107 // white or black that will be alpha-blended into |color|. |
103 GFX_EXPORT SkColor BlendTowardOppositeLuma(SkColor color, SkAlpha alpha); | 108 GFX_EXPORT SkColor BlendTowardOppositeLuma(SkColor color, SkAlpha alpha); |
104 | 109 |
105 // Given a foreground and background color, try to return a foreground color | 110 // Given a foreground and background color, try to return a foreground color |
106 // that is "readable" over the background color by luma-inverting the foreground | 111 // that is "readable" over the background color by luma-inverting the foreground |
(...skipping 22 matching lines...) Expand all Loading... | |
129 // light-on-dark color scheme. | 134 // light-on-dark color scheme. |
130 GFX_EXPORT bool IsInvertedColorScheme(); | 135 GFX_EXPORT bool IsInvertedColorScheme(); |
131 | 136 |
132 // Derives a color for icons on a UI surface based on the text color on the same | 137 // Derives a color for icons on a UI surface based on the text color on the same |
133 // surface. | 138 // surface. |
134 GFX_EXPORT SkColor DeriveDefaultIconColor(SkColor text_color); | 139 GFX_EXPORT SkColor DeriveDefaultIconColor(SkColor text_color); |
135 | 140 |
136 } // namespace color_utils | 141 } // namespace color_utils |
137 | 142 |
138 #endif // UI_GFX_COLOR_UTILS_H_ | 143 #endif // UI_GFX_COLOR_UTILS_H_ |
OLD | NEW |