FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    WriteableBitmap

    struct · ferroui-base · v0.5.0

    struct WriteableBitmap
    

    Holds a writeable bitmap image.

    View source

    Members

    new

    fn new(size: PixelSize, dpi: Vector, format: Option<PixelFormat>, alpha_format: Option<AlphaFormat>) -> WriteableBitmap
    

    Creates a bitmap of the given size, in pixels, and DPI. The formats default to the backend's default formats.

    Panics when the size is not positive or the pixel format is not supported.

    Source

    from_pixels

    fn from_pixels(format: PixelFormat, alpha_format: AlphaFormat, data: &[u8], size: PixelSize, dpi: Vector, stride: i32) -> WriteableBitmap
    

    Creates a writeable bitmap from a pixel data copy: data holds rows of format pixels, stride bytes apart.

    Panics when stride is too small for a row.

    Source

    format

    fn format(self: &Self) -> Option<PixelFormat>
    

    The pixel format of the bitmap.

    Source

    lock

    fn lock(self: &Self) -> Rc<dyn ILockedFramebuffer>
    

    Locks the pixel data of the bitmap and returns a framebuffer that can be used to read and write the pixels. The changes are committed when the framebuffer is disposed.

    Source

    copy_pixels

    fn copy_pixels(self: &Self, source_rect: PixelRect, buffer: &mut [u8], stride: i32)
    

    Copies the pixels of source_rect into buffer, whose rows are stride bytes apart. An empty source_rect selects the whole bitmap.

    Source

    decode

    fn decode(stream: &mut dyn Read) -> std::io::Result<WriteableBitmap>
    

    Loads a writeable bitmap from a stream.

    Source

    decode_to_width

    fn decode_to_width(stream: &mut dyn Read, width: i32, interpolation_mode: BitmapInterpolationMode) -> std::io::Result<WriteableBitmap>
    

    Loads a writeable bitmap from a stream, decoded to the specified width maintaining aspect ratio.

    Source

    decode_to_height

    fn decode_to_height(stream: &mut dyn Read, height: i32, interpolation_mode: BitmapInterpolationMode) -> std::io::Result<WriteableBitmap>
    

    Loads a writeable bitmap from a stream, decoded to the specified height maintaining aspect ratio.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.