public class InternalTextureLoader
extends java.lang.Object
ImageData
Modifier and Type | Field and Description |
---|---|
protected static SGL |
GL
The renderer to use for all GL operations
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear out the cached textures
|
void |
clear(java.lang.String name)
Remove a particular named image from the cache
|
static java.nio.IntBuffer |
createIntBuffer(int size)
Creates an integer buffer to hold specified ints
- strictly a utility method
|
Texture |
createTexture(int width,
int height)
Create an empty texture
|
Texture |
createTexture(int width,
int height,
int filter)
Create an empty texture
|
static int |
createTextureID()
Create a new texture ID
|
static InternalTextureLoader |
get()
Get the single instance of this texture loader
|
static int |
get2Fold(int fold)
Get the closest greater power of 2 to the fold number
|
Texture |
getTexture(java.io.File source,
boolean flipped,
int filter)
Get a texture from a specific file
|
Texture |
getTexture(java.io.File source,
boolean flipped,
int filter,
int[] transparent)
Get a texture from a specific file
|
Texture |
getTexture(ImageData dataSource,
int filter)
Get a texture from a image file
|
Texture |
getTexture(java.io.InputStream in,
java.lang.String resourceName,
boolean flipped,
int filter)
Get a texture from a image file
|
TextureImpl |
getTexture(java.io.InputStream in,
java.lang.String resourceName,
boolean flipped,
int filter,
int[] transparent)
Get a texture from a image file
|
Texture |
getTexture(java.lang.String resourceName,
boolean flipped,
int filter)
Get a texture from a resource location
|
Texture |
getTexture(java.lang.String resourceName,
boolean flipped,
int filter,
int[] transparent)
Get a texture from a resource location
|
void |
reload()
Reload all the textures loaded in this loader
|
int |
reload(TextureImpl texture,
int srcPixelFormat,
int componentCount,
int minFilter,
int magFilter,
java.nio.ByteBuffer textureBuffer)
Reload a given texture blob
|
void |
set16BitMode()
Tell the loader to produce 16 bit textures
|
void |
setHoldTextureData(boolean holdTextureData)
Indicate where texture data should be held for reinitialising at a future
point.
|
protected static SGL GL
public static InternalTextureLoader get()
public void setHoldTextureData(boolean holdTextureData)
holdTextureData
- True if we should hold texture datapublic void clear(java.lang.String name)
name
- The name of the image to be clearedpublic void clear()
public void set16BitMode()
public static int createTextureID()
public Texture getTexture(java.io.File source, boolean flipped, int filter) throws java.io.IOException
source
- The file to load the texture fromflipped
- True if we should flip the texture on the y axis while loadingfilter
- The filter to usejava.io.IOException
- Indicates a failure to load the imagepublic Texture getTexture(java.io.File source, boolean flipped, int filter, int[] transparent) throws java.io.IOException
source
- The file to load the texture fromflipped
- True if we should flip the texture on the y axis while loadingfilter
- The filter to usetransparent
- The colour to interpret as transparent or null if nonejava.io.IOException
- Indicates a failure to load the imagepublic Texture getTexture(java.lang.String resourceName, boolean flipped, int filter) throws java.io.IOException
resourceName
- The location to load the texture fromflipped
- True if we should flip the texture on the y axis while loadingfilter
- The filter to use when scaling the texturejava.io.IOException
- Indicates a failure to load the imagepublic Texture getTexture(java.lang.String resourceName, boolean flipped, int filter, int[] transparent) throws java.io.IOException
resourceName
- The location to load the texture fromflipped
- True if we should flip the texture on the y axis while loadingfilter
- The filter to use when scaling the texturetransparent
- The colour to interpret as transparent or null if nonejava.io.IOException
- Indicates a failure to load the imagepublic Texture getTexture(java.io.InputStream in, java.lang.String resourceName, boolean flipped, int filter) throws java.io.IOException
in
- The stream from which we can load the imageresourceName
- The name to give this image in the internal cacheflipped
- True if we should flip the image on the y-axis while loadingfilter
- The filter to use when scaling the texturejava.io.IOException
- Indicates a failure to load the imagepublic TextureImpl getTexture(java.io.InputStream in, java.lang.String resourceName, boolean flipped, int filter, int[] transparent) throws java.io.IOException
in
- The stream from which we can load the imageresourceName
- The name to give this image in the internal cacheflipped
- True if we should flip the image on the y-axis while loadingfilter
- The filter to use when scaling the texturetransparent
- The colour to interpret as transparent or null if nonejava.io.IOException
- Indicates a failure to load the imagepublic Texture createTexture(int width, int height) throws java.io.IOException
width
- The width of the new textureheight
- The height of the new texturejava.io.IOException
- Indicates a failure to create the texture on the graphics hardwarepublic Texture createTexture(int width, int height, int filter) throws java.io.IOException
width
- The width of the new textureheight
- The height of the new texturejava.io.IOException
- Indicates a failure to create the texture on the graphics hardwarepublic Texture getTexture(ImageData dataSource, int filter) throws java.io.IOException
dataSource
- The image data to generate the texture fromfilter
- The filter to use when scaling the texturejava.io.IOException
- Indicates the texture is too big for the hardwarepublic static int get2Fold(int fold)
fold
- The target numberpublic static java.nio.IntBuffer createIntBuffer(int size)
size
- how many int to containpublic void reload()
public int reload(TextureImpl texture, int srcPixelFormat, int componentCount, int minFilter, int magFilter, java.nio.ByteBuffer textureBuffer)
texture
- The texture being reloadedsrcPixelFormat
- The source pixel formatcomponentCount
- The component countminFilter
- The minification filtermagFilter
- The magnification filtertextureBuffer
- The pixel data