Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epoxy
GitHub Repository: epoxy/proj11
Path: blob/master/SLICK_HOME/src/org/newdawn/slick/opengl/EmptyImageData.java
1461 views
1
package org.newdawn.slick.opengl;
2
3
import java.nio.ByteBuffer;
4
5
import org.lwjgl.BufferUtils;
6
7
/**
8
* An image data implementation which represents an empty texture
9
*
10
* @author kevin
11
*/
12
public class EmptyImageData implements ImageData {
13
/** The width of the data */
14
private int width;
15
/** The height of the data */
16
private int height;
17
18
/**
19
* Create an empty image data source
20
*
21
* @param width The width of the source
22
* @param height The height of the source
23
*/
24
public EmptyImageData(int width, int height) {
25
this.width = width;
26
this.height = height;
27
}
28
29
/**
30
* @see org.newdawn.slick.opengl.ImageData#getDepth()
31
*/
32
public int getDepth() {
33
return 32;
34
}
35
36
/**
37
* @see org.newdawn.slick.opengl.ImageData#getHeight()
38
*/
39
public int getHeight() {
40
return height;
41
}
42
43
/**
44
* @see org.newdawn.slick.opengl.ImageData#getImageBufferData()
45
*/
46
public ByteBuffer getImageBufferData() {
47
return BufferUtils.createByteBuffer(getTexWidth() * getTexHeight() * 4);
48
}
49
50
/**
51
* @see org.newdawn.slick.opengl.ImageData#getTexHeight()
52
*/
53
public int getTexHeight() {
54
return InternalTextureLoader.get2Fold(height);
55
}
56
57
/**
58
* @see org.newdawn.slick.opengl.ImageData#getTexWidth()
59
*/
60
public int getTexWidth() {
61
return InternalTextureLoader.get2Fold(width);
62
}
63
64
/**
65
* @see org.newdawn.slick.opengl.ImageData#getWidth()
66
*/
67
public int getWidth() {
68
return width;
69
}
70
71
}
72
73