CanvasRenderingContext2D.hx 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * Copyright (C)2005-2018 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. {
  32. var canvas(default,null) : CanvasElement;
  33. var globalAlpha : Float;
  34. var globalCompositeOperation : String;
  35. var strokeStyle : haxe.extern.EitherType<String,haxe.extern.EitherType<CanvasGradient,CanvasPattern>>;
  36. var fillStyle : haxe.extern.EitherType<String,haxe.extern.EitherType<CanvasGradient,CanvasPattern>>;
  37. var shadowOffsetX : Float;
  38. var shadowOffsetY : Float;
  39. var shadowBlur : Float;
  40. var shadowColor : String;
  41. var filter : String;
  42. var imageSmoothingEnabled : Bool;
  43. var lineWidth : Float;
  44. var lineCap : String;
  45. var lineJoin : String;
  46. var miterLimit : Float;
  47. var lineDashOffset : Float;
  48. var font : String;
  49. var textAlign : String;
  50. var textBaseline : String;
  51. function save() : Void;
  52. function restore() : Void;
  53. /** @throws DOMError */
  54. function scale( x : Float, y : Float ) : Void;
  55. /** @throws DOMError */
  56. function rotate( angle : Float ) : Void;
  57. /** @throws DOMError */
  58. function translate( x : Float, y : Float ) : Void;
  59. /** @throws DOMError */
  60. function transform( a : Float, b : Float, c : Float, d : Float, e : Float, f : Float ) : Void;
  61. /** @throws DOMError */
  62. function setTransform( a : Float, b : Float, c : Float, d : Float, e : Float, f : Float ) : Void;
  63. /** @throws DOMError */
  64. function resetTransform() : Void;
  65. function createLinearGradient( x0 : Float, y0 : Float, x1 : Float, y1 : Float ) : CanvasGradient;
  66. /** @throws DOMError */
  67. function createRadialGradient( x0 : Float, y0 : Float, r0 : Float, x1 : Float, y1 : Float, r1 : Float ) : CanvasGradient;
  68. /** @throws DOMError */
  69. function createPattern( image : haxe.extern.EitherType<ImageElement,haxe.extern.EitherType<CanvasElement,haxe.extern.EitherType<VideoElement,ImageBitmap>>>, repetition : String ) : CanvasPattern;
  70. function clearRect( x : Float, y : Float, w : Float, h : Float ) : Void;
  71. function fillRect( x : Float, y : Float, w : Float, h : Float ) : Void;
  72. function strokeRect( x : Float, y : Float, w : Float, h : Float ) : Void;
  73. function beginPath() : Void;
  74. @:overload( function( ?winding : CanvasWindingRule = "nonzero" ) : Void {} )
  75. function fill( path : Path2D, ?winding : CanvasWindingRule = "nonzero" ) : Void;
  76. @:overload( function() : Void {} )
  77. function stroke( path : Path2D ) : Void;
  78. /** @throws DOMError */
  79. function drawFocusIfNeeded( element : Element ) : Void;
  80. function drawCustomFocusRing( element : Element ) : Bool;
  81. @:overload( function( ?winding : CanvasWindingRule = "nonzero" ) : Void {} )
  82. function clip( path : Path2D, ?winding : CanvasWindingRule = "nonzero" ) : Void;
  83. @:overload( function( x : Float, y : Float, ?winding : CanvasWindingRule = "nonzero" ) : Bool {} )
  84. function isPointInPath( path : Path2D, x : Float, y : Float, ?winding : CanvasWindingRule = "nonzero" ) : Bool;
  85. @:overload( function( x : Float, y : Float ) : Bool {} )
  86. function isPointInStroke( path : Path2D, x : Float, y : Float ) : Bool;
  87. /** @throws DOMError */
  88. function fillText( text : String, x : Float, y : Float, ?maxWidth : Float ) : Void;
  89. /** @throws DOMError */
  90. function strokeText( text : String, x : Float, y : Float, ?maxWidth : Float ) : Void;
  91. /** @throws DOMError */
  92. function measureText( text : String ) : TextMetrics;
  93. /** @throws DOMError */
  94. @:overload( function( image : haxe.extern.EitherType<ImageElement,haxe.extern.EitherType<CanvasElement,haxe.extern.EitherType<VideoElement,ImageBitmap>>>, dx : Float, dy : Float ) : Void {} )
  95. @:overload( function( image : haxe.extern.EitherType<ImageElement,haxe.extern.EitherType<CanvasElement,haxe.extern.EitherType<VideoElement,ImageBitmap>>>, dx : Float, dy : Float, dw : Float, dh : Float ) : Void {} )
  96. function drawImage( image : haxe.extern.EitherType<ImageElement,haxe.extern.EitherType<CanvasElement,haxe.extern.EitherType<VideoElement,ImageBitmap>>>, sx : Float, sy : Float, sw : Float, sh : Float, dx : Float, dy : Float, dw : Float, dh : Float ) : Void;
  97. /** @throws DOMError */
  98. function addHitRegion( ?options : HitRegionOptions ) : Void;
  99. function removeHitRegion( id : String ) : Void;
  100. function clearHitRegions() : Void;
  101. /** @throws DOMError */
  102. @:overload( function( sw : Float, sh : Float ) : ImageData {} )
  103. function createImageData( imagedata : ImageData ) : ImageData;
  104. /** @throws DOMError */
  105. function getImageData( sx : Float, sy : Float, sw : Float, sh : Float ) : ImageData;
  106. /** @throws DOMError */
  107. @:overload( function( imagedata : ImageData, dx : Float, dy : Float ) : Void {} )
  108. function putImageData( imagedata : ImageData, dx : Float, dy : Float, dirtyX : Float, dirtyY : Float, dirtyWidth : Float, dirtyHeight : Float ) : Void;
  109. /** @throws DOMError */
  110. function setLineDash( segments : Array<Float> ) : Void;
  111. function getLineDash() : Array<Float>;
  112. function closePath() : Void;
  113. function moveTo( x : Float, y : Float ) : Void;
  114. function lineTo( x : Float, y : Float ) : Void;
  115. function quadraticCurveTo( cpx : Float, cpy : Float, x : Float, y : Float ) : Void;
  116. function bezierCurveTo( cp1x : Float, cp1y : Float, cp2x : Float, cp2y : Float, x : Float, y : Float ) : Void;
  117. /** @throws DOMError */
  118. function arcTo( x1 : Float, y1 : Float, x2 : Float, y2 : Float, radius : Float ) : Void;
  119. function rect( x : Float, y : Float, w : Float, h : Float ) : Void;
  120. /** @throws DOMError */
  121. function arc( x : Float, y : Float, radius : Float, startAngle : Float, endAngle : Float, ?anticlockwise : Bool = false ) : Void;
  122. /** @throws DOMError */
  123. function ellipse( x : Float, y : Float, radiusX : Float, radiusY : Float, rotation : Float, startAngle : Float, endAngle : Float, ?anticlockwise : Bool = false ) : Void;
  124. }