O'Reilly logo

Introducing Starling by Thibault Imbert

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required