de.lessvoid.nifty.renderer.jogl.render.JoglImageFactory Maven / Gradle / Ivy
The newest version!
package de.lessvoid.nifty.renderer.jogl.render;
import de.lessvoid.nifty.render.batch.spi.ImageFactory;
import de.lessvoid.nifty.render.batch.spi.BatchRenderBackend.Image;
import java.nio.ByteBuffer;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* @author Aaron Mahan <[email protected]>
*/
public class JoglImageFactory implements ImageFactory {
@Nonnull
@Override
public Image create(@Nullable final ByteBuffer buffer, final int imageWidth, final int imageHeight) {
return new JoglImage(buffer, imageWidth, imageHeight);
}
@Nullable
@Override
public ByteBuffer asByteBuffer(@Nullable final Image image) {
return image instanceof JoglImage ? ((JoglImage)image).getBuffer() : null;
}
}