# Class Texture

java.lang.Object
com.codename1.gpu.Texture

public final class Texture extends Object
A GPU texture. Instances are created by a `GraphicsDevice` from a Codename One `Image` or from raw ARGB pixel data and then referenced by a `Material`. The class itself is a lightweight handle; the pixel storage lives on the GPU.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `Texture.Filter`
  The sampling filter applied when the texture is scaled.
  `static enum`
  `Texture.Wrap`
  The texture coordinate wrapping behavior outside the 0..1 range.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Texture(int width, int height)`
  Creates a texture handle of the given dimensions.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Texture.Filter`
  `getFilter()`
  Returns the configured sampling filter.
  `Object`
  `getHandle()`
  Returns the opaque backend GPU handle.
  `int`
  `getHeight()`
  Returns the texture height in pixels.
  `int`
  `getWidth()`
  Returns the texture width in pixels.
  `Texture.Wrap`
  `getWrap()`
  Returns the configured wrapping mode.
  `Texture`
  `setFilter(Texture.Filter filter)`
  Sets the sampling filter.
  `void`
  `setHandle(Object handle)`
  Stores the opaque backend GPU handle.
  `Texture`
  `setWrap(Texture.Wrap wrap)`
  Sets the wrapping mode.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Texture

    public Texture(int width, int height)

    Creates a texture handle of the given dimensions. Intended for backend use; applications create textures via `GraphicsDevice`.

    ###### Parameters

    - `width`: the texture width in pixels

    - `height`: the texture height in pixels

- ## Method Details

  - ### getWidth

    public int getWidth()
    Returns the texture width in pixels.

  - ### getHeight

    public int getHeight()
    Returns the texture height in pixels.

  - ### getWrap

    public Texture.Wrap getWrap()
    Returns the configured wrapping mode.

  - ### setWrap

    public Texture setWrap(Texture.Wrap wrap)

    Sets the wrapping mode. Takes effect on the next bind by the backend.

    ###### Parameters

    - `wrap`: the wrapping mode

    ###### Returns

    this texture for chaining

  - ### getFilter

    public Texture.Filter getFilter()
    Returns the configured sampling filter.

  - ### setFilter

    public Texture setFilter(Texture.Filter filter)

    Sets the sampling filter. Takes effect on the next bind by the backend.

    ###### Parameters

    - `filter`: the sampling filter

    ###### Returns

    this texture for chaining

  - ### getHandle

    public Object getHandle()
    Returns the opaque backend GPU handle. Intended for backend use.

  - ### setHandle

    public void setHandle(Object handle)

    Stores the opaque backend GPU handle. Intended for backend use.

    ###### Parameters

    - `handle`: the backend specific GPU resource handle