[−][src]Struct screen_layer::Controller
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]
resolution: Vec2<usize>,
bits_per_pixel: usize,
base_addr_of_vram: usize
) -> Self
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]
T: Fn(&mut Layer),
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]
&mut self,
id: Id,
coord: Vec2<isize>,
color: Option<RGB8>
) -> Result<(), Error>
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]
&mut self,
id: Id,
new_top_left: Vec2<isize>
) -> Result<(), Error>
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
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,