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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 enum CanvasWindingRule { "nonzero", "evenodd" }; | 26 enum CanvasWindingRule { "nonzero", "evenodd" }; |
27 | 27 |
28 interface CanvasRenderingContext2D { | 28 interface CanvasRenderingContext2D { |
29 | 29 |
30 readonly attribute HTMLCanvasElement canvas; | 30 readonly attribute HTMLCanvasElement canvas; |
31 | 31 |
32 void save(); | 32 void save(); |
33 void restore(); | 33 void restore(); |
34 | 34 |
35 [StrictTypeChecking, RuntimeEnabled=ExperimentalCanvasFeatures] attribute SV
GMatrix currentTransform; | 35 [TypeChecking=Interface|Nullable|String, RuntimeEnabled=ExperimentalCanvasFe
atures] attribute SVGMatrix currentTransform; |
36 void scale(float sx, float sy); | 36 void scale(float sx, float sy); |
37 void rotate(float angle); | 37 void rotate(float angle); |
38 void translate(float tx, float ty); | 38 void translate(float tx, float ty); |
39 void transform(float m11, float m12, float m21, float m22, float dx, float d
y); | 39 void transform(float m11, float m12, float m21, float m22, float dx, float d
y); |
40 void setTransform(float m11, float m12, float m21, float m22, float dx, floa
t dy); | 40 void setTransform(float m11, float m12, float m21, float m22, float dx, floa
t dy); |
41 void resetTransform(); | 41 void resetTransform(); |
42 | 42 |
43 attribute float globalAlpha; | 43 attribute float globalAlpha; |
44 [TreatNullAs=NullString] attribute DOMString globalCompositeOperation; | 44 [TreatNullAs=NullString] attribute DOMString globalCompositeOperation; |
45 | 45 |
(...skipping 16 matching lines...) Expand all Loading... |
62 | 62 |
63 void clearRect(float x, float y, float width, float height); | 63 void clearRect(float x, float y, float width, float height); |
64 void fillRect(float x, float y, float width, float height); | 64 void fillRect(float x, float y, float width, float height); |
65 | 65 |
66 void beginPath(); | 66 void beginPath(); |
67 | 67 |
68 attribute Path2D currentPath; | 68 attribute Path2D currentPath; |
69 | 69 |
70 // FIXME: Simplify these using optional CanvasWindingRule once crbug.com/339
000 gets fixed. | 70 // FIXME: Simplify these using optional CanvasWindingRule once crbug.com/339
000 gets fixed. |
71 void fill(); | 71 void fill(); |
72 [RuntimeEnabled=Path2D, StrictTypeChecking] void fill(Path2D path); | 72 [RuntimeEnabled=Path2D, TypeChecking=Interface|Nullable|String] void fill(Pa
th2D path); |
73 [StrictTypeChecking] void fill(CanvasWindingRule winding); | 73 [TypeChecking=Interface|Nullable|String] void fill(CanvasWindingRule winding
); |
74 [RuntimeEnabled=Path2D, StrictTypeChecking] void fill(Path2D path, CanvasWin
dingRule winding); | 74 [RuntimeEnabled=Path2D, TypeChecking=Interface|Nullable|String] void fill(Pa
th2D path, CanvasWindingRule winding); |
75 void stroke(); | 75 void stroke(); |
76 [RuntimeEnabled=Path2D, StrictTypeChecking] void stroke(Path2D path); | 76 [RuntimeEnabled=Path2D, TypeChecking=Interface|Nullable|String] void stroke(
Path2D path); |
77 // FIXME: Simplify these using optional CanvasWindingRule once crbug.com/339
000 gets fixed. | 77 // FIXME: Simplify these using optional CanvasWindingRule once crbug.com/339
000 gets fixed. |
78 void clip(); | 78 void clip(); |
79 [RuntimeEnabled=Path2D, StrictTypeChecking] void clip(Path2D path); | 79 [RuntimeEnabled=Path2D, TypeChecking=Interface|Nullable|String] void clip(Pa
th2D path); |
80 [StrictTypeChecking] void clip(CanvasWindingRule winding); | 80 [TypeChecking=Interface|Nullable|String] void clip(CanvasWindingRule winding
); |
81 [RuntimeEnabled=Path2D, StrictTypeChecking] void clip(Path2D path, CanvasWin
dingRule winding); | 81 [RuntimeEnabled=Path2D, TypeChecking=Interface|Nullable|String] void clip(Pa
th2D path, CanvasWindingRule winding); |
82 | 82 |
83 // FIXME: Simplify these using optional CanvasWindingRule once crbug.com/339
000 gets fixed. | 83 // FIXME: Simplify these using optional CanvasWindingRule once crbug.com/339
000 gets fixed. |
84 boolean isPointInPath(float x, float y); | 84 boolean isPointInPath(float x, float y); |
85 [RuntimeEnabled=Path2D, StrictTypeChecking] boolean isPointInPath(Path2D pat
h, float x, float y); | 85 [RuntimeEnabled=Path2D, TypeChecking=Interface|Nullable|String] boolean isPo
intInPath(Path2D path, float x, float y); |
86 [StrictTypeChecking] boolean isPointInPath(float x, float y, CanvasWindingRu
le winding); | 86 [TypeChecking=Interface|Nullable|String] boolean isPointInPath(float x, floa
t y, CanvasWindingRule winding); |
87 [RuntimeEnabled=Path2D, StrictTypeChecking] boolean isPointInPath(Path2D pat
h, float x, float y, CanvasWindingRule winding); | 87 [RuntimeEnabled=Path2D, TypeChecking=Interface|Nullable|String] boolean isPo
intInPath(Path2D path, float x, float y, CanvasWindingRule winding); |
88 boolean isPointInStroke(float x, float y); | 88 boolean isPointInStroke(float x, float y); |
89 [RuntimeEnabled=Path2D, StrictTypeChecking] boolean isPointInStroke(Path2D p
ath, float x, float y); | 89 [RuntimeEnabled=Path2D, TypeChecking=Interface|Nullable|String] boolean isPo
intInStroke(Path2D path, float x, float y); |
90 | 90 |
91 [RuntimeEnabled=ExperimentalCanvasFeatures] void scrollPathIntoView(); | 91 [RuntimeEnabled=ExperimentalCanvasFeatures] void scrollPathIntoView(); |
92 [RuntimeEnabled=ExperimentalCanvasFeatures, StrictTypeChecking] void scrollP
athIntoView(Path2D path); | 92 [RuntimeEnabled=ExperimentalCanvasFeatures, TypeChecking=Interface|Nullable|
String] void scrollPathIntoView(Path2D path); |
93 | 93 |
94 // text | 94 // text |
95 attribute DOMString font; | 95 attribute DOMString font; |
96 attribute DOMString textAlign; | 96 attribute DOMString textAlign; |
97 attribute DOMString textBaseline; | 97 attribute DOMString textBaseline; |
98 void fillText(DOMString text, float x, float y, optional float maxWidth); | 98 void fillText(DOMString text, float x, float y, optional float maxWidth); |
99 void strokeText(DOMString text, float x, float y, optional float maxWidth); | 99 void strokeText(DOMString text, float x, float y, optional float maxWidth); |
100 | 100 |
101 TextMetrics measureText(DOMString text); | 101 TextMetrics measureText(DOMString text); |
102 | 102 |
103 // Context state | 103 // Context state |
104 // Should be merged with WebGL counterpart in CanvasRenderingContext, once n
o-longer experimental | 104 // Should be merged with WebGL counterpart in CanvasRenderingContext, once n
o-longer experimental |
105 [RuntimeEnabled=ExperimentalCanvasFeatures] boolean isContextLost(); | 105 [RuntimeEnabled=ExperimentalCanvasFeatures] boolean isContextLost(); |
106 | 106 |
107 void strokeRect(float x, float y, float width, float height); | 107 void strokeRect(float x, float y, float width, float height); |
108 | 108 |
109 [RaisesException, StrictTypeChecking] void drawImage(HTMLImageElement image,
float x, float y); | 109 [RaisesException, TypeChecking=Interface|Nullable|String] void drawImage(HTM
LImageElement image, float x, float y); |
110 [RaisesException, StrictTypeChecking] void drawImage(HTMLImageElement image,
float x, float y, float width, float height); | 110 [RaisesException, TypeChecking=Interface|Nullable|String] void drawImage(HTM
LImageElement image, float x, float y, float width, float height); |
111 [RaisesException, StrictTypeChecking] void drawImage(HTMLImageElement image,
float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
; | 111 [RaisesException, TypeChecking=Interface|Nullable|String] void drawImage(HTM
LImageElement image, float sx, float sy, float sw, float sh, float dx, float dy,
float dw, float dh); |
112 [RaisesException, StrictTypeChecking] void drawImage(HTMLCanvasElement canva
s, float x, float y); | 112 [RaisesException, TypeChecking=Interface|Nullable|String] void drawImage(HTM
LCanvasElement canvas, float x, float y); |
113 [RaisesException, StrictTypeChecking] void drawImage(HTMLCanvasElement canva
s, float x, float y, float width, float height); | 113 [RaisesException, TypeChecking=Interface|Nullable|String] void drawImage(HTM
LCanvasElement canvas, float x, float y, float width, float height); |
114 [RaisesException, StrictTypeChecking] void drawImage(HTMLCanvasElement canva
s, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float d
h); | 114 [RaisesException, TypeChecking=Interface|Nullable|String] void drawImage(HTM
LCanvasElement canvas, float sx, float sy, float sw, float sh, float dx, float d
y, float dw, float dh); |
115 [RaisesException, StrictTypeChecking] void drawImage(HTMLVideoElement video,
float x, float y); | 115 [RaisesException, TypeChecking=Interface|Nullable|String] void drawImage(HTM
LVideoElement video, float x, float y); |
116 [RaisesException, StrictTypeChecking] void drawImage(HTMLVideoElement video,
float x, float y, float width, float height); | 116 [RaisesException, TypeChecking=Interface|Nullable|String] void drawImage(HTM
LVideoElement video, float x, float y, float width, float height); |
117 [RaisesException, StrictTypeChecking] void drawImage(HTMLVideoElement video,
float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
; | 117 [RaisesException, TypeChecking=Interface|Nullable|String] void drawImage(HTM
LVideoElement video, float sx, float sy, float sw, float sh, float dx, float dy,
float dw, float dh); |
118 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException, StrictTypeCheck
ing] void drawImage(ImageBitmap imageBitmap, float x, float y); | 118 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException, TypeChecking=In
terface|Nullable|String] void drawImage(ImageBitmap imageBitmap, float x, float
y); |
119 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException, StrictTypeCheck
ing] void drawImage(ImageBitmap imageBitmap, float x, float y, float width, floa
t height); | 119 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException, TypeChecking=In
terface|Nullable|String] void drawImage(ImageBitmap imageBitmap, float x, float
y, float width, float height); |
120 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException, StrictTypeCheck
ing] void drawImage(ImageBitmap imageBitmap, float sx, float sy, float sw, float
sh, float dx, float dy, float dw, float dh); | 120 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException, TypeChecking=In
terface|Nullable|String] void drawImage(ImageBitmap imageBitmap, float sx, float
sy, float sw, float sh, float dx, float dy, float dw, float dh); |
121 | 121 |
122 [RaisesException, StrictTypeChecking] void putImageData(ImageData imagedata,
float dx, float dy); | 122 [RaisesException, TypeChecking=Interface|Nullable|String] void putImageData(
ImageData imagedata, float dx, float dy); |
123 [RaisesException, StrictTypeChecking] void putImageData(ImageData imagedata,
float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHe
ight); | 123 [RaisesException, TypeChecking=Interface|Nullable|String] void putImageData(
ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirty
Width, float dirtyHeight); |
124 | 124 |
125 [RaisesException, StrictTypeChecking] CanvasPattern createPattern(HTMLCanvas
Element canvas, [TreatNullAs=NullString] DOMString repetitionType); | 125 [RaisesException, TypeChecking=Interface|Nullable] CanvasPattern createPatte
rn(HTMLCanvasElement canvas, [TreatNullAs=NullString] DOMString repetitionType); |
126 [RaisesException, StrictTypeChecking] CanvasPattern createPattern(HTMLImageE
lement image, [TreatNullAs=NullString] DOMString repetitionType); | 126 [RaisesException, TypeChecking=Interface|Nullable] CanvasPattern createPatte
rn(HTMLImageElement image, [TreatNullAs=NullString] DOMString repetitionType); |
127 [RaisesException, StrictTypeChecking] CanvasPattern createPattern(HTMLVideoE
lement image, [TreatNullAs=NullString] DOMString repetitionType); | 127 [RaisesException, TypeChecking=Interface|Nullable] CanvasPattern createPatte
rn(HTMLVideoElement image, [TreatNullAs=NullString] DOMString repetitionType); |
128 [StrictTypeChecking] ImageData createImageData(ImageData imagedata); | 128 [TypeChecking=Interface|Nullable|String] ImageData createImageData(ImageData
imagedata); |
129 [RaisesException] ImageData createImageData(float sw, float sh); | 129 [RaisesException] ImageData createImageData(float sw, float sh); |
130 | 130 |
131 [Custom] attribute object strokeStyle; | 131 [Custom] attribute object strokeStyle; |
132 [Custom] attribute object fillStyle; | 132 [Custom] attribute object fillStyle; |
133 | 133 |
134 // pixel manipulation | 134 // pixel manipulation |
135 [RaisesException] ImageData getImageData(float sx, float sy, float sw, float
sh); | 135 [RaisesException] ImageData getImageData(float sx, float sy, float sw, float
sh); |
136 | 136 |
137 // Focus rings | 137 // Focus rings |
138 [RuntimeEnabled=ExperimentalCanvasFeatures, StrictTypeChecking] void drawFoc
usIfNeeded(Element element); | 138 [RuntimeEnabled=ExperimentalCanvasFeatures, TypeChecking=Interface|Nullable|
String] void drawFocusIfNeeded(Element element); |
139 [RuntimeEnabled=ExperimentalCanvasFeatures, StrictTypeChecking] void drawFoc
usIfNeeded(Path2D path, Element element); | 139 [RuntimeEnabled=ExperimentalCanvasFeatures, TypeChecking=Interface|Nullable|
String] void drawFocusIfNeeded(Path2D path, Element element); |
140 [RuntimeEnabled=ExperimentalCanvasFeatures, StrictTypeChecking] boolean draw
CustomFocusRing(Element element); | 140 [RuntimeEnabled=ExperimentalCanvasFeatures, TypeChecking=Interface|Nullable|
String] boolean drawCustomFocusRing(Element element); |
141 | 141 |
142 [ImplementedAs=imageSmoothingEnabled, MeasureAs=PrefixedImageSmoothingEnable
d] attribute boolean webkitImageSmoothingEnabled; | 142 [ImplementedAs=imageSmoothingEnabled, MeasureAs=PrefixedImageSmoothingEnable
d] attribute boolean webkitImageSmoothingEnabled; |
143 [MeasureAs=UnprefixedImageSmoothingEnabled] attribute boolean imageSmoothing
Enabled; | 143 [MeasureAs=UnprefixedImageSmoothingEnabled] attribute boolean imageSmoothing
Enabled; |
144 | 144 |
145 Canvas2DContextAttributes getContextAttributes(); | 145 Canvas2DContextAttributes getContextAttributes(); |
146 | 146 |
147 // Non-standard APIs. Candidates for deprecation | 147 // Non-standard APIs. Candidates for deprecation |
148 [MeasureAs=CanvasRenderingContext2DSetAlpha] void setAlpha(float alpha); | 148 [MeasureAs=CanvasRenderingContext2DSetAlpha] void setAlpha(float alpha); |
149 [MeasureAs=CanvasRenderingContext2DSetCompositeOperation] void setCompositeO
peration(DOMString compositeOperation); | 149 [MeasureAs=CanvasRenderingContext2DSetCompositeOperation] void setCompositeO
peration(DOMString compositeOperation); |
150 [MeasureAs=CanvasRenderingContext2DSetLineWidth] void setLineWidth(float wid
th); | 150 [MeasureAs=CanvasRenderingContext2DSetLineWidth] void setLineWidth(float wid
th); |
151 [MeasureAs=CanvasRenderingContext2DSetLineCap] void setLineCap(DOMString cap
); | 151 [MeasureAs=CanvasRenderingContext2DSetLineCap] void setLineCap(DOMString cap
); |
152 [MeasureAs=CanvasRenderingContext2DSetLineJoin] void setLineJoin(DOMString j
oin); | 152 [MeasureAs=CanvasRenderingContext2DSetLineJoin] void setLineJoin(DOMString j
oin); |
153 [MeasureAs=CanvasRenderingContext2DSetMiterLimit] void setMiterLimit(float l
imit); | 153 [MeasureAs=CanvasRenderingContext2DSetMiterLimit] void setMiterLimit(float l
imit); |
154 [MeasureAs=CanvasRenderingContext2DClearShadow] void clearShadow(); | 154 [MeasureAs=CanvasRenderingContext2DClearShadow] void clearShadow(); |
155 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor([Stri
ctTypeChecking] DOMString color, optional float alpha); | 155 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor([Type
Checking=Interface|Nullable|String] DOMString color, optional float alpha); |
156 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(float
grayLevel, optional float alpha); | 156 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(float
grayLevel, optional float alpha); |
157 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(float
r, float g, float b, float a); | 157 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(float
r, float g, float b, float a); |
158 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(float
c, float m, float y, float k, float a); | 158 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(float
c, float m, float y, float k, float a); |
159 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor([StrictTy
peChecking] DOMString color, optional float alpha); | 159 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor([TypeChec
king=Interface|Nullable|String] DOMString color, optional float alpha); |
160 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(float gra
yLevel, optional float alpha); | 160 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(float gra
yLevel, optional float alpha); |
161 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(float r,
float g, float b, float a); | 161 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(float r,
float g, float b, float a); |
162 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(float c,
float m, float y, float k, float a); | 162 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(float c,
float m, float y, float k, float a); |
163 [StrictTypeChecking, MeasureAs=CanvasRenderingContext2DDrawImageFromRect] vo
id drawImageFromRect( | 163 [TypeChecking=Interface|Nullable|String, MeasureAs=CanvasRenderingContext2DD
rawImageFromRect] void drawImageFromRect( |
164 HTMLImageElement? image, optional float sx, optional float sy, optional
float sw, optional float sh, | 164 HTMLImageElement? image, optional float sx, optional float sy, optional
float sw, optional float sh, |
165 optional float dx, optional float dy, optional float dw, optional float
dh, optional DOMString compositeOperation); | 165 optional float dx, optional float dy, optional float dw, optional float
dh, optional DOMString compositeOperation); |
166 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(float width, fl
oat height, float blur, [StrictTypeChecking] optional DOMString color, optional
float alpha); | 166 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(float width, fl
oat height, float blur, [TypeChecking=Interface|Nullable|String] optional DOMStr
ing color, optional float alpha); |
167 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(float width, fl
oat height, float blur, float grayLevel, optional float alpha); | 167 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(float width, fl
oat height, float blur, float grayLevel, optional float alpha); |
168 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(float width, fl
oat height, float blur, float r, float g, float b, float a); | 168 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(float width, fl
oat height, float blur, float r, float g, float b, float a); |
169 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(float width, fl
oat height, float blur, float c, float m, float y, float k, float a); | 169 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(float width, fl
oat height, float blur, float c, float m, float y, float k, float a); |
170 }; | 170 }; |
171 | 171 |
172 CanvasRenderingContext2D implements CanvasPathMethods; | 172 CanvasRenderingContext2D implements CanvasPathMethods; |
OLD | NEW |