mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-10 05:41:51 +09:00
Former-commit-id: 1647fa32ef6894bd7db44f741f07c2f4dcdf9054 Former-commit-id: 0e5810dcfbe1fd59b13e7cabe9f1e93c5542da2d
72 lines
1.4 KiB
Java
72 lines
1.4 KiB
Java
package org.newdawn.slick.opengl;
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
import org.lwjgl.BufferUtils;
|
|
|
|
/**
|
|
* An image data implementation which represents an empty texture
|
|
*
|
|
* @author kevin
|
|
*/
|
|
public class EmptyImageData implements ImageData {
|
|
/** The width of the data */
|
|
private int width;
|
|
/** The height of the data */
|
|
private int height;
|
|
|
|
/**
|
|
* Create an empty image data source
|
|
*
|
|
* @param width The width of the source
|
|
* @param height The height of the source
|
|
*/
|
|
public EmptyImageData(int width, int height) {
|
|
this.width = width;
|
|
this.height = height;
|
|
}
|
|
|
|
/**
|
|
* @see org.newdawn.slick.opengl.ImageData#getDepth()
|
|
*/
|
|
public int getDepth() {
|
|
return 32;
|
|
}
|
|
|
|
/**
|
|
* @see org.newdawn.slick.opengl.ImageData#getHeight()
|
|
*/
|
|
public int getHeight() {
|
|
return height;
|
|
}
|
|
|
|
/**
|
|
* @see org.newdawn.slick.opengl.ImageData#getImageBufferData()
|
|
*/
|
|
public ByteBuffer getImageBufferData() {
|
|
return BufferUtils.createByteBuffer(getTexWidth() * getTexHeight() * 4);
|
|
}
|
|
|
|
/**
|
|
* @see org.newdawn.slick.opengl.ImageData#getTexHeight()
|
|
*/
|
|
public int getTexHeight() {
|
|
return InternalTextureLoader.get2Fold(height);
|
|
}
|
|
|
|
/**
|
|
* @see org.newdawn.slick.opengl.ImageData#getTexWidth()
|
|
*/
|
|
public int getTexWidth() {
|
|
return InternalTextureLoader.get2Fold(width);
|
|
}
|
|
|
|
/**
|
|
* @see org.newdawn.slick.opengl.ImageData#getWidth()
|
|
*/
|
|
public int getWidth() {
|
|
return width;
|
|
}
|
|
|
|
}
|