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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 // transformations (default transform is the identity matrix) | 49 // transformations (default transform is the identity matrix) |
50 void scale(unrestricted float x, unrestricted float y); | 50 void scale(unrestricted float x, unrestricted float y); |
51 void rotate(unrestricted float angle); | 51 void rotate(unrestricted float angle); |
52 void translate(unrestricted float x, unrestricted float y); | 52 void translate(unrestricted float x, unrestricted float y); |
53 void transform(unrestricted float a, unrestricted float b, unrestricted floa
t c, unrestricted float d, unrestricted float e, unrestricted float f); | 53 void transform(unrestricted float a, unrestricted float b, unrestricted floa
t c, unrestricted float d, unrestricted float e, unrestricted float f); |
54 void setTransform(unrestricted float a, unrestricted float b, unrestricted f
loat c, unrestricted float d, unrestricted float e, unrestricted float f); | 54 void setTransform(unrestricted float a, unrestricted float b, unrestricted f
loat c, unrestricted float d, unrestricted float e, unrestricted float f); |
55 void resetTransform(); | 55 void resetTransform(); |
56 | 56 |
57 // image smoothing | 57 // image smoothing |
58 [MeasureAs=UnprefixedImageSmoothingEnabled] attribute boolean imageSmoothing
Enabled; | 58 attribute boolean imageSmoothingEnabled; |
59 | 59 |
60 // colors and styles (see also the CanvasDrawingStyles interface) | 60 // colors and styles (see also the CanvasDrawingStyles interface) |
61 // FIXME: Use union types when supported: http://crbug.com/372891 | 61 // FIXME: Use union types when supported: http://crbug.com/372891 |
62 [Custom] attribute object strokeStyle; // (default black) | 62 // [Custom] attribute object strokeStyle; // (default black) |
63 [Custom] attribute object fillStyle; // (default black) | 63 // [Custom] attribute object fillStyle; // (default black) |
| 64 |
| 65 attribute DOMString strokeColor; // (default black) |
| 66 attribute DOMString fillColor; // (default black) |
| 67 |
64 CanvasGradient createLinearGradient(float x0, float y0, float x1, float y1); | 68 CanvasGradient createLinearGradient(float x0, float y0, float x1, float y1); |
65 [RaisesException] CanvasGradient createRadialGradient(float x0, float y0, fl
oat r0, float x1, float y1, float r1); | 69 [RaisesException] CanvasGradient createRadialGradient(float x0, float y0, fl
oat r0, float x1, float y1, float r1); |
66 [RaisesException] CanvasPattern createPattern(HTMLCanvasElement canvas, DOMS
tring? repetitionType); | 70 [RaisesException] CanvasPattern createPattern(HTMLCanvasElement canvas, DOMS
tring? repetitionType); |
67 [RaisesException] CanvasPattern createPattern(HTMLImageElement image, DOMStr
ing? repetitionType); | 71 [RaisesException] CanvasPattern createPattern(HTMLImageElement image, DOMStr
ing? repetitionType); |
68 | 72 |
69 // shadows | 73 // shadows |
70 attribute unrestricted float shadowOffsetX; | 74 attribute unrestricted float shadowOffsetX; |
71 attribute unrestricted float shadowOffsetY; | 75 attribute unrestricted float shadowOffsetY; |
72 attribute unrestricted float shadowBlur; | 76 attribute unrestricted float shadowBlur; |
73 [TreatNullAs=NullString] attribute DOMString shadowColor; | 77 [TreatNullAs=NullString] attribute DOMString shadowColor; |
(...skipping 25 matching lines...) Expand all Loading... |
99 void strokeText(DOMString text, unrestricted float x, unrestricted float y,
optional unrestricted float maxWidth); | 103 void strokeText(DOMString text, unrestricted float x, unrestricted float y,
optional unrestricted float maxWidth); |
100 TextMetrics measureText(DOMString text); | 104 TextMetrics measureText(DOMString text); |
101 | 105 |
102 // drawing images | 106 // drawing images |
103 [RaisesException] void drawImage(HTMLImageElement image, unrestricted float
x, unrestricted float y); | 107 [RaisesException] void drawImage(HTMLImageElement image, unrestricted float
x, unrestricted float y); |
104 [RaisesException] void drawImage(HTMLImageElement image, unrestricted float
x, unrestricted float y, unrestricted float width, unrestricted float height); | 108 [RaisesException] void drawImage(HTMLImageElement image, unrestricted float
x, unrestricted float y, unrestricted float width, unrestricted float height); |
105 [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); | 109 [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); |
106 [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted floa
t x, unrestricted float y); | 110 [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted floa
t x, unrestricted float y); |
107 [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted floa
t x, unrestricted float y, unrestricted float width, unrestricted float height); | 111 [RaisesException] void drawImage(HTMLCanvasElement canvas, unrestricted floa
t x, unrestricted float y, unrestricted float width, unrestricted float height); |
108 [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); | 112 [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); |
109 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(
ImageBitmap imageBitmap, unrestricted float x, unrestricted float y); | 113 [RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float
x, unrestricted float y); |
110 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(
ImageBitmap imageBitmap, unrestricted float x, unrestricted float y, unrestricte
d float width, unrestricted float height); | 114 [RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float
x, unrestricted float y, unrestricted float width, unrestricted float height); |
111 [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); | 115 [RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float
sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrest
ricted float dx, unrestricted float dy, unrestricted float dw, unrestricted floa
t dh); |
112 | |
113 // hit regions | |
114 // FIXME: Blink does not currently support WebIDL dictionary definitions. | |
115 // See http://crbug.com/321462 | |
116 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void addHitRegi
on(optional Dictionary options); | |
117 [RuntimeEnabled=ExperimentalCanvasFeatures] void removeHitRegion(DOMString i
d); | |
118 [RuntimeEnabled=ExperimentalCanvasFeatures] void clearHitRegions(); | |
119 | 116 |
120 // pixel manipulation | 117 // pixel manipulation |
121 ImageData createImageData(ImageData imagedata); | 118 ImageData createImageData(ImageData imagedata); |
122 [RaisesException] ImageData createImageData(float sw, float sh); | 119 [RaisesException] ImageData createImageData(float sw, float sh); |
123 [RaisesException] ImageData getImageData(float sx, float sy, float sw, float
sh); | 120 [RaisesException] ImageData getImageData(float sx, float sy, float sw, float
sh); |
124 void putImageData(ImageData imagedata, float dx, float dy); | 121 void putImageData(ImageData imagedata, float dx, float dy); |
125 void putImageData(ImageData imagedata, float dx, float dy, float dirtyX, flo
at dirtyY, float dirtyWidth, float dirtyHeight); | 122 void putImageData(ImageData imagedata, float dx, float dy, float dirtyX, flo
at dirtyY, float dirtyWidth, float dirtyHeight); |
126 | 123 |
127 // Context state | 124 // Context state |
128 // Should be merged with WebGL counterpart in CanvasRenderingContext, once n
o-longer experimental | 125 // Should be merged with WebGL counterpart in CanvasRenderingContext, once n
o-longer experimental |
129 [RuntimeEnabled=ExperimentalCanvasFeatures] boolean isContextLost(); | 126 boolean isContextLost(); |
130 | 127 |
131 Canvas2DContextAttributes getContextAttributes(); | 128 Canvas2DContextAttributes getContextAttributes(); |
132 | 129 |
133 // FIXME: factor out to CanvasDrawingStyles | 130 // FIXME: factor out to CanvasDrawingStyles |
134 // line caps/joins | 131 // line caps/joins |
135 attribute unrestricted float lineWidth; // (default 1) | 132 attribute unrestricted float lineWidth; // (default 1) |
136 [TreatNullAs=NullString] attribute DOMString lineCap; // "butt", "round", "s
quare" (default "butt") | 133 [TreatNullAs=NullString] attribute DOMString lineCap; // "butt", "round", "s
quare" (default "butt") |
137 [TreatNullAs=NullString] attribute DOMString lineJoin; // "round", "bevel",
"miter" (default "miter") | 134 [TreatNullAs=NullString] attribute DOMString lineJoin; // "round", "bevel",
"miter" (default "miter") |
138 attribute unrestricted float miterLimit; // (default 10) | 135 attribute unrestricted float miterLimit; // (default 10) |
139 | 136 |
140 // dashed lines | 137 // dashed lines |
141 void setLineDash(sequence<unrestricted float> dash); | 138 void setLineDash(sequence<unrestricted float> dash); |
142 sequence<unrestricted float> getLineDash(); | 139 sequence<unrestricted float> getLineDash(); |
143 attribute unrestricted float lineDashOffset; | 140 attribute unrestricted float lineDashOffset; |
144 | 141 |
145 // text | 142 // text |
146 attribute DOMString font; // (default 10px sans-serif) | 143 attribute DOMString font; // (default 10px sans-serif) |
147 attribute DOMString textAlign; // "start", "end", "left", "right", "center"
(default: "start") | 144 attribute DOMString textAlign; // "start", "end", "left", "right", "center"
(default: "start") |
148 attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic
", "ideographic", "bottom" (default: "alphabetic") | 145 attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic
", "ideographic", "bottom" (default: "alphabetic") |
149 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute DOMString direction; /
/ "inherit", "rtl", "ltr" (default: "inherit") | 146 attribute DOMString direction; // "inherit", "rtl", "ltr" (default: "inherit
") |
150 | 147 |
151 // Non-standard APIs. Candidates for deprecation | 148 // Non-standard APIs. Candidates for deprecation |
152 // https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D | 149 // https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D |
153 [MeasureAs=CanvasRenderingContext2DSetLineWidth] void setLineWidth(unrestric
ted float width); | 150 void setLineWidth(unrestricted float width); |
154 [MeasureAs=CanvasRenderingContext2DSetLineCap] void setLineCap(DOMString cap
); | 151 void setLineCap(DOMString cap); |
155 [MeasureAs=CanvasRenderingContext2DSetLineJoin] void setLineJoin(DOMString j
oin); | 152 void setLineJoin(DOMString join); |
156 [MeasureAs=CanvasRenderingContext2DSetMiterLimit] void setMiterLimit(unrestr
icted float limit); | 153 void setMiterLimit(unrestricted float limit); |
157 [MeasureAs=CanvasRenderingContext2DClearShadow] void clearShadow(); | 154 void clearShadow(); |
158 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(DOMSt
ring color, optional unrestricted float alpha); | 155 void setStrokeColor(DOMString color, optional unrestricted float alpha); |
159 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(unres
tricted float grayLevel, optional unrestricted float alpha); | 156 void setStrokeColor(unrestricted float grayLevel, optional unrestricted floa
t alpha); |
160 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(unres
tricted float r, unrestricted float g, unrestricted float b, unrestricted float
a); | 157 void setStrokeColor(unrestricted float r, unrestricted float g, unrestricted
float b, unrestricted float a); |
161 [MeasureAs=CanvasRenderingContext2DSetStrokeColor] void setStrokeColor(unres
tricted float c, unrestricted float m, unrestricted float y, unrestricted float
k, unrestricted float a); | 158 void setStrokeColor(unrestricted float c, unrestricted float m, unrestricted
float y, unrestricted float k, unrestricted float a); |
162 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(DOMString
color, optional unrestricted float alpha); | 159 void setFillColor(DOMString color, optional unrestricted float alpha); |
163 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(unrestric
ted float grayLevel, optional unrestricted float alpha); | 160 void setFillColor(unrestricted float grayLevel, optional unrestricted float
alpha); |
164 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(unrestric
ted float r, unrestricted float g, unrestricted float b, unrestricted float a); | 161 void setFillColor(unrestricted float r, unrestricted float g, unrestricted f
loat b, unrestricted float a); |
165 [MeasureAs=CanvasRenderingContext2DSetFillColor] void setFillColor(unrestric
ted float c, unrestricted float m, unrestricted float y, unrestricted float k, u
nrestricted float a); | 162 void setFillColor(unrestricted float c, unrestricted float m, unrestricted f
loat y, unrestricted float k, unrestricted float a); |
166 [MeasureAs=CanvasRenderingContext2DDrawImageFromRect] void drawImageFromRect
( | 163 void drawImageFromRect( |
167 HTMLImageElement? image, optional unrestricted float sx, optional unrest
ricted float sy, optional unrestricted float sw, optional unrestricted float sh, | 164 HTMLImageElement? image, optional unrestricted float sx, optional unrest
ricted float sy, optional unrestricted float sw, optional unrestricted float sh, |
168 optional unrestricted float dx, optional unrestricted float dy, optional
unrestricted float dw, optional unrestricted float dh, optional DOMString compo
siteOperation); | 165 optional unrestricted float dx, optional unrestricted float dy, optional
unrestricted float dw, optional unrestricted float dh, optional DOMString compo
siteOperation); |
169 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted fl
oat width, unrestricted float height, unrestricted float blur, optional DOMStrin
g color, optional unrestricted float alpha); | 166 void setShadow(unrestricted float width, unrestricted float height, unrestri
cted float blur, optional DOMString color, optional unrestricted float alpha); |
170 [MeasureAs=CanvasRenderingContext2DSetShadow] void setShadow(unrestricted fl
oat width, unrestricted float height, unrestricted float blur, unrestricted floa
t grayLevel, optional unrestricted float alpha); | 167 void setShadow(unrestricted float width, unrestricted float height, unrestri
cted float blur, unrestricted float grayLevel, optional unrestricted float alpha
); |
171 [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); | 168 void setShadow(unrestricted float width, unrestricted float height, unrestri
cted float blur, unrestricted float r, unrestricted float g, unrestricted float
b, unrestricted float a); |
172 [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); | 169 void setShadow(unrestricted float width, unrestricted float height, unrestri
cted float blur, unrestricted float c, unrestricted float m, unrestricted float
y, unrestricted float k, unrestricted float a); |
173 }; | 170 }; |
174 | 171 |
175 CanvasRenderingContext2D implements CanvasPathMethods; | 172 CanvasRenderingContext2D implements CanvasPathMethods; |
OLD | NEW |