CanvasRenderingContext2D.hx 6.2 KB

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