RenderContext
A context that allows to render objects.
The RenderContext contains the ag (Accelerated Graphics), that allow to render triangles and other primitives to the current render buffer.
When doing 2D, you should usually use the batch to buffer vertices, so they can be rendered at once when flushing.
If you plan to do a custom drawing using ag directly, you should call flush, so all the pending vertices are rendered.
If you want to perform drawing using a context allowing non-precomputed transformations you can use ctx2d.
If you need to get textures from Bitmap that are allocated and deallocated as required preventing leaks, you should use getTex.
Constructors
Properties
Allows to draw quads, sprites and nine patches using a precomputed global matrix or raw vertices
RenderContext2D similar to the one from JS, that keeps a matrix (affine transformation) and allows to draw shapes using the current matrix
Creates/gets a LineRenderBatcher associated to this
Allows to register handlers when the flush method is called
Allows to toggle whether stencil-based masks are enabled or not.
Approximate on iOS
Approximate on iOS
Functions
Flushes all the pending renderings. This is called automatically at the end of the frame. You should call this if you plan to render something else not managed via batch, so all the pending vertices are drawn.
Allocates a Texture.Base from a Bitmap. A Texture.Base doesn't have region information. It is just the whole texture/bitmap.
References a closeable for this frame that will be tracked in next frames. If after a period of time, this closeable has not been referenced in between frames, the Closeable.close method will be called so the object can be freed.
Temporarily sets the render buffer to a temporal texture of the size width and height that can be used later in the use method. First the texture is created, then render method is called once the render buffer is set to the texture, and later the context is restored and the use method is called providing as first argument the rendered Texture. This method is useful for per-frame filters. If you plan to keep the texture data, consider using the renderToBitmap method.