| OLD | NEW |
| 1 // Copyright (c) 2009 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; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 SkColor GetAverageColorOfFavicon(SkBitmap* bitmap, SkAlpha alpha); | 50 SkColor GetAverageColorOfFavicon(SkBitmap* bitmap, SkAlpha alpha); |
| 51 | 51 |
| 52 // Builds a histogram based on the Y' of the Y'UV representation of | 52 // Builds a histogram based on the Y' of the Y'UV representation of |
| 53 // this image. | 53 // this image. |
| 54 void BuildLumaHistogram(SkBitmap* bitmap, int histogram[256]); | 54 void BuildLumaHistogram(SkBitmap* bitmap, int histogram[256]); |
| 55 | 55 |
| 56 // Returns a blend of the supplied colors, ranging from |background| (for | 56 // Returns a blend of the supplied colors, ranging from |background| (for |
| 57 // |alpha| == 0) to |foreground| (for |alpha| == 255). | 57 // |alpha| == 0) to |foreground| (for |alpha| == 255). |
| 58 SkColor AlphaBlend(SkColor foreground, SkColor background, SkAlpha alpha); | 58 SkColor AlphaBlend(SkColor foreground, SkColor background, SkAlpha alpha); |
| 59 | 59 |
| 60 // Given two possible foreground colors, return the one that is more readable | 60 // Given a foreground and background color, try to return a foreground color |
| 61 // over |background|. | 61 // that is "readable" over the background color by luma-inverting the foreground |
| 62 SkColor PickMoreReadableColor(SkColor foreground1, | 62 // color and then picking whichever foreground color has higher contrast against |
| 63 SkColor foreground2, | 63 // the background color. |
| 64 SkColor background); | 64 // |
| 65 // NOTE: This won't do anything but waste time if the supplied foreground color |
| 66 // has a luma value close to the midpoint (0.5 in the HSL representation). |
| 67 SkColor GetReadableColor(SkColor foreground, SkColor background); |
| 65 | 68 |
| 66 // Gets a Windows system color as a SkColor | 69 // Gets a Windows system color as a SkColor |
| 67 SkColor GetSysSkColor(int which); | 70 SkColor GetSysSkColor(int which); |
| 68 | 71 |
| 69 } // namespace color_utils | 72 } // namespace color_utils |
| 70 | 73 |
| 71 #endif // APP_GFX_COLOR_UTILS_H_ | 74 #endif // APP_GFX_COLOR_UTILS_H_ |
| OLD | NEW |