serializeImage function

Map<String, dynamic> serializeImage(
  1. dynamic image
)

Implementation

Map<String,dynamic> serializeImage( image ) {
	if (image is ImageElement){
		return {'image': image.src};//ImageUtils.getDataURL( image );
	}
  else {
		if ( image.data != null ) {
			return {
				"data": image.data.sublist(0),
				"width": image.width,
				"height": image.height,
				"type": image.data.runtimeType.toString()
			};

		}
    else {
			console.warning('Texture: Unable to serialize Texture.');
			return {};
		}
	}
}