blob: a78940e4372dda8baaf60a186c82ff72aabcddf2 [file] [log] [blame]
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
part of $LIBRARYNAME;
$(ANNOTATIONS)$(NATIVESPEC)class $CLASSNAME$EXTENDS implements CanvasRenderingContext {
$!MEMBERS
/**
* Sets the currently bound texture to [data].
*
* [data] can be either an [ImageElement], a
* [CanvasElement], a [VideoElement], or an [ImageData] object.
*
* To use [texImage2d] with a TypedData object, use [texImage2dTyped].
*
*/
$if DART2JS
@JSName('texImage2D')
void texImage2DUntyped(int targetTexture, int levelOfDetail,
int internalFormat, int format, int type, data) native;
$else
void texImage2DUntyped(int targetTexture, int levelOfDetail,
int internalFormat, int format, int type, data) {
if (data is ImageElement) {
texImage2DImage(targetTexture, levelOfDetail, internalFormat, format,
type, data);
} else if (data is ImageData) {
texImage2DImageData(targetTexture, levelOfDetail, internalFormat, format,
type, data);
} else if (data is CanvasElement) {
texImage2DCanvas(targetTexture, levelOfDetail, internalFormat, format,
type, data);
} else {
texImage2DVideo(targetTexture, levelOfDetail, internalFormat, format,
type, data);
}
}
$endif
/**
* Sets the currently bound texture to [data].
*/
$if DART2JS
@JSName('texImage2D')
void texImage2DTyped(int targetTexture, int levelOfDetail,
int internalFormat, int width, int height, int border, int format,
int type, TypedData data) native;
$else
void texImage2DTyped(int targetTexture, int levelOfDetail, int internalFormat,
int width, int height, int border, int format, int type, TypedData data) {
texImage2D(targetTexture, levelOfDetail, internalFormat,
width, height, border, format, type, data);
}
$endif
/**
* Updates a sub-rectangle of the currently bound texture to [data].
*
* [data] can be either an [ImageElement], a
* [CanvasElement], a [VideoElement], or an [ImageData] object.
*
* To use [texSubImage2d] with a TypedData object, use [texSubImage2dTyped].
*
*/
$if DART2JS
@JSName('texSubImage2D')
void texSubImage2DUntyped(int targetTexture, int levelOfDetail,
int xOffset, int yOffset, int format, int type, data) native;
$else
void texSubImage2DUntyped(int targetTexture, int levelOfDetail,
int xOffset, int yOffset, int format, int type, data) {
texSubImage2D(targetTexture, levelOfDetail, xOffset, yOffset,
format, type, data);
}
$endif
/**
* Updates a sub-rectangle of the currently bound texture to [data].
*/
$if DART2JS
@JSName('texSubImage2D')
void texSubImage2DTyped(int targetTexture, int levelOfDetail,
int xOffset, int yOffset, int width, int height, int border, int format,
int type, TypedData data) native;
$else
void texSubImage2DTyped(int targetTexture, int levelOfDetail,
int xOffset, int yOffset, int width, int height, int format,
int type, TypedData data) {
texSubImage2D(targetTexture, levelOfDetail, xOffset, yOffset,
width, height, format, type, data);
}
$endif
}