Texture

A texture object must be created to feed an Image object. Think of it, as the relationship between Bitmap and BitmapData when using the native APIs. At anytime, when you need to create a Texture object, you need to use the Texture API, which contains the following APIs:

base

The Stage3D texture object the texture is based on.

dispose

Disposes the underlying texture data.

empty

Returns a Texture object out of dimensions (width and height).

frame

The texture frame (see class description).

fromBitmap

Returns a Texture object out of a Bitmap object. This Bitmap object can be embedded or loaded dynamically.

fromBitmapData

Returns a Texture object out of a BitmapData object.

fromAtfData

Allows the use of a compressed texture using the ATF (Adobe Texture Format). Compressed textures allows you to save a lot of memory especially on constrained environments like mobile devices.

fromTexture

Allows the use of a texture and returns a new texture.

height

The height of the texture in pixels.

mipmapping

Indicates if the texture contains mip maps.

premultipliedAlpha

Indicates if the alpha values are premultiplied into the RGB values.

repeat

Indicates if the texture should repeat like a wallpaper or stretch the outermost pixels.

width

The width of the texture in pixels.

Different image formats can be used for your textures. The following list summarizes the various formats that can be used for your textures:

PNG

As alpha channel is often required, PNG is one of the most common file format used for textures.

JPEG

The classic ...

Get Introducing Starling now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.