CanvasRenderingContext2D.hx 8.4 KB

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