[−][src]Struct doryen_rs::Image
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]
&mut self,
con: &mut Console,
x: i32,
y: i32,
transparent: Option<Color>
)
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]
&mut self,
con: &mut Console,
x: f32,
y: f32,
scalex: f32,
scaley: f32,
angle: f32,
transparent: Option<Color>
)
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]
&mut self,
con: &mut Console,
dx: i32,
dy: i32,
sx: i32,
sy: i32,
w: Option<i32>,
h: Option<i32>,
transparent: Option<Color>
)
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):
COmparison before/after subcell in the chronicles of Doryen :
Pyromancer! screenshot, making full usage of subcell resolution:
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]
img: &RgbaImage,
con: &mut Console,
dx: i32,
dy: i32,
sx: i32,
sy: i32,
w: Option<i32>,
h: Option<i32>,
transparent: Option<Color>
)
blit an image on a console. See Image::blit_2x
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Erased for T
impl<T> Downcast for T where
T: Any,
T: Any,