| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 * The image will be drawn to an area of this canvas defined by | 55 * The image will be drawn to an area of this canvas defined by |
| 56 * [destRect]. [sourceRect] defines the region of the source image that is | 56 * [destRect]. [sourceRect] defines the region of the source image that is |
| 57 * drawn. | 57 * drawn. |
| 58 * If [sourceRect] is not provided, then | 58 * If [sourceRect] is not provided, then |
| 59 * the entire rectangular image from [source] will be drawn to this context. | 59 * the entire rectangular image from [source] will be drawn to this context. |
| 60 * | 60 * |
| 61 * If the image is larger than canvas | 61 * If the image is larger than canvas |
| 62 * will allow, the image will be clipped to fit the available space. | 62 * will allow, the image will be clipped to fit the available space. |
| 63 * | 63 * |
| 64 * CanvasElement canvas = new CanvasElement(width: 600, height: 600); | 64 * CanvasElement canvas = new CanvasElement(width: 600, height: 600); |
| 65 * CanvasRenderingContext2D ctx = canvas.context2d; | 65 * CanvasRenderingContext2D ctx = canvas.context2D; |
| 66 * ImageElement img = document.query('img'); | 66 * ImageElement img = document.query('img'); |
| 67 * img.width = 100; | 67 * img.width = 100; |
| 68 * img.height = 100; | 68 * img.height = 100; |
| 69 * | 69 * |
| 70 * // Scale the image to 20x20. | 70 * // Scale the image to 20x20. |
| 71 * ctx.drawImageToRect(img, new Rect(50, 50, 20, 20)); | 71 * ctx.drawImageToRect(img, new Rect(50, 50, 20, 20)); |
| 72 * | 72 * |
| 73 * VideoElement video = document.query('video'); | 73 * VideoElement video = document.query('video'); |
| 74 * video.width = 100; | 74 * video.width = 100; |
| 75 * video.height = 100; | 75 * video.height = 100; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 /** | 134 /** |
| 135 * Draws an image from a CanvasImageSource to this canvas. | 135 * Draws an image from a CanvasImageSource to this canvas. |
| 136 * | 136 * |
| 137 * The entire image from [source] will be drawn to this context with its top | 137 * The entire image from [source] will be drawn to this context with its top |
| 138 * left corner at the point ([destX], [destY]). If the image is | 138 * left corner at the point ([destX], [destY]). If the image is |
| 139 * larger than canvas will allow, the image will be clipped to fit the | 139 * larger than canvas will allow, the image will be clipped to fit the |
| 140 * available space. | 140 * available space. |
| 141 * | 141 * |
| 142 * CanvasElement canvas = new CanvasElement(width: 600, height: 600); | 142 * CanvasElement canvas = new CanvasElement(width: 600, height: 600); |
| 143 * CanvasRenderingContext2D ctx = canvas.context2d; | 143 * CanvasRenderingContext2D ctx = canvas.context2D; |
| 144 * ImageElement img = document.query('img'); | 144 * ImageElement img = document.query('img'); |
| 145 * | 145 * |
| 146 * ctx.drawImage(img, 100, 100); | 146 * ctx.drawImage(img, 100, 100); |
| 147 * | 147 * |
| 148 * VideoElement video = document.query('video'); | 148 * VideoElement video = document.query('video'); |
| 149 * ctx.drawImage(video, 0, 0); | 149 * ctx.drawImage(video, 0, 0); |
| 150 * | 150 * |
| 151 * CanvasElement otherCanvas = document.query('canvas'); | 151 * CanvasElement otherCanvas = document.query('canvas'); |
| 152 * otherCanvas.width = 100; | 152 * otherCanvas.width = 100; |
| 153 * otherCanvas.height = 100; | 153 * otherCanvas.height = 100; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 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 * |
| 180 * If the image is larger than canvas | 180 * If the image is larger than canvas |
| 181 * will allow, the image will be clipped to fit the available space. | 181 * will allow, the image will be clipped to fit the available space. |
| 182 * | 182 * |
| 183 * CanvasElement canvas = new CanvasElement(width: 600, height: 600); | 183 * CanvasElement canvas = new CanvasElement(width: 600, height: 600); |
| 184 * CanvasRenderingContext2D ctx = canvas.context2d; | 184 * CanvasRenderingContext2D ctx = canvas.context2D; |
| 185 * ImageElement img = document.query('img'); | 185 * ImageElement img = document.query('img'); |
| 186 * img.width = 100; | 186 * img.width = 100; |
| 187 * img.height = 100; | 187 * img.height = 100; |
| 188 * | 188 * |
| 189 * // Scale the image to 300x50 at the point (20, 20) | 189 * // Scale the image to 300x50 at the point (20, 20) |
| 190 * ctx.drawImageScaled(img, 20, 20, 300, 50); | 190 * ctx.drawImageScaled(img, 20, 20, 300, 50); |
| 191 * | 191 * |
| 192 * See also: | 192 * See also: |
| 193 * | 193 * |
| 194 * * [CanvasImageSource] for more information on what data is retrieved | 194 * * [CanvasImageSource] for more information on what data is retrieved |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |