OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv
ed. |
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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef CanvasRenderingContext2D_h | 26 #ifndef CanvasRenderingContext2D_h |
27 #define CanvasRenderingContext2D_h | 27 #define CanvasRenderingContext2D_h |
28 | 28 |
29 #include "bindings/core/v8/ScriptWrappable.h" | 29 #include "bindings/core/v8/ScriptWrappable.h" |
| 30 #include "bindings/core/v8/UnionTypesCore.h" |
30 #include "core/css/CSSFontSelectorClient.h" | 31 #include "core/css/CSSFontSelectorClient.h" |
31 #include "core/html/canvas/Canvas2DContextAttributes.h" | 32 #include "core/html/canvas/Canvas2DContextAttributes.h" |
32 #include "core/html/canvas/CanvasPathMethods.h" | 33 #include "core/html/canvas/CanvasPathMethods.h" |
33 #include "core/html/canvas/CanvasRenderingContext.h" | 34 #include "core/html/canvas/CanvasRenderingContext.h" |
34 #include "core/html/canvas/HitRegion.h" | 35 #include "core/html/canvas/HitRegion.h" |
35 #include "core/svg/SVGMatrixTearOff.h" | 36 #include "core/svg/SVGMatrixTearOff.h" |
36 #include "platform/fonts/Font.h" | 37 #include "platform/fonts/Font.h" |
37 #include "platform/graphics/Color.h" | 38 #include "platform/graphics/Color.h" |
38 #include "platform/geometry/FloatSize.h" | 39 #include "platform/geometry/FloatSize.h" |
39 #include "platform/graphics/GraphicsContext.h" | 40 #include "platform/graphics/GraphicsContext.h" |
(...skipping 17 matching lines...) Expand all Loading... |
57 class Path2D; | 58 class Path2D; |
58 class Element; | 59 class Element; |
59 class ExceptionState; | 60 class ExceptionState; |
60 class FloatRect; | 61 class FloatRect; |
61 class HTMLCanvasElement; | 62 class HTMLCanvasElement; |
62 class HTMLImageElement; | 63 class HTMLImageElement; |
63 class HTMLVideoElement; | 64 class HTMLVideoElement; |
64 class ImageData; | 65 class ImageData; |
65 class TextMetrics; | 66 class TextMetrics; |
66 | 67 |
| 68 typedef HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElementOrImageBitmap Canva
sImageSourceUnion; |
| 69 |
67 typedef WillBeHeapHashMap<String, RefPtrWillBeMember<MutableStylePropertySet>> M
utableStylePropertyMap; | 70 typedef WillBeHeapHashMap<String, RefPtrWillBeMember<MutableStylePropertySet>> M
utableStylePropertyMap; |
68 | 71 |
69 class CanvasRenderingContext2D final: public CanvasRenderingContext, public Scri
ptWrappable, public CanvasPathMethods { | 72 class CanvasRenderingContext2D final: public CanvasRenderingContext, public Scri
ptWrappable, public CanvasPathMethods { |
70 DEFINE_WRAPPERTYPEINFO(); | 73 DEFINE_WRAPPERTYPEINFO(); |
71 public: | 74 public: |
72 static PassOwnPtrWillBeRawPtr<CanvasRenderingContext2D> create(HTMLCanvasEle
ment* canvas, const Canvas2DContextAttributes* attrs, Document& document) | 75 static PassOwnPtrWillBeRawPtr<CanvasRenderingContext2D> create(HTMLCanvasEle
ment* canvas, const Canvas2DContextAttributes* attrs, Document& document) |
73 { | 76 { |
74 return adoptPtrWillBeNoop(new CanvasRenderingContext2D(canvas, attrs, do
cument)); | 77 return adoptPtrWillBeNoop(new CanvasRenderingContext2D(canvas, attrs, do
cument)); |
75 } | 78 } |
76 virtual ~CanvasRenderingContext2D(); | 79 virtual ~CanvasRenderingContext2D(); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 void setShadow(float width, float height, float blur); | 176 void setShadow(float width, float height, float blur); |
174 void setShadow(float width, float height, float blur, const String& color); | 177 void setShadow(float width, float height, float blur, const String& color); |
175 void setShadow(float width, float height, float blur, float grayLevel); | 178 void setShadow(float width, float height, float blur, float grayLevel); |
176 void setShadow(float width, float height, float blur, const String& color, f
loat alpha); | 179 void setShadow(float width, float height, float blur, const String& color, f
loat alpha); |
177 void setShadow(float width, float height, float blur, float grayLevel, float
alpha); | 180 void setShadow(float width, float height, float blur, float grayLevel, float
alpha); |
178 void setShadow(float width, float height, float blur, float r, float g, floa
t b, float a); | 181 void setShadow(float width, float height, float blur, float r, float g, floa
t b, float a); |
179 void setShadow(float width, float height, float blur, float c, float m, floa
t y, float k, float a); | 182 void setShadow(float width, float height, float blur, float c, float m, floa
t y, float k, float a); |
180 | 183 |
181 void clearShadow(); | 184 void clearShadow(); |
182 | 185 |
183 void drawImage(CanvasImageSource*, float x, float y, ExceptionState&); | 186 void drawImage(const CanvasImageSourceUnion&, float x, float y, ExceptionSta
te&); |
184 void drawImage(CanvasImageSource*, float x, float y, float width, float heig
ht, ExceptionState&); | 187 void drawImage(const CanvasImageSourceUnion&, float x, float y, float width,
float height, ExceptionState&); |
185 void drawImage(CanvasImageSource*, float sx, float sy, float sw, float sh, f
loat dx, float dy, float dw, float dh, ExceptionState&); | 188 void drawImage(const CanvasImageSourceUnion&, float sx, float sy, float sw,
float sh, float dx, float dy, float dw, float dh, ExceptionState&); |
186 | 189 |
187 void drawImageFromRect(HTMLImageElement*, float sx = 0, float sy = 0, float
sw = 0, float sh = 0, | 190 void drawImageFromRect(HTMLImageElement*, float sx = 0, float sy = 0, float
sw = 0, float sh = 0, |
188 float dx = 0, float dy = 0, float dw = 0, float dh =
0, const String& compositeOperation = emptyString()); | 191 float dx = 0, float dy = 0, float dw = 0, float dh =
0, const String& compositeOperation = emptyString()); |
189 | 192 |
190 void setAlpha(float); | 193 void setAlpha(float); |
191 | 194 |
192 void setCompositeOperation(const String&); | 195 void setCompositeOperation(const String&); |
193 | 196 |
194 PassRefPtrWillBeRawPtr<CanvasGradient> createLinearGradient(float x0, float
y0, float x1, float y1); | 197 PassRefPtrWillBeRawPtr<CanvasGradient> createLinearGradient(float x0, float
y0, float x1, float y1); |
195 PassRefPtrWillBeRawPtr<CanvasGradient> createRadialGradient(float x0, float
y0, float r0, float x1, float y1, float r1, ExceptionState&); | 198 PassRefPtrWillBeRawPtr<CanvasGradient> createRadialGradient(float x0, float
y0, float r0, float x1, float y1, float r1, ExceptionState&); |
196 PassRefPtrWillBeRawPtr<CanvasPattern> createPattern(CanvasImageSource*, cons
t String& repetitionType, ExceptionState&); | 199 PassRefPtrWillBeRawPtr<CanvasPattern> createPattern(const CanvasImageSourceU
nion&, const String& repetitionType, ExceptionState&); |
197 | 200 |
198 PassRefPtrWillBeRawPtr<ImageData> createImageData(PassRefPtrWillBeRawPtr<Ima
geData>) const; | 201 PassRefPtrWillBeRawPtr<ImageData> createImageData(PassRefPtrWillBeRawPtr<Ima
geData>) const; |
199 PassRefPtrWillBeRawPtr<ImageData> createImageData(float width, float height,
ExceptionState&) const; | 202 PassRefPtrWillBeRawPtr<ImageData> createImageData(float width, float height,
ExceptionState&) const; |
200 PassRefPtrWillBeRawPtr<ImageData> getImageData(float sx, float sy, float sw,
float sh, ExceptionState&) const; | 203 PassRefPtrWillBeRawPtr<ImageData> getImageData(float sx, float sy, float sw,
float sh, ExceptionState&) const; |
201 void putImageData(ImageData*, float dx, float dy); | 204 void putImageData(ImageData*, float dx, float dy); |
202 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY
, float dirtyWidth, float dirtyHeight); | 205 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY
, float dirtyWidth, float dirtyHeight); |
203 | 206 |
204 void reset(); | 207 void reset(); |
205 | 208 |
206 String font() const; | 209 String font() const; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; | 381 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; |
379 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; | 382 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; |
380 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; | 383 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; |
381 }; | 384 }; |
382 | 385 |
383 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); | 386 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); |
384 | 387 |
385 } // namespace blink | 388 } // namespace blink |
386 | 389 |
387 #endif // CanvasRenderingContext2D_h | 390 #endif // CanvasRenderingContext2D_h |
OLD | NEW |