| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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)$(NATIVESPEC)class $CLASSNAME$EXTENDS implements CanvasRenderingCo
ntext { | 7 $(ANNOTATIONS)$(NATIVESPEC)class $CLASSNAME$EXTENDS implements CanvasRenderingCo
ntext { |
| 8 $!MEMBERS | 8 $!MEMBERS |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * Sets the currently bound texture to [data]. | 11 * Sets the currently bound texture to [data]. |
| 12 * | 12 * |
| 13 * [data] can be either an [ImageElement], a | 13 * [data] can be either an [ImageElement], a |
| 14 * [CanvasElement], a [VideoElement], or an [ImageData] object. | 14 * [CanvasElement], a [VideoElement], [TypedData] or an [ImageData] object. |
| 15 * | 15 * |
| 16 * To use [texImage2d] with a TypedData object, use [texImage2dTyped]. | 16 * This is deprecated in favor of [texImage2D]. |
| 17 * | |
| 18 */ | 17 */ |
| 19 $if DART2JS | 18 @Deprecated("Use texImage2D") |
| 20 @JSName('texImage2D') | 19 void texImage2DUntyped(int targetTexture, int levelOfDetail, |
| 21 void texImage2DUntyped(int targetTexture, int levelOfDetail, | |
| 22 int internalFormat, int format, int type, data) native; | |
| 23 $else | |
| 24 void texImage2DUntyped(int targetTexture, int levelOfDetail, | |
| 25 int internalFormat, int format, int type, data) { | 20 int internalFormat, int format, int type, data) { |
| 26 if (data is ImageElement) { | 21 texImage2D(targetText, levelOfDetail, internalFormat, format, type, data); |
| 27 texImage2DImage(targetTexture, levelOfDetail, internalFormat, format, | |
| 28 type, data); | |
| 29 } else if (data is ImageData) { | |
| 30 texImage2DImageData(targetTexture, levelOfDetail, internalFormat, format, | |
| 31 type, data); | |
| 32 } else if (data is CanvasElement) { | |
| 33 texImage2DCanvas(targetTexture, levelOfDetail, internalFormat, format, | |
| 34 type, data); | |
| 35 } else { | |
| 36 texImage2DVideo(targetTexture, levelOfDetail, internalFormat, format, | |
| 37 type, data); | |
| 38 } | |
| 39 } | 22 } |
| 40 $endif | |
| 41 | 23 |
| 42 /** | 24 /** |
| 43 * Sets the currently bound texture to [data]. | 25 * Sets the currently bound texture to [data]. |
| 26 * |
| 27 * This is deprecated in favour of [texImage2D]. |
| 44 */ | 28 */ |
| 45 $if DART2JS | 29 @Deprecated("Use texImage2D") |
| 46 @JSName('texImage2D') | |
| 47 void texImage2DTyped(int targetTexture, int levelOfDetail, | |
| 48 int internalFormat, int width, int height, int border, int format, | |
| 49 int type, TypedData data) native; | |
| 50 $else | |
| 51 void texImage2DTyped(int targetTexture, int levelOfDetail, int internalFormat, | 30 void texImage2DTyped(int targetTexture, int levelOfDetail, int internalFormat, |
| 52 int width, int height, int border, int format, int type, TypedData data) { | 31 int width, int height, int border, int format, int type, TypedData data) { |
| 53 texImage2D(targetTexture, levelOfDetail, internalFormat, | 32 texImage2D(targetTexture, levelOfDetail, internalFormat, |
| 54 width, height, border, format, type, data); | 33 width, height, border, format, type, data); |
| 55 } | 34 } |
| 56 $endif | |
| 57 | 35 |
| 58 /** | 36 /** |
| 59 * Updates a sub-rectangle of the currently bound texture to [data]. | 37 * Updates a sub-rectangle of the currently bound texture to [data]. |
| 60 * | 38 * |
| 61 * [data] can be either an [ImageElement], a | 39 * [data] can be either an [ImageElement], a |
| 62 * [CanvasElement], a [VideoElement], or an [ImageData] object. | 40 * [CanvasElement], a [VideoElement], [TypedData] or an [ImageData] object. |
| 63 * | |
| 64 * To use [texSubImage2d] with a TypedData object, use [texSubImage2dTyped]. | |
| 65 * | 41 * |
| 66 */ | 42 */ |
| 67 $if DART2JS | 43 @Deprecated("Use texSubImage2D") |
| 68 @JSName('texSubImage2D') | |
| 69 void texSubImage2DUntyped(int targetTexture, int levelOfDetail, | 44 void texSubImage2DUntyped(int targetTexture, int levelOfDetail, |
| 70 int xOffset, int yOffset, int format, int type, data) native; | |
| 71 $else | |
| 72 void texSubImage2DUntyped(int targetTexture, int levelOfDetail, | |
| 73 int xOffset, int yOffset, int format, int type, data) { | 45 int xOffset, int yOffset, int format, int type, data) { |
| 74 texSubImage2D(targetTexture, levelOfDetail, xOffset, yOffset, | 46 texSubImage2D(targetTexture, levelOfDetail, xOffset, yOffset, |
| 75 format, type, data); | 47 format, type, data); |
| 76 } | 48 } |
| 77 $endif | |
| 78 | 49 |
| 79 /** | 50 /** |
| 80 * Updates a sub-rectangle of the currently bound texture to [data]. | 51 * Updates a sub-rectangle of the currently bound texture to [data]. |
| 81 */ | 52 */ |
| 82 $if DART2JS | 53 @Deprecated("Use texSubImage2D") |
| 83 @JSName('texSubImage2D') | |
| 84 void texSubImage2DTyped(int targetTexture, int levelOfDetail, | 54 void texSubImage2DTyped(int targetTexture, int levelOfDetail, |
| 85 int xOffset, int yOffset, int width, int height, int border, int format, | 55 int xOffset, int yOffset, int width, int height, int border, int format, |
| 86 int type, TypedData data) native; | |
| 87 $else | |
| 88 void texSubImage2DTyped(int targetTexture, int levelOfDetail, | |
| 89 int xOffset, int yOffset, int width, int height, int format, | |
| 90 int type, TypedData data) { | 56 int type, TypedData data) { |
| 91 texSubImage2D(targetTexture, levelOfDetail, xOffset, yOffset, | 57 texSubImage2D(targetTexture, levelOfDetail, xOffset, yOffset, |
| 92 width, height, format, type, data); | 58 width, height, format, type, data); |
| 93 } | 59 } |
| 94 $endif | 60 |
| 61 /** |
| 62 * Set the bufferData to [data]. |
| 63 */ |
| 64 @Deprecated("Use bufferData") |
| 65 void bufferDataTyped(int target, TypedData data, int usage) { |
| 66 bufferData2D(targetTexture, levelOfDetail, xOffset, yOffset, |
| 67 format, type, data); |
| 68 } |
| 69 |
| 70 /** |
| 71 * Set the bufferSubData to [data]. |
| 72 */ |
| 73 @Deprecated("Use bufferSubData") |
| 74 void bufferSubDataTyped(int target, TypedData data, int usage) { |
| 75 bufferSubData2D(targetTexture, levelOfDetail, xOffset, yOffset, |
| 76 format, type, data); |
| 77 } |
| 95 } | 78 } |
| OLD | NEW |