I'm looking for a way to crop a photo taken from the users gallery to a circle, to be displayed as a profile picture basically.
I've been recommended to use Masking . But I can't work out how to actually do it. There are virtually no examples of it, except with android code. But since I'm going to port my game to IOS as well I need a Libgdx solution.
So has anyone done this before and have an working example perhaps?
Here's how I'll fetch the image:
ublic void invokeGallery() {
if (utils != null) {
loading = true;
utils.pickImage(new utilsInterface.Callback() {
@Override
public ImageHandler onImagePicked(final InputStream stream) {
loading = true;
final byte[] data;
try {
data = StreamUtils.copyStreamToByteArray(stream);
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
loading = false;
}
});
} catch (IOException e) {
e.printStackTrace();
}
loading = false;
return null;
}
});
}
}