# DeferredTexture (Slick - The 2D Library)
Date: 2013-06-03

## org.newdawn.slick.opengl
Class DeferredTexture

    java.lang.Object
      org.newdawn.slick.opengl.TextureImpl
          org.newdawn.slick.opengl.DeferredTexture

All Implemented Interfaces:
  DeferredResource, Texture

    public class DeferredTexture

extends TextureImpl
implements DeferredResource

A texture proxy that can be used to load a texture at a later date while still allowing elements to reference it

Author:
  kevin

Field Summary

Fields inherited from class org.newdawn.slick.opengl.TextureImpl
`GL`

Constructor Summary
`DeferredTexture(java.io.InputStream in, java.lang.String resourceName, boolean flipped, int filter, int[] trans)` Create a new deferred texture

Method Summary
`void` `bind()` Bind the GL context to a texture
`java.lang.String` `getDescription()` Get a description of the resource to be loaded
`float` `getHeight()` Get the height of the physical texture
`int` `getImageHeight()` Get the height of the original image
`int` `getImageWidth()` Get the width of the original image
`byte[]` `getTextureData()` Get the pixel data from the card for this texture
`int` `getTextureHeight()` Get the height of the actual texture
`int` `getTextureID()` Get the OpenGL texture ID for this texture
`java.lang.String` `getTextureRef()` Get the reference from which this texture was loaded
`int` `getTextureWidth()` Get the width of the actual texture
`float` `getWidth()` Get the width of the physical texture
`boolean` `hasAlpha()` Check if the texture has alpha
`void` `load()` Load the actual resource
`void` `release()` Destroy the texture reference
`void` `setAlpha(boolean alpha)` If this texture has alpha
`void` `setHeight(int height)` Set the height of the image
`void` `setTextureFilter(int textureFilter)` Apply a given texture filter to the texture
`void` `setTextureHeight(int texHeight)` Set the height of this texture
`void` `setTextureID(int textureID)` Set the OpenGL texture ID for this texture
`void` `setTextureWidth(int texWidth)` Set the width of this texture
`void` `setWidth(int width)` Set the width of the image

Methods inherited from class org.newdawn.slick.opengl.TextureImpl
`bindNone, createIntBuffer, getLastBind, reload, setCacheName, setTextureData, unbind`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DeferredTexture

    public DeferredTexture(java.io.InputStream in,
                           java.lang.String resourceName,
                           boolean flipped,
                           int filter,
                           int[] trans)

  Create a new deferred texture

  Parameters:
    `in` - The input stream from which to read the texture
    `resourceName` - The name to give the resource
    `flipped` - True if the image should be flipped
    `filter` - The filter to apply
    `trans` - The colour to defined as transparent

Method Detail

### load

    public void load()
              throws java.io.IOException

  Description copied from interface: `DeferredResource`
  Load the actual resource

  Specified by:
    `load` in interface `DeferredResource`
  Throws:
    `java.io.IOException` - Indicates a failure to load the resource
  See Also:
    `DeferredResource.load()`

### bind

    public void bind()

  Description copied from interface: `Texture`
  Bind the GL context to a texture

  Specified by:
    `bind` in interface `Texture`
  Overrides:
    `bind` in class `TextureImpl`
  See Also:
    `TextureImpl.bind()`

### getHeight

    public float getHeight()

  Description copied from interface: `Texture`
  Get the height of the physical texture

  Specified by:
    `getHeight` in interface `Texture`
  Overrides:
    `getHeight` in class `TextureImpl`
  Returns:
    The height of physical texture
  See Also:
    `TextureImpl.getHeight()`

### getImageHeight

    public int getImageHeight()

  Description copied from interface: `Texture`
  Get the height of the original image

  Specified by:
    `getImageHeight` in interface `Texture`
  Overrides:
    `getImageHeight` in class `TextureImpl`
  Returns:
    The height of the original image
  See Also:
    `TextureImpl.getImageHeight()`

### getImageWidth

    public int getImageWidth()

  Description copied from interface: `Texture`
  Get the width of the original image

  Specified by:
    `getImageWidth` in interface `Texture`
  Overrides:
    `getImageWidth` in class `TextureImpl`
  Returns:
    The width of the original image
  See Also:
    `TextureImpl.getImageWidth()`

### getTextureHeight

    public int getTextureHeight()

  Description copied from interface: `Texture`
  Get the height of the actual texture

  Specified by:
    `getTextureHeight` in interface `Texture`
  Overrides:
    `getTextureHeight` in class `TextureImpl`
  Returns:
    The height of the actual texture
  See Also:
    `TextureImpl.getTextureHeight()`

### getTextureID

    public int getTextureID()

  Description copied from interface: `Texture`
  Get the OpenGL texture ID for this texture

  Specified by:
    `getTextureID` in interface `Texture`
  Overrides:
    `getTextureID` in class `TextureImpl`
  Returns:
    The OpenGL texture ID
  See Also:
    `TextureImpl.getTextureID()`

