| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // https://html.spec.whatwg.org/multipage/scripting.html#the-offscreen-2d-render
ing-context | 5 // https://html.spec.whatwg.org/multipage/scripting.html#the-offscreen-2d-render
ing-context |
| 6 | 6 |
| 7 [ | 7 [ |
| 8 Exposed=(Window,Worker), | 8 Exposed=(Window,Worker), |
| 9 RuntimeEnabled=ExperimentalCanvasFeatures, | 9 RuntimeEnabled=ExperimentalCanvasFeatures, |
| 10 ] interface OffscreenCanvasRenderingContext2D { | 10 ] interface OffscreenCanvasRenderingContext2D { |
| 11 // back-reference to the canvas | 11 // back-reference to the canvas |
| 12 [ImplementedAs=getOffscreenCanvas] readonly attribute OffscreenCanvas canvas
; | 12 [ImplementedAs=getOffscreenCanvas] readonly attribute OffscreenCanvas canvas
; |
| 13 | 13 |
| 14 [CallWith=ScriptState, RaisesException] void commit(); | 14 [CallWith=ScriptState, RaisesException] void commit(); |
| 15 | 15 |
| 16 // state |
| 17 void save(); // push state on state stack |
| 18 void restore(); // pop state stack and restore state |
| 19 |
| 20 // transformations (default transform is the identity matrix) |
| 21 void scale(unrestricted double x, unrestricted double y); |
| 22 void rotate(unrestricted double angle); |
| 23 void translate(unrestricted double x, unrestricted double y); |
| 24 void transform(unrestricted double a, unrestricted double b, unrestricted do
uble c, unrestricted double d, unrestricted double e, unrestricted double f); |
| 25 void setTransform(unrestricted double a, unrestricted double b, unrestricted
double c, unrestricted double d, unrestricted double e, unrestricted double f); |
| 26 void resetTransform(); |
| 27 |
| 28 // compositing |
| 29 attribute unrestricted double globalAlpha; // (default 1.0) |
| 30 attribute DOMString globalCompositeOperation; // (default source-over) |
| 31 [Exposed=Window] attribute DOMString filter; |
| 32 |
| 33 // image smoothing |
| 34 attribute boolean imageSmoothingEnabled; // (default True) |
| 35 attribute ImageSmoothingQuality imageSmoothingQuality; // (default "low") |
| 36 |
| 16 // colors and styles | 37 // colors and styles |
| 17 attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (de
fault black) | 38 attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (de
fault black) |
| 18 attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (defa
ult black) | 39 attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (defa
ult black) |
| 19 CanvasGradient createLinearGradient(double x0, double y0, double x1, double
y1); | 40 CanvasGradient createLinearGradient(double x0, double y0, double x1, double
y1); |
| 20 [RaisesException] CanvasGradient createRadialGradient(double x0, double y0,
double r0, double x1, double y1, double r1); | 41 [RaisesException] CanvasGradient createRadialGradient(double x0, double y0,
double r0, double x1, double y1, double r1); |
| 21 [CallWith=ExecutionContext, RaisesException] CanvasPattern? createPattern(Ca
nvasImageSource image, [TreatNullAs=NullString] DOMString repetitionType); | 42 [CallWith=ExecutionContext, RaisesException] CanvasPattern? createPattern(Ca
nvasImageSource image, [TreatNullAs=NullString] DOMString repetitionType); |
| 22 | 43 |
| 44 // shadows |
| 45 attribute unrestricted double shadowOffsetX; |
| 46 attribute unrestricted double shadowOffsetY; |
| 47 attribute unrestricted double shadowBlur; |
| 48 attribute DOMString shadowColor; |
| 49 |
| 23 // CanvasRect interface | 50 // CanvasRect interface |
| 24 void clearRect(unrestricted double x, unrestricted double y, unrestricted do
uble width, unrestricted double height); | 51 void clearRect(unrestricted double x, unrestricted double y, unrestricted do
uble width, unrestricted double height); |
| 25 void fillRect(unrestricted double x, unrestricted double y, unrestricted dou
ble width, unrestricted double height); | 52 void fillRect(unrestricted double x, unrestricted double y, unrestricted dou
ble width, unrestricted double height); |
| 26 void strokeRect(unrestricted double x, unrestricted double y, unrestricted d
ouble width, unrestricted double height); | 53 void strokeRect(unrestricted double x, unrestricted double y, unrestricted d
ouble width, unrestricted double height); |
| 27 | 54 |
| 28 // Path API (See BaseRenderingContext2D) | 55 // Path API (See BaseRenderingContext2D) |
| 29 void beginPath(); | 56 void beginPath(); |
| 30 void fill(optional CanvasFillRule winding); | 57 void fill(optional CanvasFillRule winding); |
| 31 void fill(Path2D path, optional CanvasFillRule winding); | 58 void fill(Path2D path, optional CanvasFillRule winding); |
| 32 void stroke(); | 59 void stroke(); |
| 33 void stroke(Path2D path); | 60 void stroke(Path2D path); |
| 34 void clip(); | 61 void clip(); |
| 35 void clip(Path2D path); | 62 void clip(Path2D path); |
| 36 | 63 |
| 37 // drawing images | 64 // drawing images |
| 38 [CallWith=ExecutionContext, RaisesException] void drawImage(CanvasImageSourc
e image, unrestricted double x, unrestricted double y); | 65 [CallWith=ExecutionContext, RaisesException] void drawImage(CanvasImageSourc
e image, unrestricted double x, unrestricted double y); |
| 39 [CallWith=ExecutionContext, RaisesException] void drawImage(CanvasImageSourc
e image, unrestricted double x, unrestricted double y, unrestricted double width
, unrestricted double height); | 66 [CallWith=ExecutionContext, RaisesException] void drawImage(CanvasImageSourc
e image, unrestricted double x, unrestricted double y, unrestricted double width
, unrestricted double height); |
| 40 [CallWith=ExecutionContext, RaisesException] void drawImage(CanvasImageSourc
e image, unrestricted double sx, unrestricted double sy, unrestricted double sw,
unrestricted double sh, unrestricted double dx, unrestricted double dy, unrestr
icted double dw, unrestricted double dh); | 67 [CallWith=ExecutionContext, RaisesException] void drawImage(CanvasImageSourc
e image, unrestricted double sx, unrestricted double sy, unrestricted double sw,
unrestricted double sh, unrestricted double dx, unrestricted double dy, unrestr
icted double dw, unrestricted double dh); |
| 41 | 68 |
| 69 // pixel manipulation |
| 70 [RaisesException] ImageData createImageData(ImageData imagedata); |
| 71 [RaisesException] ImageData createImageData(double sw, double sh); |
| 72 [RaisesException] ImageData getImageData(double sx, double sy, double sw, do
uble sh); |
| 73 [RaisesException] void putImageData(ImageData imagedata, double dx, double d
y); |
| 74 [RaisesException] void putImageData(ImageData imagedata, double dx, double d
y, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight); |
| 75 |
| 42 // Line caps/joins | 76 // Line caps/joins |
| 43 attribute unrestricted double lineWidth; // (default 1) | 77 attribute unrestricted double lineWidth; // (default 1) |
| 44 attribute DOMString lineCap; // "butt", "round", "square" (default "butt") | 78 attribute DOMString lineCap; // "butt", "round", "square" (default "butt") |
| 45 attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter") | 79 attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter") |
| 46 attribute unrestricted double miterLimit; // (default 10) | 80 attribute unrestricted double miterLimit; // (default 10) |
| 47 | 81 |
| 48 // dashed lines | 82 // dashed lines |
| 49 void setLineDash(sequence<unrestricted double> dash); | 83 void setLineDash(sequence<unrestricted double> dash); |
| 50 sequence<unrestricted double> getLineDash(); | 84 sequence<unrestricted double> getLineDash(); |
| 51 attribute unrestricted double lineDashOffset; | 85 attribute unrestricted double lineDashOffset; |
| 52 | |
| 53 // state | |
| 54 void save(); // push state on state stack | |
| 55 void restore(); // pop state stack and restore state | |
| 56 | |
| 57 // transformations (default transform is the identity matrix) | |
| 58 void scale(unrestricted double x, unrestricted double y); | |
| 59 void rotate(unrestricted double angle); | |
| 60 void translate(unrestricted double x, unrestricted double y); | |
| 61 void transform(unrestricted double a, unrestricted double b, unrestricted do
uble c, unrestricted double d, unrestricted double e, unrestricted double f); | |
| 62 void setTransform(unrestricted double a, unrestricted double b, unrestricted
double c, unrestricted double d, unrestricted double e, unrestricted double f); | |
| 63 void resetTransform(); | |
| 64 | |
| 65 // compositing | |
| 66 attribute unrestricted double globalAlpha; // (default 1.0) | |
| 67 attribute DOMString globalCompositeOperation; // (default source-over) | |
| 68 | |
| 69 // image smoothing | |
| 70 attribute boolean imageSmoothingEnabled; // (default True) | |
| 71 attribute ImageSmoothingQuality imageSmoothingQuality; // (default "low") | |
| 72 | |
| 73 // shadows | |
| 74 attribute unrestricted double shadowOffsetX; | |
| 75 attribute unrestricted double shadowOffsetY; | |
| 76 attribute unrestricted double shadowBlur; | |
| 77 attribute DOMString shadowColor; | |
| 78 | |
| 79 // pixel manipulation | |
| 80 [RaisesException] ImageData createImageData(ImageData imagedata); | |
| 81 [RaisesException] ImageData createImageData(double sw, double sh); | |
| 82 [RaisesException] ImageData getImageData(double sx, double sy, double sw, do
uble sh); | |
| 83 [RaisesException] void putImageData(ImageData imagedata, double dx, double d
y); | |
| 84 [RaisesException] void putImageData(ImageData imagedata, double dx, double d
y, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight); | |
| 85 | |
| 86 [Exposed=Window] attribute DOMString filter; | |
| 87 }; | 86 }; |
| 88 | 87 |
| 89 OffscreenCanvasRenderingContext2D implements CanvasPathMethods; | 88 OffscreenCanvasRenderingContext2D implements CanvasPathMethods; |
| OLD | NEW |