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 20 matching lines...) Expand all Loading... |
31 typedef (HTMLImageElement or | 31 typedef (HTMLImageElement or |
32 HTMLVideoElement or | 32 HTMLVideoElement or |
33 HTMLCanvasElement // or | 33 HTMLCanvasElement // or |
34 // CanvasRenderingContext2D or | 34 // CanvasRenderingContext2D or |
35 // ImageBitmap | 35 // ImageBitmap |
36 ) CanvasImageSource; | 36 ) CanvasImageSource; |
37 | 37 |
38 enum CanvasFillRule { "nonzero", "evenodd" }; | 38 enum CanvasFillRule { "nonzero", "evenodd" }; |
39 | 39 |
40 [ | 40 [ |
41 TypeChecking=Interface|Unrestricted, | 41 TypeChecking=(Interface,Unrestricted), |
42 WillBeGarbageCollected, | 42 WillBeGarbageCollected, |
43 ] interface CanvasRenderingContext2D { | 43 ] interface CanvasRenderingContext2D { |
44 // back-reference to the canvas | 44 // back-reference to the canvas |
45 readonly attribute HTMLCanvasElement canvas; | 45 readonly attribute HTMLCanvasElement canvas; |
46 | 46 |
47 // state | 47 // state |
48 void save(); // push state on state stack | 48 void save(); // push state on state stack |
49 void restore(); // pop state stack and restore state | 49 void restore(); // pop state stack and restore state |
50 | 50 |
51 // transformations (default transform is the identity matrix) | 51 // transformations (default transform is the identity matrix) |
(...skipping 30 matching lines...) Expand all Loading... |
82 [TreatNullAs=NullString] attribute DOMString shadowColor; | 82 [TreatNullAs=NullString] attribute DOMString shadowColor; |
83 | 83 |
84 // rects | 84 // rects |
85 void clearRect(unrestricted float x, unrestricted float y, unrestricted floa
t width, unrestricted float height); | 85 void clearRect(unrestricted float x, unrestricted float y, unrestricted floa
t width, unrestricted float height); |
86 void fillRect(unrestricted float x, unrestricted float y, unrestricted float
width, unrestricted float height); | 86 void fillRect(unrestricted float x, unrestricted float y, unrestricted float
width, unrestricted float height); |
87 void strokeRect(unrestricted float x, unrestricted float y, unrestricted flo
at width, unrestricted float height); | 87 void strokeRect(unrestricted float x, unrestricted float y, unrestricted flo
at width, unrestricted float height); |
88 | 88 |
89 // path API (see also CanvasPathMethods) | 89 // path API (see also CanvasPathMethods) |
90 void beginPath(); | 90 void beginPath(); |
91 void fill(optional CanvasFillRule winding); | 91 void fill(optional CanvasFillRule winding); |
92 [RuntimeEnabled=Path2D] void fill(Path2D path, optional CanvasFillRule windi
ng); | 92 void fill(Path2D path, optional CanvasFillRule winding); |
93 void stroke(); | 93 void stroke(); |
94 [RuntimeEnabled=Path2D] void stroke(Path2D path); | 94 void stroke(Path2D path); |
95 // Focus rings | 95 // Focus rings |
96 void drawFocusIfNeeded(Element element); | 96 void drawFocusIfNeeded(Element element); |
97 [RuntimeEnabled=Path2D] void drawFocusIfNeeded(Path2D path, Element element)
; | 97 void drawFocusIfNeeded(Path2D path, Element element); |
98 | 98 |
99 [RuntimeEnabled=ExperimentalCanvasFeatures] void scrollPathIntoView(optional
Path2D path); | 99 [RuntimeEnabled=ExperimentalCanvasFeatures] void scrollPathIntoView(optional
Path2D path); |
100 void clip(optional CanvasFillRule winding); | 100 void clip(optional CanvasFillRule winding); |
101 [RuntimeEnabled=Path2D] void clip(Path2D path, optional CanvasFillRule windi
ng); | 101 void clip(Path2D path, optional CanvasFillRule winding); |
102 boolean isPointInPath(unrestricted float x, unrestricted float y, optional C
anvasFillRule winding); | 102 boolean isPointInPath(unrestricted float x, unrestricted float y, optional C
anvasFillRule winding); |
103 [RuntimeEnabled=Path2D] boolean isPointInPath(Path2D path, unrestricted floa
t x, unrestricted float y, optional CanvasFillRule winding); | 103 boolean isPointInPath(Path2D path, unrestricted float x, unrestricted float
y, optional CanvasFillRule winding); |
104 boolean isPointInStroke(unrestricted float x, unrestricted float y); | 104 boolean isPointInStroke(unrestricted float x, unrestricted float y); |
105 [RuntimeEnabled=Path2D] boolean isPointInStroke(Path2D path, unrestricted fl
oat x, unrestricted float y); | 105 boolean isPointInStroke(Path2D path, unrestricted float x, unrestricted floa
t y); |
106 | 106 |
107 // text (see also the CanvasDrawingStyles interface) | 107 // text (see also the CanvasDrawingStyles interface) |
108 void fillText(DOMString text, unrestricted float x, unrestricted float y, op
tional unrestricted float maxWidth); | 108 void fillText(DOMString text, unrestricted float x, unrestricted float y, op
tional unrestricted float maxWidth); |
109 void strokeText(DOMString text, unrestricted float x, unrestricted float y,
optional unrestricted float maxWidth); | 109 void strokeText(DOMString text, unrestricted float x, unrestricted float y,
optional unrestricted float maxWidth); |
110 TextMetrics measureText(DOMString text); | 110 TextMetrics measureText(DOMString text); |
111 | 111 |
112 // drawing images | 112 // drawing images |
113 [RaisesException] void drawImage(HTMLImageElement image, unrestricted float
x, unrestricted float y); | 113 [RaisesException] void drawImage(HTMLImageElement image, unrestricted float
x, unrestricted float y); |
114 [RaisesException] void drawImage(HTMLImageElement image, unrestricted float
x, unrestricted float y, unrestricted float width, unrestricted float height); | 114 [RaisesException] void drawImage(HTMLImageElement image, unrestricted float
x, unrestricted float y, unrestricted float width, unrestricted float height); |
115 [RaisesException] void drawImage(HTMLImageElement image, unrestricted float
sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestr
icted float dx, unrestricted float dy, unrestricted float dw, unrestricted float
dh); | 115 [RaisesException] void drawImage(HTMLImageElement image, unrestricted float
sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestr
icted float dx, unrestricted float dy, unrestricted float dw, unrestricted float
dh); |
116 [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted floa
t x, unrestricted float y); | 116 [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted floa
t x, unrestricted float y); |
117 [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted floa
t x, unrestricted float y, unrestricted float width, unrestricted float height); | 117 [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted floa
t x, unrestricted float y, unrestricted float width, unrestricted float height); |
118 [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted floa
t sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unres
tricted float dx, unrestricted float dy, unrestricted float dw, unrestricted flo
at dh); | 118 [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted floa
t sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unres
tricted float dx, unrestricted float dy, unrestricted float dw, unrestricted flo
at dh); |
119 [RaisesException] void drawImage(HTMLVideoElement video, unrestricted float
x, unrestricted float y); | 119 [RaisesException] void drawImage(HTMLVideoElement video, unrestricted float
x, unrestricted float y); |
120 [RaisesException] void drawImage(HTMLVideoElement video, unrestricted float
x, unrestricted float y, unrestricted float width, unrestricted float height); | 120 [RaisesException] void drawImage(HTMLVideoElement video, unrestricted float
x, unrestricted float y, unrestricted float width, unrestricted float height); |
121 [RaisesException] void drawImage(HTMLVideoElement video, unrestricted float
sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestr
icted float dx, unrestricted float dy, unrestricted float dw, unrestricted float
dh); | 121 [RaisesException] void drawImage(HTMLVideoElement video, unrestricted float
sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestr
icted float dx, unrestricted float dy, unrestricted float dw, unrestricted float
dh); |
122 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(
ImageBitmap imageBitmap, unrestricted float x, unrestricted float y); | 122 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(
ImageBitmap imageBitmap, unrestricted float x, unrestricted float y); |
123 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(
ImageBitmap imageBitmap, unrestricted float x, unrestricted float y, unrestricte
d float width, unrestricted float height); | 123 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(
ImageBitmap imageBitmap, unrestricted float x, unrestricted float y, unrestricte
d float width, unrestricted float height); |
124 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(
ImageBitmap imageBitmap, unrestricted float sx, unrestricted float sy, unrestric
ted float sw, unrestricted float sh, unrestricted float dx, unrestricted float d
y, unrestricted float dw, unrestricted float dh); | 124 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(
ImageBitmap imageBitmap, unrestricted float sx, unrestricted float sy, unrestric
ted float sw, unrestricted float sh, unrestricted float dx, unrestricted float d
y, unrestricted float dw, unrestricted float dh); |
125 | 125 |
126 // hit regions | 126 // hit regions |
127 // FIXME: Blink does not currently support WebIDL dictionary definitions. | 127 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void addHitRegi
on(optional HitRegionOptions options); |
128 // See http://crbug.com/321462 | |
129 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void addHitRegi
on(optional Dictionary options); | |
130 [RuntimeEnabled=ExperimentalCanvasFeatures] void removeHitRegion(DOMString i
d); | 128 [RuntimeEnabled=ExperimentalCanvasFeatures] void removeHitRegion(DOMString i
d); |
131 [RuntimeEnabled=ExperimentalCanvasFeatures] void clearHitRegions(); | 129 [RuntimeEnabled=ExperimentalCanvasFeatures] void clearHitRegions(); |
132 | 130 |
133 // pixel manipulation | 131 // pixel manipulation |
134 [DartName=createImageDataFromImageData] ImageData createImageData(ImageData
imagedata); | 132 [DartName=createImageDataFromImageData] ImageData createImageData(ImageData
imagedata); |
135 [RaisesException] ImageData createImageData(float sw, float sh); | 133 [RaisesException] ImageData createImageData(float sw, float sh); |
136 [RaisesException] ImageData getImageData(float sx, float sy, float sw, float
sh); | 134 [RaisesException] ImageData getImageData(float sx, float sy, float sw, float
sh); |
137 void putImageData(ImageData imagedata, float dx, float dy); | 135 void putImageData(ImageData imagedata, float dx, float dy); |
138 void putImageData(ImageData imagedata, float dx, float dy, float dirtyX, flo
at dirtyY, float dirtyWidth, float dirtyHeight); | 136 void putImageData(ImageData imagedata, float dx, float dy, float dirtyX, flo
at dirtyY, float dirtyWidth, float dirtyHeight); |
139 | 137 |
(...skipping 12 matching lines...) Expand all Loading... |
152 | 150 |
153 // dashed lines | 151 // dashed lines |
154 void setLineDash(sequence<unrestricted float> dash); | 152 void setLineDash(sequence<unrestricted float> dash); |
155 sequence<unrestricted float> getLineDash(); | 153 sequence<unrestricted float> getLineDash(); |
156 attribute unrestricted float lineDashOffset; | 154 attribute unrestricted float lineDashOffset; |
157 | 155 |
158 // text | 156 // text |
159 attribute DOMString font; // (default 10px sans-serif) | 157 attribute DOMString font; // (default 10px sans-serif) |
160 attribute DOMString textAlign; // "start", "end", "left", "right", "center"
(default: "start") | 158 attribute DOMString textAlign; // "start", "end", "left", "right", "center"
(default: "start") |
161 attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic
", "ideographic", "bottom" (default: "alphabetic") | 159 attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic
", "ideographic", "bottom" (default: "alphabetic") |
| 160 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute DOMString direction; /
/ "inherit", "rtl", "ltr" (default: "inherit") |
162 | 161 |
163 // Non-standard APIs. Candidates for deprecation | 162 // Non-standard APIs. Candidates for deprecation |
164 // https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D | 163 // https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D |
165 [MeasureAs=CanvasRenderingContext2DSetAlpha] void setAlpha(unrestricted floa
t alpha); | 164 [MeasureAs=CanvasRenderingContext2DSetAlpha] void setAlpha(unrestricted floa
t alpha); |
166 [MeasureAs=CanvasRenderingContext2DSetCompositeOperation] void setCompositeO
peration(DOMString compositeOperation); | 165 [MeasureAs=CanvasRenderingContext2DSetCompositeOperation] void setCompositeO
peration(DOMString compositeOperation); |
167 [MeasureAs=CanvasRenderingContext2DSetLineWidth] void setLineWidth(unrestric
ted float width); | 166 [MeasureAs=CanvasRenderingContext2DSetLineWidth] void setLineWidth(unrestric
ted float width); |
168 [MeasureAs=CanvasRenderingContext2DSetLineCap] void setLineCap(DOMString cap
); | 167 [MeasureAs=CanvasRenderingContext2DSetLineCap] void setLineCap(DOMString cap
); |
169 [MeasureAs=CanvasRenderingContext2DSetLineJoin] void setLineJoin(DOMString j
oin); | 168 [MeasureAs=CanvasRenderingContext2DSetLineJoin] void setLineJoin(DOMString j
oin); |
170 [MeasureAs=CanvasRenderingContext2DSetMiterLimit] void setMiterLimit(unrestr
icted float limit); | 169 [MeasureAs=CanvasRenderingContext2DSetMiterLimit] void setMiterLimit(unrestr
icted float limit); |
171 [MeasureAs=CanvasRenderingContext2DClearShadow] void clearShadow(); | 170 [MeasureAs=CanvasRenderingContext2DClearShadow] void clearShadow(); |
172 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(DOMSt
ring color, optional unrestricted float alpha); | 171 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(DOMSt
ring color, optional unrestricted float alpha); |
173 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(unres
tricted float grayLevel, optional unrestricted float alpha); | 172 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(unres
tricted float grayLevel, optional unrestricted float alpha); |
174 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(unres
tricted float r, unrestricted float g, unrestricted float b, unrestricted float
a); | 173 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(unres
tricted float r, unrestricted float g, unrestricted float b, unrestricted float
a); |
175 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(unres
tricted float c, unrestricted float m, unrestricted float y, unrestricted float
k, unrestricted float a); | 174 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(unres
tricted float c, unrestricted float m, unrestricted float y, unrestricted float
k, unrestricted float a); |
176 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(DOMString
color, optional unrestricted float alpha); | 175 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(DOMString
color, optional unrestricted float alpha); |
177 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(unrestric
ted float grayLevel, optional unrestricted float alpha); | 176 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(unrestric
ted float grayLevel, optional unrestricted float alpha); |
178 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(unrestric
ted float r, unrestricted float g, unrestricted float b, unrestricted float a); | 177 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(unrestric
ted float r, unrestricted float g, unrestricted float b, unrestricted float a); |
179 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(unrestric
ted float c, unrestricted float m, unrestricted float y, unrestricted float k, u
nrestricted float a); | 178 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(unrestric
ted float c, unrestricted float m, unrestricted float y, unrestricted float k, u
nrestricted float a); |
180 [MeasureAs=CanvasRenderingContext2DDrawImageFromRect] void drawImageFromRect
( | 179 [MeasureAs=CanvasRenderingContext2DDrawImageFromRect] void drawImageFromRect
( |
181 HTMLImageElement? image, optional unrestricted float sx, optional unrest
ricted float sy, optional unrestricted float sw, optional unrestricted float sh, | 180 HTMLImageElement? image, optional unrestricted float sx, optional unrest
ricted float sy, optional unrestricted float sw, optional unrestricted float sh, |
182 optional unrestricted float dx, optional unrestricted float dy, optional
unrestricted float dw, optional unrestricted float dh, optional DOMString compo
siteOperation); | 181 optional unrestricted float dx, optional unrestricted float dy, optional
unrestricted float dw, optional unrestricted float dh, optional DOMString compo
siteOperation); |
183 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted fl
oat width, unrestricted float height, unrestricted float blur, optional DOMStrin
g color, optional unrestricted float alpha); | 182 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted fl
oat width, unrestricted float height, unrestricted float blur, optional DOMStrin
g color, optional unrestricted float alpha); |
184 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted fl
oat width, unrestricted float height, unrestricted float blur, unrestricted floa
t grayLevel, optional unrestricted float alpha); | 183 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted fl
oat width, unrestricted float height, unrestricted float blur, unrestricted floa
t grayLevel, optional unrestricted float alpha); |
185 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted fl
oat width, unrestricted float height, unrestricted float blur, unrestricted floa
t r, unrestricted float g, unrestricted float b, unrestricted float a); | 184 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted fl
oat width, unrestricted float height, unrestricted float blur, unrestricted floa
t r, unrestricted float g, unrestricted float b, unrestricted float a); |
186 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted fl
oat width, unrestricted float height, unrestricted float blur, unrestricted floa
t c, unrestricted float m, unrestricted float y, unrestricted float k, unrestric
ted float a); | 185 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted fl
oat width, unrestricted float height, unrestricted float blur, unrestricted floa
t c, unrestricted float m, unrestricted float y, unrestricted float k, unrestric
ted float a); |
187 }; | 186 }; |
188 | 187 |
189 CanvasRenderingContext2D implements CanvasPathMethods; | 188 CanvasRenderingContext2D implements CanvasPathMethods; |
OLD | NEW |