### getTextureRef

    public java.lang.String getTextureRef()

  Description copied from interface: `Texture`
  Get the reference from which this texture was loaded

  Specified by:
    `getTextureRef` in interface `Texture`
  Overrides:
    `getTextureRef` in class `TextureImpl`
  Returns:
    The reference from which this texture was loaded
  See Also:
    `TextureImpl.getTextureRef()`

### getTextureWidth

    public int getTextureWidth()

  Description copied from interface: `Texture`
  Get the width of the actual texture

  Specified by:
    `getTextureWidth` in interface `Texture`
  Overrides:
    `getTextureWidth` in class `TextureImpl`
  Returns:
    The width of the actual texture
  See Also:
    `TextureImpl.getTextureWidth()`

### getWidth

    public float getWidth()

  Description copied from interface: `Texture`
  Get the width of the physical texture

  Specified by:
    `getWidth` in interface `Texture`
  Overrides:
    `getWidth` in class `TextureImpl`
  Returns:
    The width of physical texture
  See Also:
    `TextureImpl.getWidth()`

### release

    public void release()

  Description copied from interface: `Texture`
  Destroy the texture reference

  Specified by:
    `release` in interface `Texture`
  Overrides:
    `release` in class `TextureImpl`
  See Also:
    `TextureImpl.release()`

### setAlpha

    public void setAlpha(boolean alpha)

  Description copied from class: `TextureImpl`
  If this texture has alpha

  Overrides:
    `setAlpha` in class `TextureImpl`
  Parameters:
    `alpha` - True, If this texture has alpha
  See Also:
    `TextureImpl.setAlpha(boolean)`

### setHeight

    public void setHeight(int height)

  Description copied from class: `TextureImpl`
  Set the height of the image

  Overrides:
    `setHeight` in class `TextureImpl`
  Parameters:
    `height` - The height of the image
  See Also:
    `TextureImpl.setHeight(int)`

### setTextureHeight

    public void setTextureHeight(int texHeight)

  Description copied from class: `TextureImpl`
  Set the height of this texture

  Overrides:
    `setTextureHeight` in class `TextureImpl`
  Parameters:
    `texHeight` - The height of the texture
  See Also:
    `TextureImpl.setTextureHeight(int)`

### setTextureID

    public void setTextureID(int textureID)

  Description copied from class: `TextureImpl`
  Set the OpenGL texture ID for this texture

  Overrides:
    `setTextureID` in class `TextureImpl`
  Parameters:
    `textureID` - The OpenGL texture ID
  See Also:
    `TextureImpl.setTextureID(int)`

### setTextureWidth

    public void setTextureWidth(int texWidth)

  Description copied from class: `TextureImpl`
  Set the width of this texture

  Overrides:
    `setTextureWidth` in class `TextureImpl`
  Parameters:
    `texWidth` - The width of the texture
  See Also:
    `TextureImpl.setTextureWidth(int)`

### setWidth

    public void setWidth(int width)

  Description copied from class: `TextureImpl`
  Set the width of the image

  Overrides:
    `setWidth` in class `TextureImpl`
  Parameters:
    `width` - The width of the image
  See Also:
    `TextureImpl.setWidth(int)`

### getTextureData

    public byte[] getTextureData()

  Description copied from interface: `Texture`
  Get the pixel data from the card for this texture

  Specified by:
    `getTextureData` in interface `Texture`
  Overrides:
    `getTextureData` in class `TextureImpl`
  Returns:
    The texture data from the card for this texture
  See Also:
    `TextureImpl.getTextureData()`

### getDescription

    public java.lang.String getDescription()

  Description copied from interface: `DeferredResource`
  Get a description of the resource to be loaded

  Specified by:
    `getDescription` in interface `DeferredResource`
  Returns:
    The description of the resource to be loaded
  See Also:
    `DeferredResource.getDescription()`

### hasAlpha

    public boolean hasAlpha()

  Description copied from interface: `Texture`
  Check if the texture has alpha

  Specified by:
    `hasAlpha` in interface `Texture`
  Overrides:
    `hasAlpha` in class `TextureImpl`
  Returns:
    True if the texture has alpha
  See Also:
    `Texture.hasAlpha()`

### setTextureFilter

    public void setTextureFilter(int textureFilter)

  Description copied from interface: `Texture`
  Apply a given texture filter to the texture

  Specified by:
    `setTextureFilter` in interface `Texture`
  Overrides:
    `setTextureFilter` in class `TextureImpl`
  Parameters:
    `textureFilter` - The texture filter to apply (GL_LINEAR, GL_NEAREST, etc..)
  See Also:
    `Texture.setTextureFilter(int)`

Copyright © 2006 New Dawn Software. All Rights Reserved.