[][src]Struct native_windows_gui::Bitmap

pub struct Bitmap {
    pub handle: HANDLE,
    // some fields omitted
}

A wrapper over a bitmap file (*.bmp)

Note that Bitmap object are only used as display resources (ie: it's impossible to read pixels or resized it). If those features are needed, see the image-decoder feature.

To display a bitmap in an application, see the ImageFrame control.

By default, bitmap resources do not support transparency BUT if image-decoder is enabled, bitmaps can be loaded from any file type supported by NWG (JPEG, PNG, BMP, ICO, DDS, TIFF).

Bitmaps can be converted to icons using the "copy_as_icon" function.

Builder parameters:

  • source_file: The source of the bitmap if it is a file.
  • source_bin: The source of the bitmap if it is a binary blob. For example using include_bytes!("my_icon.bmp").
  • source_system: The source of the bitmap if it is a system resource (see OemBitmap)
  • source_embed: The source of the bitmap if it is stored in an embedded file
  • source_embed_id: The number identifier of the icon in the embedded file
  • source_embed_str: The string identifier of the icon in the embedded file
  • size: Optional. Resize the image to this size.
  • strict: Use a system placeholder instead of panicking if the image source do no exists.

Example:

use native_windows_gui as nwg;

fn load_bitmap() -> nwg::Bitmap {
    let mut bitmap = nwg::Bitmap::default();

    nwg::Bitmap::builder()
        .source_file(Some("Hello.bmp"))
        .strict(true)
        .build(&mut bitmap);

    bitmap
}

Fields

handle: HANDLE

Implementations

impl Bitmap[src]

pub fn builder<'a>() -> BitmapBuilder<'a>[src]

pub fn copy_as_icon(&self) -> Icon[src]

Creates a new icon from the bitmap data. The bitmap must have been initialized

Trait Implementations

impl Default for Bitmap[src]

impl Drop for Bitmap[src]

impl PartialEq<Bitmap> for Bitmap[src]

Auto Trait Implementations

impl RefUnwindSafe for Bitmap

impl !Send for Bitmap

impl !Sync for Bitmap

impl Unpin for Bitmap

impl UnwindSafe for Bitmap

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.