Mirroring a picture

I’m trying to load in an image in to a Picture object. But I want to image to be mirrored on the Y-axis, not flipped.

I really hope someone can help me with this!

@robin0165 You have 2 choices:

  1. You could flip the picture directly, which can often be done in a simple picture viewer.
  2. Use an ImageRaster to get each pixel, write to a blank image the coordinates with inverted x-axis (thus flipping the texture over the y axis) and get the resulting picture. For exampe:

DefaultImageRaster raster = new DefaultImageRaster(yourImage, 0);
DefaultImageRaster outputRaster = new DefaultImageRaster(blankImageWithSameWidthAndHeight, 0);

for(int x = 0; x < yourImageWidth; x++) {
for(int y = 0; y < yourImageHeight; y++) {
ColorRGBA color = raster.getPixel(x, y);
outputRaster.setPixel(yourImageWidth - x, y, color);

Hope that helps!

Or… just change the texture coordinates of the Picture’ mesh. Or make a Quad yourself and switch the texture coordinates…