CanvasRenderingContext2D.hx 6.7 KB

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