OLD | NEW |
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 RGBA32 rgb() const { return m_color; } // Preserve the alpha. | 111 RGBA32 rgb() const { return m_color; } // Preserve the alpha. |
112 void setRGB(int r, int g, int b) { m_color = makeRGB(r, g, b); m_valid = tru
e; } | 112 void setRGB(int r, int g, int b) { m_color = makeRGB(r, g, b); m_valid = tru
e; } |
113 void setRGB(RGBA32 rgb) { m_color = rgb; m_valid = true; } | 113 void setRGB(RGBA32 rgb) { m_color = rgb; m_valid = true; } |
114 void getRGBA(float& r, float& g, float& b, float& a) const; | 114 void getRGBA(float& r, float& g, float& b, float& a) const; |
115 void getRGBA(double& r, double& g, double& b, double& a) const; | 115 void getRGBA(double& r, double& g, double& b, double& a) const; |
116 void getHSL(double& h, double& s, double& l) const; | 116 void getHSL(double& h, double& s, double& l) const; |
117 | 117 |
118 Color light() const; | 118 Color light() const; |
119 Color dark() const; | 119 Color dark() const; |
120 | 120 |
| 121 Color combineWithAlpha(float otherAlpha) const; |
| 122 |
121 // This is an implementation of Porter-Duff's "source-over" equation | 123 // This is an implementation of Porter-Duff's "source-over" equation |
122 Color blend(const Color&) const; | 124 Color blend(const Color&) const; |
123 Color blendWithWhite() const; | 125 Color blendWithWhite() const; |
124 | 126 |
125 static bool parseHexColor(const String&, RGBA32&); | 127 static bool parseHexColor(const String&, RGBA32&); |
126 static bool parseHexColor(const LChar*, unsigned, RGBA32&); | 128 static bool parseHexColor(const LChar*, unsigned, RGBA32&); |
127 static bool parseHexColor(const UChar*, unsigned, RGBA32&); | 129 static bool parseHexColor(const UChar*, unsigned, RGBA32&); |
128 | 130 |
129 static const RGBA32 black = 0xFF000000; | 131 static const RGBA32 black = 0xFF000000; |
130 static const RGBA32 white = 0xFFFFFFFF; | 132 static const RGBA32 white = 0xFFFFFFFF; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 174 } |
173 | 175 |
174 return Color(blend(from.red(), to.red(), progress), | 176 return Color(blend(from.red(), to.red(), progress), |
175 blend(from.green(), to.green(), progress), | 177 blend(from.green(), to.green(), progress), |
176 blend(from.blue(), to.blue(), progress), | 178 blend(from.blue(), to.blue(), progress), |
177 blend(from.alpha(), to.alpha(), progress)); | 179 blend(from.alpha(), to.alpha(), progress)); |
178 } | 180 } |
179 } // namespace WebCore | 181 } // namespace WebCore |
180 | 182 |
181 #endif // Color_h | 183 #endif // Color_h |
OLD | NEW |