logo
pub struct Image(_);
Expand description

Graphics image object.

Implementations

Create a new blank image.

👎 Deprecated:

Use Image::create instead.

Create a new blank image.

Create image from BGRA data. Size of the pixmap is width * height * 4 bytes.

Load image from memory.

Supported formats are: GIF, JPEG, PNG, WebP. On Windows also are BMP, ICO, TIFF and WMP.

Save content of the image as a byte vector.

Render on bitmap image using methods of the Graphics object.

The image must be created using Image::new() or Image::with_data() methods or loaded from a BMP file.

PaintFn painter type must be the following:

use sciter::graphics::{Graphics, Result};

fn paint(gfx: &mut Graphics, (width, height): (f32, f32)) -> Result<()>

Note that errors inside painter are promoted back to the caller of the paint().

Example:
let mut image = Image::new((100, 100), false).unwrap();
image.paint(|gfx, size| {
  gfx.rectangle((5.0, 5.0), (size.0 - 5.0, size.1 - 5.0))?;
  Ok(())
}).unwrap();

Get width and height of the image (in pixels).

Clear image by filling it with the black color.

Clear image by filling it with the specified color.

Trait Implementations

Copies image object.

All allocated objects are reference counted so copying is just a matter of increasing reference counts.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Destroy pointed image object.

Executes the destructor for this type. Read more

Store the Image object as a Value.

Performs the conversion.

Get an Image object contained in the Value.

Converts value to specified type.

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

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

Uses borrowed data to replace owned data, usually by cloning. Read more

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.