/
CanvasRenderingContext2D.hx
145 lines (139 loc) · 8.44 KB
/
CanvasRenderingContext2D.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
// This file is generated from mozilla\CanvasRenderingContext2D.webidl. Do not edit!
package js.html;
/**
To get an object of this interface, call `getContext()` on a `canvas element`, supplying "2d" as the argument:
Documentation [CanvasRenderingContext2D](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
@see <https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D>
**/
@:native("CanvasRenderingContext2D")
extern class CanvasRenderingContext2D {
var canvas(default,null) : CanvasElement;
var globalAlpha : Float;
var globalCompositeOperation : String;
var strokeStyle : haxe.extern.EitherType<String,haxe.extern.EitherType<CanvasGradient,CanvasPattern>>;
var fillStyle : haxe.extern.EitherType<String,haxe.extern.EitherType<CanvasGradient,CanvasPattern>>;
var filter : String;
var imageSmoothingEnabled : Bool;
var lineWidth : Float;
var lineCap : String;
var lineJoin : String;
var miterLimit : Float;
var lineDashOffset : Float;
var shadowOffsetX : Float;
var shadowOffsetY : Float;
var shadowBlur : Float;
var shadowColor : String;
var font : String;
var textAlign : String;
var textBaseline : String;
/** @throws DOMError */
@:overload( function( image : js.html.svg.ImageElement, dx : Float, dy : Float) : Void {} )
@:overload( function( image : CanvasElement, dx : Float, dy : Float) : Void {} )
@:overload( function( image : VideoElement, dx : Float, dy : Float) : Void {} )
@:overload( function( image : ImageBitmap, dx : Float, dy : Float) : Void {} )
@:overload( function( image : js.html.svg.ImageElement, dx : Float, dy : Float, dw : Float, dh : Float) : Void {} )
@:overload( function( image : CanvasElement, dx : Float, dy : Float, dw : Float, dh : Float) : Void {} )
@:overload( function( image : VideoElement, dx : Float, dy : Float, dw : Float, dh : Float) : Void {} )
@:overload( function( image : ImageBitmap, dx : Float, dy : Float, dw : Float, dh : Float) : Void {} )
@:overload( function( image : js.html.svg.ImageElement, sx : Float, sy : Float, sw : Float, sh : Float, dx : Float, dy : Float, dw : Float, dh : Float) : Void {} )
@:overload( function( image : CanvasElement, sx : Float, sy : Float, sw : Float, sh : Float, dx : Float, dy : Float, dw : Float, dh : Float) : Void {} )
@:overload( function( image : VideoElement, sx : Float, sy : Float, sw : Float, sh : Float, dx : Float, dy : Float, dw : Float, dh : Float) : Void {} )
@:overload( function( image : ImageBitmap, sx : Float, sy : Float, sw : Float, sh : Float, dx : Float, dy : Float, dw : Float, dh : Float) : Void {} )
@:overload( function( image : ImageElement, dx : Float, dy : Float ) : Void {} )
@:overload( function( image : ImageElement, dx : Float, dy : Float, dw : Float, dh : Float ) : Void {} )
function drawImage( image : ImageElement, sx : Float, sy : Float, sw : Float, sh : Float, dx : Float, dy : Float, dw : Float, dh : Float ) : Void;
function beginPath() : Void;
@:overload( function( winding : CanvasWindingRule = NONZERO ) : Void {} )
function fill( path : Path2D, winding : CanvasWindingRule = NONZERO ) : Void;
@:overload( function() : Void {} )
function stroke( path : Path2D ) : Void;
@:overload( function( winding : CanvasWindingRule = NONZERO ) : Void {} )
function clip( path : Path2D, winding : CanvasWindingRule = NONZERO ) : Void;
@:overload( function( x : Float, y : Float, winding : CanvasWindingRule = NONZERO ) : Bool {} )
function isPointInPath( path : Path2D, x : Float, y : Float, winding : CanvasWindingRule = NONZERO ) : Bool;
@:overload( function( x : Float, y : Float ) : Bool {} )
function isPointInStroke( path : Path2D, x : Float, y : Float ) : Bool;
function createLinearGradient( x0 : Float, y0 : Float, x1 : Float, y1 : Float ) : CanvasGradient;
/** @throws DOMError */
function createRadialGradient( x0 : Float, y0 : Float, r0 : Float, x1 : Float, y1 : Float, r1 : Float ) : CanvasGradient;
/** @throws DOMError */
@:overload( function( image : js.html.svg.ImageElement, repetition : String) : CanvasPattern {} )
@:overload( function( image : CanvasElement, repetition : String) : CanvasPattern {} )
@:overload( function( image : VideoElement, repetition : String) : CanvasPattern {} )
@:overload( function( image : ImageBitmap, repetition : String) : CanvasPattern {} )
function createPattern( image : ImageElement, repetition : String ) : CanvasPattern;
/** @throws DOMError */
function addHitRegion( ?options : HitRegionOptions ) : Void;
function removeHitRegion( id : String ) : Void;
function clearHitRegions() : Void;
/** @throws DOMError */
@:overload( function( sw : Float, sh : Float ) : ImageData {} )
function createImageData( imagedata : ImageData ) : ImageData;
/** @throws DOMError */
function getImageData( sx : Float, sy : Float, sw : Float, sh : Float ) : ImageData;
/** @throws DOMError */
@:overload( function( imagedata : ImageData, dx : Float, dy : Float ) : Void {} )
function putImageData( imagedata : ImageData, dx : Float, dy : Float, dirtyX : Float, dirtyY : Float, dirtyWidth : Float, dirtyHeight : Float ) : Void;
/** @throws DOMError */
function setLineDash( segments : Array<Float> ) : Void;
function getLineDash() : Array<Float>;
function closePath() : Void;
function moveTo( x : Float, y : Float ) : Void;
function lineTo( x : Float, y : Float ) : Void;
function quadraticCurveTo( cpx : Float, cpy : Float, x : Float, y : Float ) : Void;
function bezierCurveTo( cp1x : Float, cp1y : Float, cp2x : Float, cp2y : Float, x : Float, y : Float ) : Void;
/** @throws DOMError */
function arcTo( x1 : Float, y1 : Float, x2 : Float, y2 : Float, radius : Float ) : Void;
function rect( x : Float, y : Float, w : Float, h : Float ) : Void;
/** @throws DOMError */
function arc( x : Float, y : Float, radius : Float, startAngle : Float, endAngle : Float, anticlockwise : Bool = false ) : Void;
/** @throws DOMError */
function ellipse( x : Float, y : Float, radiusX : Float, radiusY : Float, rotation : Float, startAngle : Float, endAngle : Float, anticlockwise : Bool = false ) : Void;
function clearRect( x : Float, y : Float, w : Float, h : Float ) : Void;
function fillRect( x : Float, y : Float, w : Float, h : Float ) : Void;
function strokeRect( x : Float, y : Float, w : Float, h : Float ) : Void;
function save() : Void;
function restore() : Void;
/** @throws DOMError */
function fillText( text : String, x : Float, y : Float, ?maxWidth : Float ) : Void;
/** @throws DOMError */
function strokeText( text : String, x : Float, y : Float, ?maxWidth : Float ) : Void;
/** @throws DOMError */
function measureText( text : String ) : TextMetrics;
/** @throws DOMError */
function scale( x : Float, y : Float ) : Void;
/** @throws DOMError */
function rotate( angle : Float ) : Void;
/** @throws DOMError */
function translate( x : Float, y : Float ) : Void;
/** @throws DOMError */
function transform( a : Float, b : Float, c : Float, d : Float, e : Float, f : Float ) : Void;
/** @throws DOMError */
function setTransform( a : Float, b : Float, c : Float, d : Float, e : Float, f : Float ) : Void;
/** @throws DOMError */
function resetTransform() : Void;
/** @throws DOMError */
function drawFocusIfNeeded( element : Element ) : Void;
function drawCustomFocusRing( element : Element ) : Bool;
}