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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 inline int redChannel(RGBA32 color) { return (color >> 16) & 0xFF; } | 49 inline int redChannel(RGBA32 color) { return (color >> 16) & 0xFF; } |
50 inline int greenChannel(RGBA32 color) { return (color >> 8) & 0xFF; } | 50 inline int greenChannel(RGBA32 color) { return (color >> 8) & 0xFF; } |
51 inline int blueChannel(RGBA32 color) { return color & 0xFF; } | 51 inline int blueChannel(RGBA32 color) { return color & 0xFF; } |
52 inline int alphaChannel(RGBA32 color) { return (color >> 24) & 0xFF; } | 52 inline int alphaChannel(RGBA32 color) { return (color >> 24) & 0xFF; } |
53 | 53 |
54 struct NamedColor { | 54 struct NamedColor { |
55 const char* name; | 55 const char* name; |
56 unsigned ARGBValue; | 56 unsigned ARGBValue; |
57 }; | 57 }; |
58 | 58 |
59 const NamedColor* findColor(register const char* str, register unsigned len); | 59 PLATFORM_EXPORT const NamedColor* findColor(register const char* str, register u
nsigned len); |
60 | 60 |
61 class PLATFORM_EXPORT Color { | 61 class PLATFORM_EXPORT Color { |
62 WTF_MAKE_FAST_ALLOCATED(Color); | 62 WTF_MAKE_FAST_ALLOCATED(Color); |
63 public: | 63 public: |
64 Color() : m_color(Color::transparent) { } | 64 Color() : m_color(Color::transparent) { } |
65 Color(RGBA32 color) : m_color(color) { } | 65 Color(RGBA32 color) : m_color(color) { } |
66 Color(int r, int g, int b) : m_color(makeRGB(r, g, b)) { } | 66 Color(int r, int g, int b) : m_color(makeRGB(r, g, b)) { } |
67 Color(int r, int g, int b, int a) : m_color(makeRGBA(r, g, b, a)) { } | 67 Color(int r, int g, int b, int a) : m_color(makeRGBA(r, g, b, a)) { } |
68 // Color is currently limited to 32bit RGBA, perhaps some day we'll support
better colors | 68 // Color is currently limited to 32bit RGBA, perhaps some day we'll support
better colors |
69 Color(float r, float g, float b, float a) : m_color(makeRGBA32FromFloats(r,
g, b, a)) { } | 69 Color(float r, float g, float b, float a) : m_color(makeRGBA32FromFloats(r,
g, b, a)) { } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 return Color(blend(from.red(), to.red(), progress), | 168 return Color(blend(from.red(), to.red(), progress), |
169 blend(from.green(), to.green(), progress), | 169 blend(from.green(), to.green(), progress), |
170 blend(from.blue(), to.blue(), progress), | 170 blend(from.blue(), to.blue(), progress), |
171 blend(from.alpha(), to.alpha(), progress)); | 171 blend(from.alpha(), to.alpha(), progress)); |
172 } | 172 } |
173 } // namespace blink | 173 } // namespace blink |
174 | 174 |
175 #endif // Color_h | 175 #endif // Color_h |
OLD | NEW |