package advent.core; import org.robovm.apple.uikit.*; import org.robovm.apple.coregraphics.*; import org.robovm.apple.foundation.*; import com.badlogic.gdx.*; import com.badlogic.gdx.graphics.*; import com.badlogic.gdx.backends.iosrobovm.*; public class Saver { public static Pixmap flipPixmap(Pixmap src) { final int width = src.getWidth(); final int height = src.getHeight(); Pixmap flipped = new Pixmap(width, height, src.getFormat()); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { flipped.drawPixel(x, y, src.getPixel(x, height - y -1)); } } return flipped; } public static UIImage takeScreenshot(){ UIImage newImage; //((IOSApplication) Gdx.app).getUIViewController().getView().setTransform(CGAffineTransform.createScale(1, -1)); UIView view = ((IOSApplication) Gdx.app).getUIViewController().getView(); UIGraphics.beginImageContext(new CGSize(view.getFrame().getWidth(), view.getFrame().getHeight()), true, 0.0); view.drawViewHierarchy( new CGRect(0, 0, view.getFrame().getWidth(), view.getFrame().getHeight()), true); newImage = UIGraphics.getImageFromCurrentImageContext(); UIGraphics.endImageContext(); //((IOSApplication) Gdx.app).getUIViewController().getView().setTransform(CGAffineTransform.createScale(1, 1)); return newImage; } }