Implement fromBase64/loadFromBase64 for non-HTML5 targets

This commit is contained in:
Joshua Granick
2018-09-25 12:24:41 -07:00
parent bdfa59abc6
commit 84909d7aa6

View File

@@ -1,6 +1,7 @@
package lime.graphics;
import haxe.crypto.Base64;
import haxe.crypto.BaseCode;
import haxe.io.Bytes;
import haxe.io.BytesData;
@@ -1023,8 +1024,16 @@ class Image {
#else
if (base64 != null) {
return loadFromBytes (Base64.decode (base64));
} else {
return cast Future.withError ("");
}
#end
}
@@ -1671,6 +1680,15 @@ class Image {
image.addEventListener ("load", image_onLoaded, false);
image.src = "data:" + type + ";base64," + base64;
#else
if (base64 != null) {
__fromBytes (Base64.decode (base64));
}
#end
}