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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 ] interface CanvasRenderingContext2D { | 42 ] interface CanvasRenderingContext2D { |
43 // back-reference to the canvas | 43 // back-reference to the canvas |
44 readonly attribute HTMLCanvasElement canvas; | 44 readonly attribute HTMLCanvasElement canvas; |
45 | 45 |
46 // state | 46 // state |
47 void save(); // push state on state stack | 47 void save(); // push state on state stack |
48 void restore(); // pop state stack and restore state | 48 void restore(); // pop state stack and restore state |
49 | 49 |
50 // transformations (default transform is the identity matrix) | 50 // transformations (default transform is the identity matrix) |
51 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute SVGMatrix currentTrans
form; | 51 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute SVGMatrix currentTrans
form; |
52 void scale(unrestricted float x, unrestricted float y); | 52 void scale(unrestricted double x, unrestricted double y); |
53 void rotate(unrestricted float angle); | 53 void rotate(unrestricted double angle); |
54 void translate(unrestricted float x, unrestricted float y); | 54 void translate(unrestricted double x, unrestricted double y); |
55 void transform(unrestricted float a, unrestricted float b, unrestricted floa
t c, unrestricted float d, unrestricted float e, unrestricted float f); | 55 void transform(unrestricted double a, unrestricted double b, unrestricted do
uble c, unrestricted double d, unrestricted double e, unrestricted double f); |
56 void setTransform(unrestricted float a, unrestricted float b, unrestricted f
loat c, unrestricted float d, unrestricted float e, unrestricted float f); | 56 void setTransform(unrestricted double a, unrestricted double b, unrestricted
double c, unrestricted double d, unrestricted double e, unrestricted double f); |
57 void resetTransform(); | 57 void resetTransform(); |
58 | 58 |
59 // compositing | 59 // compositing |
60 attribute unrestricted float globalAlpha; // (default 1.0) | 60 attribute unrestricted double globalAlpha; // (default 1.0) |
61 attribute DOMString globalCompositeOperation; // (default source-over) | 61 attribute DOMString globalCompositeOperation; // (default source-over) |
62 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute DOMString filter; // (
default 'none') | 62 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute DOMString filter; // (
default 'none') |
63 | 63 |
64 // image smoothing | 64 // image smoothing |
65 [ImplementedAs=imageSmoothingEnabled, DeprecateAs=PrefixedImageSmoothingEnab
led] attribute boolean webkitImageSmoothingEnabled; | 65 [ImplementedAs=imageSmoothingEnabled, DeprecateAs=PrefixedImageSmoothingEnab
led] attribute boolean webkitImageSmoothingEnabled; |
66 [MeasureAs=UnprefixedImageSmoothingEnabled] attribute boolean imageSmoothing
Enabled; // (default True) | 66 [MeasureAs=UnprefixedImageSmoothingEnabled] attribute boolean imageSmoothing
Enabled; // (default True) |
67 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute ImageSmoothingQuality
imageSmoothingQuality; // (default "low") | 67 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute ImageSmoothingQuality
imageSmoothingQuality; // (default "low") |
68 | 68 |
69 // colors and styles (see also the CanvasDrawingStyles interface) | 69 // colors and styles (see also the CanvasDrawingStyles interface) |
70 attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (de
fault black) | 70 attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (de
fault black) |
71 attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (defa
ult black) | 71 attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (defa
ult black) |
72 CanvasGradient createLinearGradient(float x0, float y0, float x1, float y1); | 72 CanvasGradient createLinearGradient(double x0, double y0, double x1, double
y1); |
73 [RaisesException] CanvasGradient createRadialGradient(float x0, float y0, fl
oat r0, float x1, float y1, float r1); | 73 [RaisesException] CanvasGradient createRadialGradient(double x0, double y0,
double r0, double x1, double y1, double r1); |
74 [RaisesException] CanvasPattern createPattern(CanvasImageSource image, DOMSt
ring? repetitionType); | 74 [RaisesException] CanvasPattern createPattern(CanvasImageSource image, DOMSt
ring? repetitionType); |
75 | 75 |
76 // shadows | 76 // shadows |
77 attribute unrestricted float shadowOffsetX; | 77 attribute unrestricted double shadowOffsetX; |
78 attribute unrestricted float shadowOffsetY; | 78 attribute unrestricted double shadowOffsetY; |
79 attribute unrestricted float shadowBlur; | 79 attribute unrestricted double shadowBlur; |
80 attribute DOMString shadowColor; | 80 attribute DOMString shadowColor; |
81 | 81 |
82 // rects | 82 // rects |
83 void clearRect(unrestricted float x, unrestricted float y, unrestricted floa
t width, unrestricted float height); | 83 void clearRect(unrestricted double x, unrestricted double y, unrestricted do
uble width, unrestricted double height); |
84 void fillRect(unrestricted float x, unrestricted float y, unrestricted float
width, unrestricted float height); | 84 void fillRect(unrestricted double x, unrestricted double y, unrestricted dou
ble width, unrestricted double height); |
85 void strokeRect(unrestricted float x, unrestricted float y, unrestricted flo
at width, unrestricted float height); | 85 void strokeRect(unrestricted double x, unrestricted double y, unrestricted d
ouble width, unrestricted double height); |
86 | 86 |
87 // path API (see also CanvasPathMethods) | 87 // path API (see also CanvasPathMethods) |
88 void beginPath(); | 88 void beginPath(); |
89 void fill(optional CanvasFillRule winding); | 89 void fill(optional CanvasFillRule winding); |
90 void fill(Path2D path, optional CanvasFillRule winding); | 90 void fill(Path2D path, optional CanvasFillRule winding); |
91 void stroke(); | 91 void stroke(); |
92 void stroke(Path2D path); | 92 void stroke(Path2D path); |
93 // Focus rings | 93 // Focus rings |
94 void drawFocusIfNeeded(Element element); | 94 void drawFocusIfNeeded(Element element); |
95 void drawFocusIfNeeded(Path2D path, Element element); | 95 void drawFocusIfNeeded(Path2D path, Element element); |
96 | 96 |
97 [RuntimeEnabled=ExperimentalCanvasFeatures] void scrollPathIntoView(optional
Path2D path); | 97 [RuntimeEnabled=ExperimentalCanvasFeatures] void scrollPathIntoView(optional
Path2D path); |
98 void clip(optional CanvasFillRule winding); | 98 void clip(optional CanvasFillRule winding); |
99 void clip(Path2D path, optional CanvasFillRule winding); | 99 void clip(Path2D path, optional CanvasFillRule winding); |
100 boolean isPointInPath(unrestricted float x, unrestricted float y, optional C
anvasFillRule winding); | 100 boolean isPointInPath(unrestricted double x, unrestricted double y, optional
CanvasFillRule winding); |
101 boolean isPointInPath(Path2D path, unrestricted float x, unrestricted float
y, optional CanvasFillRule winding); | 101 boolean isPointInPath(Path2D path, unrestricted double x, unrestricted doubl
e y, optional CanvasFillRule winding); |
102 boolean isPointInStroke(unrestricted float x, unrestricted float y); | 102 boolean isPointInStroke(unrestricted double x, unrestricted double y); |
103 boolean isPointInStroke(Path2D path, unrestricted float x, unrestricted floa
t y); | 103 boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted dou
ble y); |
104 | 104 |
105 // text (see also the CanvasDrawingStyles interface) | 105 // text (see also the CanvasDrawingStyles interface) |
106 void fillText(DOMString text, unrestricted float x, unrestricted float y, op
tional unrestricted float maxWidth); | 106 void fillText(DOMString text, unrestricted double x, unrestricted double y,
optional unrestricted double maxWidth); |
107 void strokeText(DOMString text, unrestricted float x, unrestricted float y,
optional unrestricted float maxWidth); | 107 void strokeText(DOMString text, unrestricted double x, unrestricted double y
, optional unrestricted double maxWidth); |
108 TextMetrics measureText(DOMString text); | 108 TextMetrics measureText(DOMString text); |
109 | 109 |
110 // drawing images | 110 // drawing images |
111 [RaisesException] void drawImage(CanvasImageSource image, unrestricted float
x, unrestricted float y); | 111 [RaisesException] void drawImage(CanvasImageSource image, unrestricted doubl
e x, unrestricted double y); |
112 [RaisesException] void drawImage(CanvasImageSource image, unrestricted float
x, unrestricted float y, unrestricted float width, unrestricted float height); | 112 [RaisesException] void drawImage(CanvasImageSource image, unrestricted doubl
e x, unrestricted double y, unrestricted double width, unrestricted double heigh
t); |
113 [RaisesException] void drawImage(CanvasImageSource image, 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); | 113 [RaisesException] void drawImage(CanvasImageSource image, unrestricted doubl
e sx, unrestricted double sy, unrestricted double sw, unrestricted double sh, un
restricted double dx, unrestricted double dy, unrestricted double dw, unrestrict
ed double dh); |
114 | 114 |
115 // hit regions | 115 // hit regions |
116 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void addHitRegi
on(optional HitRegionOptions options); | 116 [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void addHitRegi
on(optional HitRegionOptions options); |
117 [RuntimeEnabled=ExperimentalCanvasFeatures] void removeHitRegion(DOMString i
d); | 117 [RuntimeEnabled=ExperimentalCanvasFeatures] void removeHitRegion(DOMString i
d); |
118 [RuntimeEnabled=ExperimentalCanvasFeatures] void clearHitRegions(); | 118 [RuntimeEnabled=ExperimentalCanvasFeatures] void clearHitRegions(); |
119 | 119 |
120 // pixel manipulation | 120 // pixel manipulation |
121 ImageData createImageData(ImageData imagedata); | 121 ImageData createImageData(ImageData imagedata); |
122 [RaisesException] ImageData createImageData(float sw, float sh); | 122 [RaisesException] ImageData createImageData(double sw, double sh); |
123 [RaisesException] ImageData getImageData(float sx, float sy, float sw, float
sh); | 123 [RaisesException] ImageData getImageData(double sx, double sy, double sw, do
uble sh); |
124 [RaisesException] void putImageData(ImageData imagedata, float dx, float dy)
; | 124 [RaisesException] void putImageData(ImageData imagedata, double dx, double d
y); |
125 [RaisesException] void putImageData(ImageData imagedata, float dx, float dy,
float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight); | 125 [RaisesException] void putImageData(ImageData imagedata, double dx, double d
y, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight); |
126 | 126 |
127 // Context state | 127 // Context state |
128 // Should be merged with WebGL counterpart in CanvasRenderingContext, once n
o-longer experimental | 128 // Should be merged with WebGL counterpart in CanvasRenderingContext, once n
o-longer experimental |
129 [RuntimeEnabled=ExperimentalCanvasFeatures] boolean isContextLost(); | 129 [RuntimeEnabled=ExperimentalCanvasFeatures] boolean isContextLost(); |
130 | 130 |
131 Canvas2DContextAttributes getContextAttributes(); | 131 Canvas2DContextAttributes getContextAttributes(); |
132 | 132 |
133 // FIXME: factor out to CanvasDrawingStyles | 133 // FIXME: factor out to CanvasDrawingStyles |
134 // line caps/joins | 134 // line caps/joins |
135 attribute unrestricted float lineWidth; // (default 1) | 135 attribute unrestricted double lineWidth; // (default 1) |
136 attribute DOMString lineCap; // "butt", "round", "square" (default "butt") | 136 attribute DOMString lineCap; // "butt", "round", "square" (default "butt") |
137 attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter") | 137 attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter") |
138 attribute unrestricted float miterLimit; // (default 10) | 138 attribute unrestricted double miterLimit; // (default 10) |
139 | 139 |
140 // dashed lines | 140 // dashed lines |
141 void setLineDash(sequence<unrestricted float> dash); | 141 void setLineDash(sequence<unrestricted float> dash); |
142 sequence<unrestricted float> getLineDash(); | 142 sequence<unrestricted float> getLineDash(); |
143 attribute unrestricted float lineDashOffset; | 143 attribute unrestricted double lineDashOffset; |
144 | 144 |
145 // text | 145 // text |
146 attribute DOMString font; // (default 10px sans-serif) | 146 attribute DOMString font; // (default 10px sans-serif) |
147 attribute DOMString textAlign; // "start", "end", "left", "right", "center"
(default: "start") | 147 attribute DOMString textAlign; // "start", "end", "left", "right", "center"
(default: "start") |
148 attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic
", "ideographic", "bottom" (default: "alphabetic") | 148 attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic
", "ideographic", "bottom" (default: "alphabetic") |
149 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute DOMString direction; /
/ "inherit", "rtl", "ltr" (default: "inherit") | 149 [RuntimeEnabled=ExperimentalCanvasFeatures] attribute DOMString direction; /
/ "inherit", "rtl", "ltr" (default: "inherit") |
150 | 150 |
151 }; | 151 }; |
152 | 152 |
153 CanvasRenderingContext2D implements CanvasPathMethods; | 153 CanvasRenderingContext2D implements CanvasPathMethods; |
OLD | NEW |