[][src]Struct doryen_rs::Image

pub struct Image { /* fields omitted */ }

An easy way to load PNG images and blit them on the console

Methods

impl Image[src]

pub fn new(file_path: &str) -> Self[src]

Create an image and load a PNG file. On the web platform, image loading is asynchronous. Using blit methods before the image is loaded has no impact on the console.

pub fn is_loaded(&mut self) -> bool[src]

Check if the image has been loaded. Since there's no background thread doing the work for you, you have to call some method on image for it to actually load. Use either Image::is_loaded, Image::get_size, Image::blit or Image::blit_ex to run the loading code.

pub fn get_size(&mut self) -> Option<(u32, u32)>[src]

If the image has already been loaded, return its size, else return None

pub fn blit(
    &mut self,
    con: &mut Console,
    x: i32,
    y: i32,
    transparent: Option<Color>
)
[src]

blit an image on a console

x,y are the coordinate of the top left image pixel in the console

image pixels using the transparent color will be ignored

pub fn blit_ex(
    &mut self,
    con: &mut Console,
    x: f32,
    y: f32,
    scalex: f32,
    scaley: f32,
    angle: f32,
    transparent: Option<Color>
)
[src]

blit an image on a console

x,y are the coordinate of the image center in the console image can be scaled and rotated (angle is in radians) image pixels using the transparent color will be ignored

pub fn blit_2x(
    &mut self,
    con: &mut Console,
    dx: i32,
    dy: i32,
    sx: i32,
    sy: i32,
    w: Option<i32>,
    h: Option<i32>,
    transparent: Option<Color>
)
[src]

blit an image on the console, using the subcell characters to achieve twice the normal resolution. This uses the CHAR_SUBCELL_* ascii codes (from 226 to 232):

subcell_chars

COmparison before/after subcell in the chronicles of Doryen :

subcell_comp

Pyromancer! screenshot, making full usage of subcell resolution:

subcell_pyro

pub fn blit_2x_image(
    img: &RgbaImage,
    con: &mut Console,
    dx: i32,
    dy: i32,
    sx: i32,
    sy: i32,
    w: Option<i32>,
    h: Option<i32>,
    transparent: Option<Color>
)
[src]

blit an image on a console. See Image::blit_2x

Auto Trait Implementations

impl Send for Image

impl Sync for Image

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Erased for T

impl<T> Downcast for T where
    T: Any