[−][src]Struct native_windows_gui::Bitmap
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 usinginclude_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 filesource_embed_id
: The number identifier of the icon in the embedded filesource_embed_str
: The string identifier of the icon in the embedded filesize
: 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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,