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