Struct radiant_rs::Layer [] [src]

pub struct Layer { /* fields omitted */ }

A non-blocking, thread-safe drawing surface.

In radiant_rs, sprite drawing happens on layers. Layers provide transformation capabilities in the form of model- and view-matrices and the layer's blendmode and color determine how sprites are rendered onto the display. Layers can be rendered multiple times using different matrices, blendmodes or colors without having to redraw their contents first.

Multiple threads can draw onto the same layer without blocking. However, manipulating layer properties may block other threads from manipulating the same property.

Methods

impl Layer
[src]

Creates a new layer with given dimensions. The channel determines which sprite channel is drawn. All sprites support at least channel 0. Nothing will be drawn if the sprite does not contain given channel.

Creates a new layer with given dimensions and fragment program. The channel determines which sprite channel is drawn. All sprites support at least channel 0. Nothing will be drawn if the sprite does not contain given channel.

Sets a global color multiplicator. Setting this to white means that the layer contents are renderered in their original colors.

Note that Colors contain alpha information and are not clamped to any range, so it is possible to use an overbright color to brighten the result or use the alpha channel to apply global transparency.

Returns a mutex guarded mutable reference to the global color multiplicator.

Sets the view matrix.

View matrix transformation is applied after the objects are fully positioned on the layer. As a result, manipulating the view matrix has the effect of manipulating the layer itself, e.g. rotating the entire layer.

Returns a mutex guarded mutable reference to the view matrix. See set_view_matrix() for a description of the view matrix.

Sets the model matrix.

Model matrix transformation is applied before each object is transformed to its position on the layer. As a result, manipulating the model matrix has the effect of manipulating every object on the layer in the same way, e.g. rotating every individual object on the layer around a point relative to the individual object.

Returns a mutex guarded mutable reference to the model matrix. See set_model_matrix() for a description of the model matrix.

Sets the blendmode.

Returns a mutex guarded mutable reference to the blendmode.

Removes all previously added object from the layer. Typically invoked after the layer has been rendered.

Returns the number of sprites the layer can hold without having to perform a blocking reallocation.

Returns the number of sprites currently stored the layer.

Returns the layer wrapped in an std::Arc

Trait Implementations

impl Send for Layer
[src]

impl Sync for Layer
[src]