Struct sciter::graphics::Image [] [src]

pub struct Image(_);

Graphics image object.

Methods

impl Image
[src]

[src]

Create a new blank image.

[src]

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

[src]

Load image from memory.

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

[src]

Save content of the image as a byte vector.

[src]

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();

[src]

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

[src]

Clear image by filling it with the black color.

[src]

Clear image by filling it with the specified color.

Trait Implementations

impl Drop for Image
[src]

Destroy pointed image object.

[src]

Executes the destructor for this type. Read more

impl Clone for Image
[src]

Copies image object.

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl FromValue for Image
[src]

Get an Image object contained in the Value.

[src]

Converts value to specified type.

impl From<Image> for Value
[src]

Store the Image object as a Value.

[src]

Performs the conversion.

Auto Trait Implementations

impl !Send for Image

impl !Sync for Image