[][src]Struct screen_layer::Controller

pub struct Controller { /* fields omitted */ }

A controller of layers.

Implementations

impl Controller[src]

pub unsafe fn new(
    resolution: Vec2<usize>,
    bits_per_pixel: usize,
    base_addr_of_vram: usize
) -> Self
[src]

Creates an instance of this type.

Safety

This function is unsafe because this library may break memory safety by trying to access an invalid memory if base_addr_of_vram is not a correct address.

Also this library may access to the memory outside of VRAM if resolution contains larger value than the actual one.

pub fn add_layer(&mut self, layer: Layer) -> Id[src]

Add a layer.

This method returns an ID of the layer. You must save the id to edit the one.

Added layer comes to the front. All layers behind the one will be hidden.

After adding a layer, layers will be redrawn.

pub fn edit_layer<T>(&mut self, id: Id, f: T) -> Result<(), Error> where
    T: Fn(&mut Layer), 
[src]

Edit a layer.

You can edit a layer by indexing Layer type. For more information, see the description of Index implementation of Layer type.

After editing, layers will be redrawn. This may take time if the layer is large. In such cases, use [set_pixel] instead.

pub fn set_pixel(
    &mut self,
    id: Id,
    coord: Vec2<isize>,
    color: Option<RGB8>
) -> Result<(), Error>
[src]

Set a color on pixel.

coord is the coordinate of the relative position from the top-left of the layer. If color is None, the pixel is transparent.

After editing, only the edited pixel will be redrawn.

pub fn slide_layer(
    &mut self,
    id: Id,
    new_top_left: Vec2<isize>
) -> Result<(), Error>
[src]

Slide a layer.

The value of new_top_left can be negative, or larger than screen resolution. In such cases, any part of the layer that extends outside the screen will not be drawn.

After sliding, layers will be redrawn.

Trait Implementations

impl Debug for Controller[src]

impl Default for Controller[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.