Skip to content

Offscreen

An offscreen surface. This is what is usually called a render target. It can also be used as a texture. Internally, an FBO, a renderbuffer, and a texture are created. If you do not use it as a render target, there is no need to use this class. The Texture class is more memory-efficient.

Members

Constructors

Properties

Methods


Offscreen

Constructor

Arguments

Arguments Type Default Description
width int   Offscreen width.
height int   Offscreen height.

Description

Creates an offscreen surface.

Resources are released on invalidate, so explicitly invalidating the object once it is no longer needed is recommended.


width

Property \ Access: r/w

Description

Width, as specified at creation [r]


height

Property \ Access: r/w

Description

Height, as specified at creation [r]


nativeHandle

Property \ Access: r/w

Description

Platform-dependent handle [r]

Under OpenGL ES this is the texture ID.


copyRect

Method

Arguments

Arguments Type Default Description
dleft int   Left edge of the destination.
dtop int   Top edge of the destination.
src Bitmap   A Bitmap object.
srcRect Rect   Source rectangle in src.

Description

Copies a rectangle


copyRect

Method

Arguments

Arguments Type Default Description
dleft int   Left edge of the destination.
dtop int   Top edge of the destination.
src Bitmap   A Bitmap object.
sleft int   Left position of the source.
stop int   Top position of the source.
swidth int   Source width.
sheight int   Source height.

Description

Copies a rectangle


copyTo

Method

Arguments

Arguments Type Default Description
destBitmap Bitmap   Destination bitmap.
dleft int   Left edge of the destination.
dtop int   Top edge of the destination.
sleft int   Left edge of the source.
stop int   Top edge of the source.
width int   Width.
height int   Height.

Description

Copies to a Bitmap


copyTo

Method

Arguments

Arguments Type Default Description
destBitmap Bitmap   Destination bitmap.

Description

Copies to a Bitmap

The Bitmap is resized to match the size of the Offscreen.


copyTo

Method

Arguments

Arguments Type Default Description
destBitmap Bitmap   Destination bitmap.
dleft int   Left edge of the destination.
dtop int   Top edge of the destination.
srcRect Rect   Source rectangle.

Description

Copies to a Bitmap


exchangeTexture

Method

Arguments

Arguments Type Default Description
texture Texture   The Texture instance to swap with.

Description

Swaps the texture attached to the framebuffer with the texture referenced by a Texture object.

The textures being swapped must have the same size, or an exception is thrown. The color format must also be RGBA. It may be best not to swap in the middle of rendering (to be confirmed). When you do not need to draw to both, as in a crossfade, you can reduce overhead by taking out the previous image as a Texture and swapping in a new Texture.