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

Side by Side Diff: Source/platform/graphics/Color.h

Issue 134733016: Add support for converting Colors to linear RGB; Fix relevant filters (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 Color light() const; 116 Color light() const;
117 Color dark() const; 117 Color dark() const;
118 118
119 Color combineWithAlpha(float otherAlpha) const; 119 Color combineWithAlpha(float otherAlpha) const;
120 120
121 // This is an implementation of Porter-Duff's "source-over" equation 121 // This is an implementation of Porter-Duff's "source-over" equation
122 Color blend(const Color&) const; 122 Color blend(const Color&) const;
123 Color blendWithWhite() const; 123 Color blendWithWhite() const;
124 124
125 // Convert a Color assumed to be in the device RGB space into a Color in
126 // linear RGB space.
127 Color convertToLinear() const;
f(malita) 2014/01/22 15:09:32 This is just a bit odd - Color feels too low-level
128
125 static bool parseHexColor(const String&, RGBA32&); 129 static bool parseHexColor(const String&, RGBA32&);
126 static bool parseHexColor(const LChar*, unsigned, RGBA32&); 130 static bool parseHexColor(const LChar*, unsigned, RGBA32&);
127 static bool parseHexColor(const UChar*, unsigned, RGBA32&); 131 static bool parseHexColor(const UChar*, unsigned, RGBA32&);
128 132
129 static const RGBA32 black = 0xFF000000; 133 static const RGBA32 black = 0xFF000000;
130 static const RGBA32 white = 0xFFFFFFFF; 134 static const RGBA32 white = 0xFFFFFFFF;
131 static const RGBA32 darkGray = 0xFF808080; 135 static const RGBA32 darkGray = 0xFF808080;
132 static const RGBA32 gray = 0xFFA0A0A0; 136 static const RGBA32 gray = 0xFFA0A0A0;
133 static const RGBA32 lightGray = 0xFFC0C0C0; 137 static const RGBA32 lightGray = 0xFFC0C0C0;
134 static const RGBA32 transparent = 0x00000000; 138 static const RGBA32 transparent = 0x00000000;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 171 }
168 172
169 return Color(blend(from.red(), to.red(), progress), 173 return Color(blend(from.red(), to.red(), progress),
170 blend(from.green(), to.green(), progress), 174 blend(from.green(), to.green(), progress),
171 blend(from.blue(), to.blue(), progress), 175 blend(from.blue(), to.blue(), progress),
172 blend(from.alpha(), to.alpha(), progress)); 176 blend(from.alpha(), to.alpha(), progress));
173 } 177 }
174 } // namespace WebCore 178 } // namespace WebCore
175 179
176 #endif // Color_h 180 #endif // Color_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698