@Override
public void onSuccess(ImageElementResource resource) {
ImageElement image = resource.getImage();
getPrimarySurface().drawImage(image, 0, 0);
ImageDataAdapter imageData = getPrimarySurface()
.getImageData(0, 0, image.getWidth(), image.getHeight());
for (int r = 0; r < image.getWidth(); r++) {
for (int c = 0; c < image.getHeight(); c++) {
Color color = imageData.getColor(r, c);
imageData.setColor(r, c, new Color(
255 - color.getR(),
255 - color.getG(),
255 - color.getB()));
}
}