public final class Texture

  1. Object
  2. Texture
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 types

enum Texture.WrapThe texture coordinate wrapping behavior outside the 0..1 range.
enum Texture.FilterThe sampling filter applied when the texture is scaled.

Constructors

public Texture(int width, int height)Creates a texture handle of the given dimensions.

Methods

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

Inherited methods

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 int
the texture width in pixels
height int
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 Texture.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 Texture.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 Object
the backend specific GPU resource handle