private static void jsLoadedCallback(ImageData pixels, int width, int height, int oWidth, int oHeight, UniCallback<Image> onComplete) { Image image = new Image(width, height, oWidth, oHeight); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) image.setPixel(x, y, new Color( pixels.getRedAt(x, y) / 255f, pixels.getGreenAt(x, y) / 255f, pixels.getBlueAt(x, y) / 255f, pixels.getAlphaAt(x, y) / 255f )); } onComplete.invoke(image); }