I need help. I need display jpg image from url.
Desktop version work fine
byte[] imgBytes
new Pixmap(imgBytes, 0, imgBytes.length)
But it is not work in GWT project. I try this solution "Tainted canvases may not be loaded" Cross domain issue with WebGL textures
public void downloadPixmap(final String url, final DownloadPixmapResponse response) {
final RootPanel root = RootPanel.get("embed-html");
final Image img = new Image(url);
img.getElement().setAttribute("crossOrigin", "anonymous");
img.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
HtmlLauncher.application.getPreloader().images.put(url, ImageElement.as(img.getElement()));
response.downloadComplete(new Pixmap(Gdx.files.internal(url)));
root.remove(img);
}
});
root.add(img);
}
interface DownloadPixmapResponse {
void downloadComplete(Pixmap pixmap);
void downloadFailed(Throwable e);
}
but it is work only in Chrome browser. It is not work in Mozilla Firefox. Help me please