OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, 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 12 matching lines...) Expand all Loading... |
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 enum CanvasWindingRule { "nonzero", "evenodd" }; | 26 enum CanvasWindingRule { "nonzero", "evenodd" }; |
27 | 27 |
28 interface CanvasRenderingContext2D : CanvasRenderingContext { | 28 interface CanvasRenderingContext2D : CanvasRenderingContext { |
29 | 29 |
30 void save(); | 30 void save(); |
31 void restore(); | 31 void restore(); |
32 | 32 |
33 void scale([Default=Undefined] optional float sx, | 33 void scale(float sx, float sy); |
34 [Default=Undefined] optional float sy); | 34 void rotate(float angle); |
35 void rotate([Default=Undefined] optional float angle); | 35 void translate(float tx, float ty); |
36 void translate([Default=Undefined] optional float tx, | 36 void transform(float m11, float m12, float m21, float m22, float dx, float d
y); |
37 [Default=Undefined] optional float ty); | 37 void setTransform(float m11, float m12, float m21, float m22, float dx, floa
t dy); |
38 void transform([Default=Undefined] optional float m11, | |
39 [Default=Undefined] optional float m12, | |
40 [Default=Undefined] optional float m21, | |
41 [Default=Undefined] optional float m22, | |
42 [Default=Undefined] optional float dx, | |
43 [Default=Undefined] optional float dy); | |
44 void setTransform([Default=Undefined] optional float m11, | |
45 [Default=Undefined] optional float m12, | |
46 [Default=Undefined] optional float m21, | |
47 [Default=Undefined] optional float m22, | |
48 [Default=Undefined] optional float dx, | |
49 [Default=Undefined] optional float dy); | |
50 | 38 |
51 attribute float globalAlpha; | 39 attribute float globalAlpha; |
52 [TreatNullAs=NullString] attribute DOMString globalCompositeOperation; | 40 [TreatNullAs=NullString] attribute DOMString globalCompositeOperation; |
53 | 41 |
54 [RaisesException] CanvasGradient createLinearGradient([Default=Undefined] op
tional float x0, | 42 [RaisesException] CanvasGradient createLinearGradient(float x0, float y0, fl
oat x1, float y1); |
55 [Default=Undefined] optional float y0, | 43 [RaisesException] CanvasGradient createRadialGradient(float x0, float y0, fl
oat r0, float x1, float y1, float r1); |
56 [Default=Undefined] optional float x1, | |
57 [Default=Undefined] optional float y1); | |
58 [RaisesException] CanvasGradient createRadialGradient([Default=Undefined] op
tional float x0, | |
59 [Default=Undefined] optional float y0, | |
60 [Default=Undefined] optional float r0, | |
61 [Default=Undefined] optional float x1, | |
62 [Default=Undefined] optional float y1, | |
63 [Default=Undefined] optional float r1); | |
64 | 44 |
65 attribute float lineWidth; | 45 attribute float lineWidth; |
66 [TreatNullAs=NullString] attribute DOMString lineCap; | 46 [TreatNullAs=NullString] attribute DOMString lineCap; |
67 [TreatNullAs=NullString] attribute DOMString lineJoin; | 47 [TreatNullAs=NullString] attribute DOMString lineJoin; |
68 attribute float miterLimit; | 48 attribute float miterLimit; |
69 | 49 |
70 attribute float shadowOffsetX; | 50 attribute float shadowOffsetX; |
71 attribute float shadowOffsetY; | 51 attribute float shadowOffsetY; |
72 attribute float shadowBlur; | 52 attribute float shadowBlur; |
73 [TreatNullAs=NullString] attribute DOMString shadowColor; | 53 [TreatNullAs=NullString] attribute DOMString shadowColor; |
74 | 54 |
75 void setLineDash(sequence<float> dash); | 55 void setLineDash(sequence<float> dash); |
76 sequence<float> getLineDash(); | 56 sequence<float> getLineDash(); |
77 attribute float lineDashOffset; | 57 attribute float lineDashOffset; |
78 | 58 |
79 // FIXME: These attributes should be implemented. | 59 // FIXME: These attributes should be implemented. |
80 // [Custom] attribute Array webkitLineDash; | 60 // [Custom] attribute Array webkitLineDash; |
81 // attribute float webkitLineDashOffset; | 61 // attribute float webkitLineDashOffset; |
82 | 62 |
83 void clearRect([Default=Undefined] optional float x, | 63 void clearRect(float x, float y, float width, float height); |
84 [Default=Undefined] optional float y, | 64 void fillRect(float x, float y, float width, float height); |
85 [Default=Undefined] optional float width, | |
86 [Default=Undefined] optional float height); | |
87 void fillRect([Default=Undefined] optional float x, | |
88 [Default=Undefined] optional float y, | |
89 [Default=Undefined] optional float width, | |
90 [Default=Undefined] optional float height); | |
91 | 65 |
92 void beginPath(); | 66 void beginPath(); |
93 | 67 |
94 attribute DOMPath currentPath; | 68 attribute DOMPath currentPath; |
95 | 69 |
96 // FIXME: These methods should be shared with CanvasRenderingContext2D in th
e CanvasPathMethods interface. | 70 // FIXME: These methods should be shared with CanvasRenderingContext2D in th
e CanvasPathMethods interface. |
97 void closePath(); | 71 void closePath(); |
98 void moveTo([Default=Undefined] optional float x, | 72 void moveTo(float x, float y); |
99 [Default=Undefined] optional float y); | 73 void lineTo(float x, float y); |
100 void lineTo([Default=Undefined] optional float x, | 74 void quadraticCurveTo(float cpx, float cpy, float x, float y); |
101 [Default=Undefined] optional float y); | 75 void bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x,
float y); |
102 void quadraticCurveTo([Default=Undefined] optional float cpx, | 76 [RaisesException] void arcTo(float x1, float y1, float x2, float y2, float r
adius); |
103 [Default=Undefined] optional float cpy, | 77 void rect(float x, float y, float width, float height); |
104 [Default=Undefined] optional float x, | 78 [RaisesException] void arc(float x, float y, float radius, float startAngle,
float endAngle, [Default=Undefined] optional boolean anticlockwise); |
105 [Default=Undefined] optional float y); | |
106 void bezierCurveTo([Default=Undefined] optional float cp1x, | |
107 [Default=Undefined] optional float cp1y, | |
108 [Default=Undefined] optional float cp2x, | |
109 [Default=Undefined] optional float cp2y, | |
110 [Default=Undefined] optional float x, | |
111 [Default=Undefined] optional float y); | |
112 [RaisesException] void arcTo([Default=Undefined] optional float x1, | |
113 [Default=Undefined] optional float y1, | |
114 [Default=Undefined] optional float x2, | |
115 [Default=Undefined] optional float y2, | |
116 [Default=Undefined] optional float radius); | |
117 void rect([Default=Undefined] optional float x, | |
118 [Default=Undefined] optional float y, | |
119 [Default=Undefined] optional float width, | |
120 [Default=Undefined] optional float height); | |
121 [RaisesException] void arc([Default=Undefined] optional float x, | |
122 [Default=Undefined] optional float y, | |
123 [Default=Undefined] optional float radius, | |
124 [Default=Undefined] optional float startAngle, | |
125 [Default=Undefined] optional float endAngle, | |
126 [Default=Undefined] optional boolean anticlockwise); | |
127 | 79 |
128 void fill(optional CanvasWindingRule winding); | 80 void fill(optional CanvasWindingRule winding); |
129 void stroke(); | 81 void stroke(); |
130 void clip(optional CanvasWindingRule winding); | 82 void clip(optional CanvasWindingRule winding); |
131 boolean isPointInPath([Default=Undefined] optional float x, | 83 boolean isPointInPath(float x, float y, optional CanvasWindingRule winding); |
132 [Default=Undefined] optional float y, | 84 boolean isPointInStroke(float x, float y); |
133 optional CanvasWindingRule winding); | |
134 boolean isPointInStroke([Default=Undefined] optional float x, | |
135 [Default=Undefined] optional float y); | |
136 | 85 |
137 // text | 86 // text |
138 attribute DOMString font; | 87 attribute DOMString font; |
139 attribute DOMString textAlign; | 88 attribute DOMString textAlign; |
140 attribute DOMString textBaseline; | 89 attribute DOMString textBaseline; |
141 | 90 |
142 TextMetrics measureText([Default=Undefined] optional DOMString text); | 91 TextMetrics measureText(DOMString text); |
143 | 92 |
144 // other | 93 // other |
145 | 94 |
146 void setAlpha([Default=Undefined] optional float alpha); | 95 void setAlpha(float alpha); |
147 void setCompositeOperation([Default=Undefined] optional DOMString compositeO
peration); | 96 void setCompositeOperation(DOMString compositeOperation); |
148 | 97 |
149 void setLineWidth([Default=Undefined] optional float width); | 98 void setLineWidth(float width); |
150 void setLineCap([Default=Undefined] optional DOMString cap); | 99 void setLineCap(DOMString cap); |
151 void setLineJoin([Default=Undefined] optional DOMString join); | 100 void setLineJoin(DOMString join); |
152 void setMiterLimit([Default=Undefined] optional float limit); | 101 void setMiterLimit(float limit); |
153 | 102 |
154 void clearShadow(); | 103 void clearShadow(); |
155 | 104 |
156 void fillText(DOMString text, float x, float y, optional float maxWidth); | 105 void fillText(DOMString text, float x, float y, optional float maxWidth); |
157 void strokeText(DOMString text, float x, float y, optional float maxWidth); | 106 void strokeText(DOMString text, float x, float y, optional float maxWidth); |
158 | 107 |
159 void setStrokeColor([StrictTypeChecking] DOMString color, optional float alp
ha); | 108 void setStrokeColor([StrictTypeChecking] DOMString color, optional float alp
ha); |
160 void setStrokeColor(float grayLevel, optional float alpha); | 109 void setStrokeColor(float grayLevel, optional float alpha); |
161 void setStrokeColor(float r, float g, float b, float a); | 110 void setStrokeColor(float r, float g, float b, float a); |
162 void setStrokeColor(float c, float m, float y, float k, float a); | 111 void setStrokeColor(float c, float m, float y, float k, float a); |
163 | 112 |
164 void setFillColor([StrictTypeChecking] DOMString color, optional float alpha
); | 113 void setFillColor([StrictTypeChecking] DOMString color, optional float alpha
); |
165 void setFillColor(float grayLevel, optional float alpha); | 114 void setFillColor(float grayLevel, optional float alpha); |
166 void setFillColor(float r, float g, float b, float a); | 115 void setFillColor(float r, float g, float b, float a); |
167 void setFillColor(float c, float m, float y, float k, float a); | 116 void setFillColor(float c, float m, float y, float k, float a); |
168 | 117 |
169 void strokeRect([Default=Undefined] optional float x, | 118 void strokeRect(float x, float y, float width, float height, optional float
lineWidth); |
170 [Default=Undefined] optional float y, | |
171 [Default=Undefined] optional float width, | |
172 [Default=Undefined] optional float height, | |
173 optional float lineWidth); | |
174 | 119 |
175 [RaisesException] void drawImage(HTMLImageElement? image, float x, float y); | 120 [RaisesException] void drawImage(HTMLImageElement? image, float x, float y); |
176 [RaisesException] void drawImage(HTMLImageElement? image, float x, float y,
float width, float height); | 121 [RaisesException] void drawImage(HTMLImageElement? image, float x, float y,
float width, float height); |
177 [RaisesException] void drawImage(HTMLImageElement? image, float sx, float sy
, float sw, float sh, float dx, float dy, float dw, float dh); | 122 [RaisesException] void drawImage(HTMLImageElement? image, float sx, float sy
, float sw, float sh, float dx, float dy, float dw, float dh); |
178 [RaisesException] void drawImage(HTMLCanvasElement? canvas, float x, float y
); | 123 [RaisesException] void drawImage(HTMLCanvasElement? canvas, float x, float y
); |
179 [RaisesException] void drawImage(HTMLCanvasElement? canvas, float x, float y
, float width, float height); | 124 [RaisesException] void drawImage(HTMLCanvasElement? canvas, float x, float y
, float width, float height); |
180 [RaisesException] void drawImage(HTMLCanvasElement? canvas, float sx, float
sy, float sw, float sh, float dx, float dy, float dw, float dh); | 125 [RaisesException] void drawImage(HTMLCanvasElement? canvas, float sx, float
sy, float sw, float sh, float dx, float dy, float dw, float dh); |
181 [RaisesException] void drawImage(HTMLVideoElement? video, float x, float y); | 126 [RaisesException] void drawImage(HTMLVideoElement? video, float x, float y); |
182 [RaisesException] void drawImage(HTMLVideoElement? video, float x, float y,
float width, float height); | 127 [RaisesException] void drawImage(HTMLVideoElement? video, float x, float y,
float width, float height); |
183 [RaisesException] void drawImage(HTMLVideoElement? video, float sx, float sy
, float sw, float sh, float dx, float dy, float dw, float dh); | 128 [RaisesException] void drawImage(HTMLVideoElement? video, float sx, float sy
, float sw, float sh, float dx, float dy, float dw, float dh); |
(...skipping 16 matching lines...) Expand all Loading... |
200 | 145 |
201 [RaisesException] CanvasPattern createPattern(HTMLCanvasElement? canvas, [Tr
eatNullAs=NullString] DOMString repetitionType); | 146 [RaisesException] CanvasPattern createPattern(HTMLCanvasElement? canvas, [Tr
eatNullAs=NullString] DOMString repetitionType); |
202 [RaisesException] CanvasPattern createPattern(HTMLImageElement? image, [Trea
tNullAs=NullString] DOMString repetitionType); | 147 [RaisesException] CanvasPattern createPattern(HTMLImageElement? image, [Trea
tNullAs=NullString] DOMString repetitionType); |
203 [RaisesException] ImageData createImageData(ImageData? imagedata); | 148 [RaisesException] ImageData createImageData(ImageData? imagedata); |
204 [RaisesException] ImageData createImageData(float sw, float sh); | 149 [RaisesException] ImageData createImageData(float sw, float sh); |
205 | 150 |
206 [Custom] attribute custom strokeStyle; | 151 [Custom] attribute custom strokeStyle; |
207 [Custom] attribute custom fillStyle; | 152 [Custom] attribute custom fillStyle; |
208 | 153 |
209 // pixel manipulation | 154 // pixel manipulation |
210 [RaisesException] ImageData getImageData([Default=Undefined] optional float
sx, [Default=Undefined] optional float sy, | 155 [RaisesException] ImageData getImageData(float sx, float sy, float sw, float
sh); |
211 [Default=Undefined] optional float sw, [Default=Undef
ined] optional float sh); | |
212 | 156 |
213 [RaisesException] ImageData webkitGetImageDataHD([Default=Undefined] optiona
l float sx, [Default=Undefined] optional float sy, | 157 [RaisesException] ImageData webkitGetImageDataHD(float sx, float sy, float s
w, float sh); |
214 [Default=Undefined] optional float sw, [Defau
lt=Undefined] optional float sh); | |
215 | 158 |
216 readonly attribute float webkitBackingStorePixelRatio; | 159 readonly attribute float webkitBackingStorePixelRatio; |
217 | 160 |
218 attribute boolean webkitImageSmoothingEnabled; | 161 attribute boolean webkitImageSmoothingEnabled; |
219 | 162 |
220 [EnabledAtRuntime=experimentalCanvasFeatures] Canvas2DContextAttributes getC
ontextAttributes(); | 163 [EnabledAtRuntime=experimentalCanvasFeatures] Canvas2DContextAttributes getC
ontextAttributes(); |
221 }; | 164 }; |
222 | 165 |
OLD | NEW |