load method
dynamic
load(])
override
Implementation
@override
load(url, Function onLoad, [Function? onProgress, Function? onError]) {
//print("voot"+StackTrace.current.toString());
final Texture texture = Texture();
final ImageLoader loader = ImageLoader(manager);
loader.setCrossOrigin(crossOrigin);
loader.setPath(path);
final Completer<Texture> completer = Completer<Texture>();
loader.flipY = flipY;
loader.load(url, (image) {
ImageElement imageElement;
// Web better way ???
if (kIsWeb && image is! Image) {
imageElement = ImageElement(
url: url is Blob ? "" : url,
data: image,
width: image.width!.toDouble(),
height: image.height!.toDouble());
} else {
image = image as Image;
//print("nnnn"+image.toString());
image = image.convert(format:Format.uint8,numChannels: 4);
// print(" _pixels : ${_pixels.length} ");
// print(" ------------------------------------------- ");
imageElement = ImageElement(
url: url,
data: Uint8Array.from(image.getBytes()),
width: image.width,
height: image.height);
}
//Image imagei=image;
//imagei.isNotEmpty
// print(" image.width: ${image.width} image.height: ${image.height} isntempty"+image.isNotEmpty.toString());//isJPEG: ${isJPEG} ");
texture.image = imageElement;
texture.needsUpdate = true;
onLoad(texture);
completer.complete(texture);
}, onProgress, onError);
return completer.future;
}