OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions |
| 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. |
| 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ |
| 25 |
| 26 module html { |
| 27 |
| 28 interface CanvasRenderingContext2D : CanvasRenderingContext { |
| 29 |
| 30 void save(); |
| 31 void restore(); |
| 32 |
| 33 void scale(in [Optional=DefaultIsUndefined] float sx, |
| 34 in [Optional=DefaultIsUndefined] float sy); |
| 35 void rotate(in [Optional=DefaultIsUndefined] float angle); |
| 36 void translate(in [Optional=DefaultIsUndefined] float tx, |
| 37 in [Optional=DefaultIsUndefined] float ty); |
| 38 void transform(in [Optional=DefaultIsUndefined] float m11, |
| 39 in [Optional=DefaultIsUndefined] float m12, |
| 40 in [Optional=DefaultIsUndefined] float m21, |
| 41 in [Optional=DefaultIsUndefined] float m22, |
| 42 in [Optional=DefaultIsUndefined] float dx, |
| 43 in [Optional=DefaultIsUndefined] float dy); |
| 44 void setTransform(in [Optional=DefaultIsUndefined] float m11, |
| 45 in [Optional=DefaultIsUndefined] float m12, |
| 46 in [Optional=DefaultIsUndefined] float m21, |
| 47 in [Optional=DefaultIsUndefined] float m22, |
| 48 in [Optional=DefaultIsUndefined] float dx, |
| 49 in [Optional=DefaultIsUndefined] float dy); |
| 50 |
| 51 attribute float globalAlpha; |
| 52 attribute [TreatNullAs=NullString] DOMString globalCompositeOperation; |
| 53 |
| 54 CanvasGradient createLinearGradient(in [Optional=DefaultIsUndefined] flo
at x0, |
| 55 in [Optional=DefaultIsUndefined] flo
at y0, |
| 56 in [Optional=DefaultIsUndefined] flo
at x1, |
| 57 in [Optional=DefaultIsUndefined] flo
at y1) |
| 58 raises (DOMException); |
| 59 CanvasGradient createRadialGradient(in [Optional=DefaultIsUndefined] flo
at x0, |
| 60 in [Optional=DefaultIsUndefined] flo
at y0, |
| 61 in [Optional=DefaultIsUndefined] flo
at r0, |
| 62 in [Optional=DefaultIsUndefined] flo
at x1, |
| 63 in [Optional=DefaultIsUndefined] flo
at y1, |
| 64 in [Optional=DefaultIsUndefined] flo
at r1) |
| 65 raises (DOMException); |
| 66 |
| 67 attribute float lineWidth; |
| 68 attribute [TreatNullAs=NullString] DOMString lineCap; |
| 69 attribute [TreatNullAs=NullString] DOMString lineJoin; |
| 70 attribute float miterLimit; |
| 71 |
| 72 attribute float shadowOffsetX; |
| 73 attribute float shadowOffsetY; |
| 74 attribute float shadowBlur; |
| 75 attribute [TreatNullAs=NullString] DOMString shadowColor; |
| 76 |
| 77 // FIXME: These attributes should also be implemented for V8. |
| 78 #if !(defined(V8_BINDING) && V8_BINDING) |
| 79 attribute [Custom] Array webkitLineDash; |
| 80 attribute float webkitLineDashOffset; |
| 81 #endif |
| 82 |
| 83 void clearRect(in [Optional=DefaultIsUndefined] float x, |
| 84 in [Optional=DefaultIsUndefined] float y, |
| 85 in [Optional=DefaultIsUndefined] float width, |
| 86 in [Optional=DefaultIsUndefined] float height); |
| 87 void fillRect(in [Optional=DefaultIsUndefined] float x, |
| 88 in [Optional=DefaultIsUndefined] float y, |
| 89 in [Optional=DefaultIsUndefined] float width, |
| 90 in [Optional=DefaultIsUndefined] float height); |
| 91 |
| 92 void beginPath(); |
| 93 void closePath(); |
| 94 void moveTo(in [Optional=DefaultIsUndefined] float x, |
| 95 in [Optional=DefaultIsUndefined] float y); |
| 96 void lineTo(in [Optional=DefaultIsUndefined] float x, |
| 97 in [Optional=DefaultIsUndefined] float y); |
| 98 void quadraticCurveTo(in [Optional=DefaultIsUndefined] float cpx, |
| 99 in [Optional=DefaultIsUndefined] float cpy, |
| 100 in [Optional=DefaultIsUndefined] float x, |
| 101 in [Optional=DefaultIsUndefined] float y); |
| 102 void bezierCurveTo(in [Optional=DefaultIsUndefined] float cp1x, |
| 103 in [Optional=DefaultIsUndefined] float cp1y, |
| 104 in [Optional=DefaultIsUndefined] float cp2x, |
| 105 in [Optional=DefaultIsUndefined] float cp2y, |
| 106 in [Optional=DefaultIsUndefined] float x, |
| 107 in [Optional=DefaultIsUndefined] float y); |
| 108 void arcTo(in [Optional=DefaultIsUndefined] float x1, |
| 109 in [Optional=DefaultIsUndefined] float y1, |
| 110 in [Optional=DefaultIsUndefined] float x2, |
| 111 in [Optional=DefaultIsUndefined] float y2, |
| 112 in [Optional=DefaultIsUndefined] float radius) |
| 113 raises (DOMException); |
| 114 void rect(in [Optional=DefaultIsUndefined] float x, |
| 115 in [Optional=DefaultIsUndefined] float y, |
| 116 in [Optional=DefaultIsUndefined] float width, |
| 117 in [Optional=DefaultIsUndefined] float height); |
| 118 void arc(in [Optional=DefaultIsUndefined] float x, |
| 119 in [Optional=DefaultIsUndefined] float y, |
| 120 in [Optional=DefaultIsUndefined] float radius, |
| 121 in [Optional=DefaultIsUndefined] float startAngle, |
| 122 in [Optional=DefaultIsUndefined] float endAngle, |
| 123 in [Optional=DefaultIsUndefined] boolean anticlockwise) |
| 124 raises (DOMException); |
| 125 void fill(); |
| 126 void stroke(); |
| 127 void clip(); |
| 128 boolean isPointInPath(in [Optional=DefaultIsUndefined] float x, |
| 129 in [Optional=DefaultIsUndefined] float y); |
| 130 |
| 131 // text |
| 132 attribute DOMString font; |
| 133 attribute DOMString textAlign; |
| 134 attribute DOMString textBaseline; |
| 135 |
| 136 TextMetrics measureText(in [Optional=DefaultIsUndefined] DOMString text)
; |
| 137 |
| 138 // other |
| 139 |
| 140 void setAlpha(in [Optional=DefaultIsUndefined] float alpha); |
| 141 void setCompositeOperation(in [Optional=DefaultIsUndefined] DOMString co
mpositeOperation); |
| 142 |
| 143 #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP |
| 144 void setLineWidth(in [Optional=DefaultIsUndefined] float width); |
| 145 void setLineCap(in [Optional=DefaultIsUndefined] DOMString cap); |
| 146 void setLineJoin(in [Optional=DefaultIsUndefined] DOMString join); |
| 147 void setMiterLimit(in [Optional=DefaultIsUndefined] float limit); |
| 148 #endif |
| 149 |
| 150 void clearShadow(); |
| 151 |
| 152 void fillText(in DOMString text, in float x, in float y, in [Optional] f
loat maxWidth); |
| 153 void strokeText(in DOMString text, in float x, in float y, in [Optional]
float maxWidth); |
| 154 |
| 155 void setStrokeColor(in DOMString color, in [Optional] float alpha); |
| 156 void setStrokeColor(in float grayLevel, in [Optional] float alpha); |
| 157 void setStrokeColor(in float r, in float g, in float b, in float a); |
| 158 void setStrokeColor(in float c, in float m, in float y, in float k, in f
loat a); |
| 159 |
| 160 void setFillColor(in DOMString color, in [Optional] float alpha); |
| 161 void setFillColor(in float grayLevel, in [Optional] float alpha); |
| 162 void setFillColor(in float r, in float g, in float b, in float a); |
| 163 void setFillColor(in float c, in float m, in float y, in float k, in flo
at a); |
| 164 |
| 165 void strokeRect(in [Optional=DefaultIsUndefined] float x, |
| 166 in [Optional=DefaultIsUndefined] float y, |
| 167 in [Optional=DefaultIsUndefined] float width, |
| 168 in [Optional=DefaultIsUndefined] float height, |
| 169 in [Optional] float lineWidth); |
| 170 |
| 171 void drawImage(in HTMLImageElement image, in float x, in float y) |
| 172 raises (DOMException); |
| 173 void drawImage(in HTMLImageElement image, in float x, in float y, in flo
at width, in float height) |
| 174 raises (DOMException); |
| 175 void drawImage(in HTMLImageElement image, in float sx, in float sy, in f
loat sw, in float sh, in float dx, in float dy, in float dw, in float dh) |
| 176 raises (DOMException); |
| 177 void drawImage(in HTMLCanvasElement canvas, in float x, in float y) |
| 178 raises (DOMException); |
| 179 void drawImage(in HTMLCanvasElement canvas, in float x, in float y, in f
loat width, in float height) |
| 180 raises (DOMException); |
| 181 void drawImage(in HTMLCanvasElement canvas, in float sx, in float sy, in
float sw, in float sh, in float dx, in float dy, in float dw, in float dh) |
| 182 raises (DOMException); |
| 183 #if defined(ENABLE_VIDEO) && ENABLE_VIDEO |
| 184 void drawImage(in HTMLVideoElement video, in float x, in float y) |
| 185 raises (DOMException); |
| 186 void drawImage(in HTMLVideoElement video, in float x, in float y, in flo
at width, in float height) |
| 187 raises (DOMException); |
| 188 void drawImage(in HTMLVideoElement video, in float sx, in float sy, in f
loat sw, in float sh, in float dx, in float dy, in float dw, in float dh) |
| 189 raises (DOMException); |
| 190 #endif |
| 191 |
| 192 void drawImageFromRect(in HTMLImageElement image, |
| 193 in [Optional] float sx, in [Optional] float sy, i
n [Optional] float sw, in [Optional] float sh, |
| 194 in [Optional] float dx, in [Optional] float dy, i
n [Optional] float dw, in [Optional] float dh, |
| 195 in [Optional] DOMString compositeOperation); |
| 196 |
| 197 void setShadow(in float width, in float height, in float blur, in [Optio
nal] DOMString color, in [Optional] float alpha); |
| 198 void setShadow(in float width, in float height, in float blur, in float
grayLevel, in [Optional] float alpha); |
| 199 void setShadow(in float width, in float height, in float blur, in float
r, in float g, in float b, in float a); |
| 200 void setShadow(in float width, in float height, in float blur, in float
c, in float m, in float y, in float k, in float a); |
| 201 |
| 202 void putImageData(in ImageData imagedata, in float dx, in float dy) |
| 203 raises(DOMException); |
| 204 void putImageData(in ImageData imagedata, in float dx, in float dy, in f
loat dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight) |
| 205 raises(DOMException); |
| 206 |
| 207 CanvasPattern createPattern(in HTMLCanvasElement canvas, in [TreatNullAs
=NullString] DOMString repetitionType) |
| 208 raises (DOMException); |
| 209 CanvasPattern createPattern(in HTMLImageElement image, in [TreatNullAs=N
ullString] DOMString repetitionType) |
| 210 raises (DOMException); |
| 211 ImageData createImageData(in ImageData imagedata) |
| 212 raises (DOMException); |
| 213 ImageData createImageData(in float sw, in float sh) |
| 214 raises (DOMException); |
| 215 |
| 216 attribute [Custom] custom strokeStyle; |
| 217 attribute [Custom] custom fillStyle; |
| 218 |
| 219 // pixel manipulation |
| 220 ImageData getImageData(in [Optional=DefaultIsUndefined] float sx, in [Op
tional=DefaultIsUndefined] float sy, |
| 221 in [Optional=DefaultIsUndefined] float sw, in [Op
tional=DefaultIsUndefined] float sh) |
| 222 raises(DOMException); |
| 223 }; |
| 224 |
| 225 } |
| 226 |
OLD | NEW |