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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 * from [source]. | 88 * from [source]. |
89 * * [drawImage](http://www.whatwg.org/specs/web-apps/current-work/multipage
/the-canvas-element.html#dom-context-2d-drawimage) | 89 * * [drawImage](http://www.whatwg.org/specs/web-apps/current-work/multipage
/the-canvas-element.html#dom-context-2d-drawimage) |
90 * from the WHATWG. | 90 * from the WHATWG. |
91 */ | 91 */ |
92 @DomName('CanvasRenderingContext2D.drawImage') | 92 @DomName('CanvasRenderingContext2D.drawImage') |
93 void drawImageToRect(CanvasImageSource source, Rect destRect, | 93 void drawImageToRect(CanvasImageSource source, Rect destRect, |
94 {Rect sourceRect}) { | 94 {Rect sourceRect}) { |
95 $if DART2JS | 95 $if DART2JS |
96 if (sourceRect == null) { | 96 if (sourceRect == null) { |
97 drawImageScaled(source, | 97 drawImageScaled(source, |
98 destRect.left, | 98 destRect.left.toDouble(), |
99 destRect.top, | 99 destRect.top.toDouble(), |
100 destRect.width, | 100 destRect.width.toDouble(), |
101 destRect.height); | 101 destRect.height.toDouble()); |
102 } else { | 102 } else { |
103 drawImageScaledFromSource(source, | 103 drawImageScaledFromSource(source, |
104 sourceRect.left, | 104 sourceRect.left.toDouble(), |
105 sourceRect.top, | 105 sourceRect.top.toDouble(), |
106 sourceRect.width, | 106 sourceRect.width.toDouble(), |
107 sourceRect.height, | 107 sourceRect.height.toDouble(), |
108 destRect.left, | 108 destRect.left.toDouble(), |
109 destRect.top, | 109 destRect.top.toDouble(), |
110 destRect.width, | 110 destRect.width.toDouble(), |
111 destRect.height); | 111 destRect.height.toDouble()); |
112 } | 112 } |
113 $else | 113 $else |
114 if (sourceRect == null) { | 114 if (sourceRect == null) { |
115 _drawImage(source, | 115 _drawImage(source, |
116 destRect.left, | 116 destRect.left.toDouble(), |
117 destRect.top, | 117 destRect.top.toDouble(), |
118 destRect.width, | 118 destRect.width.toDouble(), |
119 destRect.height); | 119 destRect.height.toDouble()); |
120 } else { | 120 } else { |
121 _drawImage(source, | 121 _drawImage(source, |
122 sourceRect.left, | 122 sourceRect.left.toDouble(), |
123 sourceRect.top, | 123 sourceRect.top.toDouble(), |
124 sourceRect.width, | 124 sourceRect.width.toDouble(), |
125 sourceRect.height, | 125 sourceRect.height.toDouble(), |
126 destRect.left, | 126 destRect.left.toDouble(), |
127 destRect.top, | 127 destRect.top.toDouble(), |
128 destRect.width, | 128 destRect.width.toDouble(), |
129 destRect.height); | 129 destRect.height.toDouble()); |
130 } | 130 } |
131 $endif | 131 $endif |
132 } | 132 } |
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 |
(...skipping 120 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 |