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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 int blue() const { return blueChannel(m_color); } | 96 int blue() const { return blueChannel(m_color); } |
97 int alpha() const { return alphaChannel(m_color); } | 97 int alpha() const { return alphaChannel(m_color); } |
98 | 98 |
99 RGBA32 rgb() const { return m_color; } // Preserve the alpha. | 99 RGBA32 rgb() const { return m_color; } // Preserve the alpha. |
100 void setRGB(int r, int g, int b) { m_color = makeRGB(r, g, b); m_valid = tru
e; } | 100 void setRGB(int r, int g, int b) { m_color = makeRGB(r, g, b); m_valid = tru
e; } |
101 void setRGB(RGBA32 rgb) { m_color = rgb; m_valid = true; } | 101 void setRGB(RGBA32 rgb) { m_color = rgb; m_valid = true; } |
102 void getRGBA(float& r, float& g, float& b, float& a) const; | 102 void getRGBA(float& r, float& g, float& b, float& a) const; |
103 void getRGBA(double& r, double& g, double& b, double& a) const; | 103 void getRGBA(double& r, double& g, double& b, double& a) const; |
104 void getHSL(double& h, double& s, double& l) const; | 104 void getHSL(double& h, double& s, double& l) const; |
105 | 105 |
| 106 double lightness() const; |
| 107 |
106 Color light() const; | 108 Color light() const; |
107 Color dark() const; | 109 Color dark() const; |
108 | 110 |
109 // This is an implementation of Porter-Duff's "source-over" equation | 111 // This is an implementation of Porter-Duff's "source-over" equation |
110 Color blend(const Color&) const; | 112 Color blend(const Color&) const; |
111 Color blendWithWhite() const; | 113 Color blendWithWhite() const; |
112 | 114 |
113 static bool parseHexColor(const String&, RGBA32&); | 115 static bool parseHexColor(const String&, RGBA32&); |
114 static bool parseHexColor(const LChar*, unsigned, RGBA32&); | 116 static bool parseHexColor(const LChar*, unsigned, RGBA32&); |
115 static bool parseHexColor(const UChar*, unsigned, RGBA32&); | 117 static bool parseHexColor(const UChar*, unsigned, RGBA32&); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 162 } |
161 | 163 |
162 return Color(blend(from.red(), to.red(), progress), | 164 return Color(blend(from.red(), to.red(), progress), |
163 blend(from.green(), to.green(), progress), | 165 blend(from.green(), to.green(), progress), |
164 blend(from.blue(), to.blue(), progress), | 166 blend(from.blue(), to.blue(), progress), |
165 blend(from.alpha(), to.alpha(), progress)); | 167 blend(from.alpha(), to.alpha(), progress)); |
166 } | 168 } |
167 } // namespace WebCore | 169 } // namespace WebCore |
168 | 170 |
169 #endif // Color_h | 171 #endif // Color_h |
OLD | NEW |