Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: app/gfx/color_utils.h

Issue 220029: Simplify life for people trying to pick a "readable" foreground color by not ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | app/gfx/color_utils.cc » ('j') | app/gfx/color_utils.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « no previous file | app/gfx/color_utils.cc » ('j') | app/gfx/color_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698