pub struct Image { /* private fields */ }
Expand description

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

Implementations

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.

Returns the image’s width in pixels or 0 if the image has not yet been loaded

Returns the image’s height in pixels or 0 if the image has not yet been loaded

Create an empty image.

get the color of a specific pixel inside the image

sets the color of a specific pixel inside the image

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::try_load, [Image::get_size], Image::blit or Image::blit_ex to run the loading code.

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

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

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

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

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.