CanvasRenderingContext2D.hx 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Copyright (C)2005-2015 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 28: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,VideoElement>>, 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. function drawFocusIfNeeded( element : Element ) : Void;
  74. function drawCustomFocusRing( element : Element ) : Bool;
  75. @:overload( function( ?winding : CanvasWindingRule = "nonzero" ) : Void {} )
  76. function clip( path : Path2D, ?winding : CanvasWindingRule = "nonzero" ) : Void;
  77. @:overload( function( x : Float, y : Float, ?winding : CanvasWindingRule = "nonzero" ) : Bool {} )
  78. function isPointInPath( path : Path2D, x : Float, y : Float, ?winding : CanvasWindingRule = "nonzero" ) : Bool;
  79. @:overload( function( x : Float, y : Float ) : Bool {} )
  80. function isPointInStroke( path : Path2D, x : Float, y : Float ) : Bool;
  81. /** @throws DOMError */
  82. function fillText( text : String, x : Float, y : Float, ?maxWidth : Float ) : Void;
  83. /** @throws DOMError */
  84. function strokeText( text : String, x : Float, y : Float, ?maxWidth : Float ) : Void;
  85. /** @throws DOMError */
  86. function measureText( text : String ) : TextMetrics;
  87. /** @throws DOMError */
  88. @:overload( function( image : haxe.extern.EitherType<ImageElement,haxe.extern.EitherType<CanvasElement,VideoElement>>, dx : Float, dy : Float ) : Void {} )
  89. @:overload( function( image : haxe.extern.EitherType<ImageElement,haxe.extern.EitherType<CanvasElement,VideoElement>>, dx : Float, dy : Float, dw : Float, dh : Float ) : Void {} )
  90. function drawImage( image : haxe.extern.EitherType<ImageElement,haxe.extern.EitherType<CanvasElement,VideoElement>>, sx : Float, sy : Float, sw : Float, sh : Float, dx : Float, dy : Float, dw : Float, dh : Float ) : Void;
  91. /** @throws DOMError */
  92. function addHitRegion( ?options : HitRegionOptions ) : Void;
  93. function removeHitRegion( id : String ) : Void;
  94. function clearHitRegions() : Void;
  95. /** @throws DOMError */
  96. @:overload( function( sw : Float, sh : Float ) : ImageData {} )
  97. function createImageData( imagedata : ImageData ) : ImageData;
  98. /** @throws DOMError */
  99. function getImageData( sx : Float, sy : Float, sw : Float, sh : Float ) : ImageData;
  100. /** @throws DOMError */
  101. @:overload( function( imagedata : ImageData, dx : Float, dy : Float ) : Void {} )
  102. function putImageData( imagedata : ImageData, dx : Float, dy : Float, dirtyX : Float, dirtyY : Float, dirtyWidth : Float, dirtyHeight : Float ) : Void;
  103. function setLineDash( segments : Array<Float> ) : Void;
  104. function getLineDash() : Array<Float>;
  105. function closePath() : Void;
  106. function moveTo( x : Float, y : Float ) : Void;
  107. function lineTo( x : Float, y : Float ) : Void;
  108. function quadraticCurveTo( cpx : Float, cpy : Float, x : Float, y : Float ) : Void;
  109. function bezierCurveTo( cp1x : Float, cp1y : Float, cp2x : Float, cp2y : Float, x : Float, y : Float ) : Void;
  110. /** @throws DOMError */
  111. function arcTo( x1 : Float, y1 : Float, x2 : Float, y2 : Float, radius : Float ) : Void;
  112. function rect( x : Float, y : Float, w : Float, h : Float ) : Void;
  113. /** @throws DOMError */
  114. function arc( x : Float, y : Float, radius : Float, startAngle : Float, endAngle : Float, ?anticlockwise : Bool = false ) : Void;
  115. }