| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 8 $!MEMBERS | 8 $!MEMBERS |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 sourceRect.top, | 105 sourceRect.top, |
| 106 sourceRect.width, | 106 sourceRect.width, |
| 107 sourceRect.height, | 107 sourceRect.height, |
| 108 destRect.left, | 108 destRect.left, |
| 109 destRect.top, | 109 destRect.top, |
| 110 destRect.width, | 110 destRect.width, |
| 111 destRect.height); | 111 destRect.height); |
| 112 } | 112 } |
| 113 $else | 113 $else |
| 114 if (sourceRect == null) { | 114 if (sourceRect == null) { |
| 115 $dom_drawImage(source, | 115 _drawImage(source, |
| 116 destRect.left, | 116 destRect.left, |
| 117 destRect.top, | 117 destRect.top, |
| 118 destRect.width, | 118 destRect.width, |
| 119 destRect.height); | 119 destRect.height); |
| 120 } else { | 120 } else { |
| 121 $dom_drawImage(source, | 121 _drawImage(source, |
| 122 sourceRect.left, | 122 sourceRect.left, |
| 123 sourceRect.top, | 123 sourceRect.top, |
| 124 sourceRect.width, | 124 sourceRect.width, |
| 125 sourceRect.height, | 125 sourceRect.height, |
| 126 destRect.left, | 126 destRect.left, |
| 127 destRect.top, | 127 destRect.top, |
| 128 destRect.width, | 128 destRect.width, |
| 129 destRect.height); | 129 destRect.height); |
| 130 } | 130 } |
| 131 $endif | 131 $endif |
| (...skipping 27 matching lines...) Expand all Loading... |
| 159 * from [source]. | 159 * from [source]. |
| 160 * * [drawImage](http://www.whatwg.org/specs/web-apps/current-work/multipage
/the-canvas-element.html#dom-context-2d-drawimage) | 160 * * [drawImage](http://www.whatwg.org/specs/web-apps/current-work/multipage
/the-canvas-element.html#dom-context-2d-drawimage) |
| 161 * from the WHATWG. | 161 * from the WHATWG. |
| 162 */ | 162 */ |
| 163 @DomName('CanvasRenderingContext2D.drawImage') | 163 @DomName('CanvasRenderingContext2D.drawImage') |
| 164 $if DART2JS | 164 $if DART2JS |
| 165 @JSName('drawImage') | 165 @JSName('drawImage') |
| 166 void drawImage(CanvasImageSource source, num destX, num destY) native; | 166 void drawImage(CanvasImageSource source, num destX, num destY) native; |
| 167 $else | 167 $else |
| 168 void drawImage(CanvasImageSource source, num destX, num destY) { | 168 void drawImage(CanvasImageSource source, num destX, num destY) { |
| 169 $dom_drawImage(source, destX, destY); | 169 _drawImage(source, destX, destY); |
| 170 } | 170 } |
| 171 $endif | 171 $endif |
| 172 | 172 |
| 173 /** | 173 /** |
| 174 * Draws an image from a CanvasImageSource to an area of this canvas. | 174 * Draws an image from a CanvasImageSource to an area of this canvas. |
| 175 * | 175 * |
| 176 * The image will be drawn to this context with its top left corner at the | 176 * The image will be drawn to this context with its top left corner at the |
| 177 * point ([destX], [destY]) and will be scaled to be [destWidth] wide and | 177 * point ([destX], [destY]) and will be scaled to be [destWidth] wide and |
| 178 * [destHeight] tall. | 178 * [destHeight] tall. |
| 179 * | 179 * |
| (...skipping 17 matching lines...) Expand all Loading... |
| 197 * from the WHATWG. | 197 * from the WHATWG. |
| 198 */ | 198 */ |
| 199 @DomName('CanvasRenderingContext2D.drawImage') | 199 @DomName('CanvasRenderingContext2D.drawImage') |
| 200 $if DART2JS | 200 $if DART2JS |
| 201 @JSName('drawImage') | 201 @JSName('drawImage') |
| 202 void drawImageScaled(CanvasImageSource source, | 202 void drawImageScaled(CanvasImageSource source, |
| 203 num destX, num destY, num destWidth, num destHeight) native; | 203 num destX, num destY, num destWidth, num destHeight) native; |
| 204 $else | 204 $else |
| 205 void drawImageScaled(CanvasImageSource source, | 205 void drawImageScaled(CanvasImageSource source, |
| 206 num destX, num destY, num destWidth, num destHeight) { | 206 num destX, num destY, num destWidth, num destHeight) { |
| 207 $dom_drawImage(source, destX, destY, destWidth, destHeight); | 207 _drawImage(source, destX, destY, destWidth, destHeight); |
| 208 } | 208 } |
| 209 $endif | 209 $endif |
| 210 | 210 |
| 211 /** | 211 /** |
| 212 * Draws an image from a CanvasImageSource to an area of this canvas. | 212 * Draws an image from a CanvasImageSource to an area of this canvas. |
| 213 * | 213 * |
| 214 * The image is a region of [source] that is [sourceWidth] wide and | 214 * The image is a region of [source] that is [sourceWidth] wide and |
| 215 * [destHeight] tall with top left corner at ([sourceX], [sourceY]). | 215 * [destHeight] tall with top left corner at ([sourceX], [sourceY]). |
| 216 * The image will be drawn to this context with its top left corner at the | 216 * The image will be drawn to this context with its top left corner at the |
| 217 * point ([destX], [destY]) and will be scaled to be [destWidth] wide and | 217 * point ([destX], [destY]) and will be scaled to be [destWidth] wide and |
| (...skipping 22 matching lines...) Expand all Loading... |
| 240 @DomName('CanvasRenderingContext2D.drawImage') | 240 @DomName('CanvasRenderingContext2D.drawImage') |
| 241 $if DART2JS | 241 $if DART2JS |
| 242 @JSName('drawImage') | 242 @JSName('drawImage') |
| 243 void drawImageScaledFromSource(CanvasImageSource source, | 243 void drawImageScaledFromSource(CanvasImageSource source, |
| 244 num sourceX, num sourceY, num sourceWidth, num sourceHeight, | 244 num sourceX, num sourceY, num sourceWidth, num sourceHeight, |
| 245 num destX, num destY, num destWidth, num destHeight) native; | 245 num destX, num destY, num destWidth, num destHeight) native; |
| 246 $else | 246 $else |
| 247 void drawImageScaledFromSource(CanvasImageSource source, | 247 void drawImageScaledFromSource(CanvasImageSource source, |
| 248 num sourceX, num sourceY, num sourceWidth, num sourceHeight, | 248 num sourceX, num sourceY, num sourceWidth, num sourceHeight, |
| 249 num destX, num destY, num destWidth, num destHeight) { | 249 num destX, num destY, num destWidth, num destHeight) { |
| 250 $dom_drawImage(source, sourceX, sourceY, sourceWidth, sourceHeight, | 250 _drawImage(source, sourceX, sourceY, sourceWidth, sourceHeight, |
| 251 destX, destY, destWidth, destHeight); | 251 destX, destY, destWidth, destHeight); |
| 252 } | 252 } |
| 253 $endif | 253 $endif |
| 254 | 254 |
| 255 $if DART2JS | 255 $if DART2JS |
| 256 @DomName('CanvasRenderingContext2D.lineDashOffset') | 256 @DomName('CanvasRenderingContext2D.lineDashOffset') |
| 257 num get lineDashOffset => JS('num', | 257 num get lineDashOffset => JS('num', |
| 258 '#.lineDashOffset || #.webkitLineDashOffset', this, this); | 258 '#.lineDashOffset || #.webkitLineDashOffset', this, this); |
| 259 | 259 |
| 260 @DomName('CanvasRenderingContext2D.lineDashOffset') | 260 @DomName('CanvasRenderingContext2D.lineDashOffset') |
| 261 void set lineDashOffset(num value) => JS('void', | 261 void set lineDashOffset(num value) => JS('void', |
| 262 'typeof #.lineDashOffset != "undefined" ? #.lineDashOffset = # : ' | 262 'typeof #.lineDashOffset != "undefined" ? #.lineDashOffset = # : ' |
| 263 '#.webkitLineDashOffset = #', this, this, value, this, value); | 263 '#.webkitLineDashOffset = #', this, this, value, this, value); |
| 264 $else | 264 $else |
| 265 // TODO(amouravski): Add Dartium native methods for drawImage once we figure | 265 // TODO(amouravski): Add Dartium native methods for drawImage once we figure |
| 266 // out how to not break native bindings. | 266 // out how to not break native bindings. |
| 267 $endif | 267 $endif |
| 268 } | 268 } |
| 269 | 269 |
| OLD | NEW |