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/Optional.h" |
29 #include "bindings/core/v8/ScriptWrappable.h" | 30 #include "bindings/core/v8/ScriptWrappable.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" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 128 } |
128 void setCurrentTransform(PassRefPtr<SVGMatrixTearOff>); | 129 void setCurrentTransform(PassRefPtr<SVGMatrixTearOff>); |
129 | 130 |
130 void scale(float sx, float sy); | 131 void scale(float sx, float sy); |
131 void rotate(float angleInRadians); | 132 void rotate(float angleInRadians); |
132 void translate(float tx, float ty); | 133 void translate(float tx, float ty); |
133 void transform(float m11, float m12, float m21, float m22, float dx, float d
y); | 134 void transform(float m11, float m12, float m21, float m22, float dx, float d
y); |
134 void setTransform(float m11, float m12, float m21, float m22, float dx, floa
t dy); | 135 void setTransform(float m11, float m12, float m21, float m22, float dx, floa
t dy); |
135 void resetTransform(); | 136 void resetTransform(); |
136 | 137 |
137 void setStrokeColor(const String& color); | 138 void setStrokeColor(const String& color, Optional<float> alpha); |
138 void setStrokeColor(float grayLevel); | |
139 void setStrokeColor(const String& color, float alpha); | |
140 void setStrokeColor(float grayLevel, float alpha); | 139 void setStrokeColor(float grayLevel, float alpha); |
141 void setStrokeColor(float r, float g, float b, float a); | 140 void setStrokeColor(float r, float g, float b, float a); |
142 void setStrokeColor(float c, float m, float y, float k, float a); | 141 void setStrokeColor(float c, float m, float y, float k, float a); |
143 | 142 |
144 void setFillColor(const String& color); | 143 void setFillColor(const String& color, Optional<float> alpha); |
145 void setFillColor(float grayLevel); | |
146 void setFillColor(const String& color, float alpha); | |
147 void setFillColor(float grayLevel, float alpha); | 144 void setFillColor(float grayLevel, float alpha); |
148 void setFillColor(float r, float g, float b, float a); | 145 void setFillColor(float r, float g, float b, float a); |
149 void setFillColor(float c, float m, float y, float k, float a); | 146 void setFillColor(float c, float m, float y, float k, float a); |
150 | 147 |
151 void beginPath(); | 148 void beginPath(); |
152 | 149 |
153 void fill(const String& winding = "nonzero"); | 150 void fill(const String& winding = "nonzero"); |
154 void fill(Path2D*, const String& winding = "nonzero"); | 151 void fill(Path2D*, const String& winding = "nonzero"); |
155 void stroke(); | 152 void stroke(); |
156 void stroke(Path2D*); | 153 void stroke(Path2D*); |
157 void clip(const String& winding = "nonzero"); | 154 void clip(const String& winding = "nonzero"); |
158 void clip(Path2D*, const String& winding = "nonzero"); | 155 void clip(Path2D*, const String& winding = "nonzero"); |
159 | 156 |
160 bool isPointInPath(const float x, const float y, const String& winding = "no
nzero"); | 157 bool isPointInPath(const float x, const float y, const String& winding = "no
nzero"); |
161 bool isPointInPath(Path2D*, const float x, const float y, const String& wind
ing = "nonzero"); | 158 bool isPointInPath(Path2D*, const float x, const float y, const String& wind
ing = "nonzero"); |
162 bool isPointInStroke(const float x, const float y); | 159 bool isPointInStroke(const float x, const float y); |
163 bool isPointInStroke(Path2D*, const float x, const float y); | 160 bool isPointInStroke(Path2D*, const float x, const float y); |
164 | 161 |
165 void scrollPathIntoView(); | |
166 void scrollPathIntoView(Path2D*); | 162 void scrollPathIntoView(Path2D*); |
167 | 163 |
168 void clearRect(float x, float y, float width, float height); | 164 void clearRect(float x, float y, float width, float height); |
169 void fillRect(float x, float y, float width, float height); | 165 void fillRect(float x, float y, float width, float height); |
170 void strokeRect(float x, float y, float width, float height); | 166 void strokeRect(float x, float y, float width, float height); |
171 | 167 |
172 void setShadow(float width, float height, float blur); | 168 void setShadow(float width, float height, float blur, const Optional<String>
& color, Optional<float> alpha); |
173 void setShadow(float width, float height, float blur, const String& color); | |
174 void setShadow(float width, float height, float blur, float grayLevel); | |
175 void setShadow(float width, float height, float blur, const String& color, f
loat alpha); | |
176 void setShadow(float width, float height, float blur, float grayLevel, float
alpha); | 169 void setShadow(float width, float height, float blur, float grayLevel, float
alpha); |
177 void setShadow(float width, float height, float blur, float r, float g, floa
t b, float a); | 170 void setShadow(float width, float height, float blur, float r, float g, floa
t b, float a); |
178 void setShadow(float width, float height, float blur, float c, float m, floa
t y, float k, float a); | 171 void setShadow(float width, float height, float blur, float c, float m, floa
t y, float k, float a); |
179 | 172 |
180 void clearShadow(); | 173 void clearShadow(); |
181 | 174 |
182 void drawImage(CanvasImageSource*, float x, float y, ExceptionState&); | 175 void drawImage(CanvasImageSource*, float x, float y, ExceptionState&); |
183 void drawImage(CanvasImageSource*, float x, float y, float width, float heig
ht, ExceptionState&); | 176 void drawImage(CanvasImageSource*, float x, float y, float width, float heig
ht, ExceptionState&); |
184 void drawImage(CanvasImageSource*, float sx, float sy, float sw, float sh, f
loat dx, float dy, float dw, float dh, ExceptionState&); | 177 void drawImage(CanvasImageSource*, float sx, float sy, float sw, float sh, f
loat dx, float dy, float dw, float dh, ExceptionState&); |
185 | 178 |
(...skipping 18 matching lines...) Expand all Loading... |
204 | 197 |
205 String font() const; | 198 String font() const; |
206 void setFont(const String&); | 199 void setFont(const String&); |
207 | 200 |
208 String textAlign() const; | 201 String textAlign() const; |
209 void setTextAlign(const String&); | 202 void setTextAlign(const String&); |
210 | 203 |
211 String textBaseline() const; | 204 String textBaseline() const; |
212 void setTextBaseline(const String&); | 205 void setTextBaseline(const String&); |
213 | 206 |
214 void fillText(const String& text, float x, float y); | 207 void fillText(const String& text, float x, float y, Optional<float> maxWidth
); |
215 void fillText(const String& text, float x, float y, float maxWidth); | 208 void strokeText(const String& text, float x, float y, Optional<float> maxWid
th); |
216 void strokeText(const String& text, float x, float y); | |
217 void strokeText(const String& text, float x, float y, float maxWidth); | |
218 PassRefPtrWillBeRawPtr<TextMetrics> measureText(const String& text); | 209 PassRefPtrWillBeRawPtr<TextMetrics> measureText(const String& text); |
219 | 210 |
220 LineCap getLineCap() const { return state().m_lineCap; } | 211 LineCap getLineCap() const { return state().m_lineCap; } |
221 LineJoin getLineJoin() const { return state().m_lineJoin; } | 212 LineJoin getLineJoin() const { return state().m_lineJoin; } |
222 | 213 |
223 bool imageSmoothingEnabled() const; | 214 bool imageSmoothingEnabled() const; |
224 void setImageSmoothingEnabled(bool); | 215 void setImageSmoothingEnabled(bool); |
225 | 216 |
226 PassRefPtrWillBeRawPtr<Canvas2DContextAttributes> getContextAttributes() con
st; | 217 PassRefPtrWillBeRawPtr<Canvas2DContextAttributes> getContextAttributes() con
st; |
227 | 218 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; | 359 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; |
369 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; | 360 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; |
370 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; | 361 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; |
371 }; | 362 }; |
372 | 363 |
373 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); | 364 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); |
374 | 365 |
375 } // namespace blink | 366 } // namespace blink |
376 | 367 |
377 #endif | 368 #endif |
OLD | NEW |