Skip to main content

ImmutableBitmap

Struct ImmutableBitmap 

Source
pub struct ImmutableBitmap { /* private fields */ }
Expand description

Immutable Skia bitmap.

Implementations§

Source§

impl ImmutableBitmap

Source

pub fn from_stream(stream: &mut dyn Read) -> Result<Self>

Creates an immutable bitmap from the given stream.

Source

pub fn from_image( image: Image, custom_image_dispose: Option<Box<dyn FnOnce(Image) + Send>>, ) -> Self

Wraps a Skia image. custom_image_dispose replaces releasing the image when the bitmap is disposed: it is handed the image, to release it where that has to happen (with a graphics context current).

Source

pub fn resized( src: &ImmutableBitmap, destination_size: PixelSize, interpolation_mode: BitmapInterpolationMode, ) -> Result<Self>

Creates a resized copy of src.

Source

pub fn from_stream_to_size( stream: &mut dyn Read, decode_size: i32, horizontal: bool, interpolation_mode: BitmapInterpolationMode, ) -> Result<Self>

Creates an immutable bitmap from a stream, decoded so that its width (horizontal) or height is decode_size.

Source

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

Creates an immutable bitmap from raw pixel data, which is copied.

data holds |stride| * size.height bytes. A negative stride means the rows are stored bottom-up: the first row of the image is the last row of data.

Source

pub fn image(&self) -> Image

The Skia image.

§Panics

Panics when the bitmap has been disposed.

Trait Implementations§

Source§

impl IBitmapImpl for ImmutableBitmap

Source§

fn dpi(&self) -> Vector

The dots per inch (DPI) of the image.
Source§

fn pixel_size(&self) -> PixelSize

The size of the bitmap, in device pixels.
Source§

fn version(&self) -> i32

Version of the pixel data: incremented whenever the content changes.
Source§

fn save( &self, stream: &mut dyn Write, options: &BitmapEncoderOptions, ) -> Result<()>

Saves the bitmap to a stream, encoded as selected by options.
Source§

fn dispose(&self)

Releases the bitmap’s resources.
Source§

fn as_any(&self) -> &dyn Any

Lets the backend recover its concrete type.
Source§

fn as_readable_bitmap(&self) -> Option<&dyn IReadableBitmapImpl>

The bitmap viewed as IReadableBitmapImpl, when its pixels can be read.
Source§

impl IDrawableBitmapImpl for ImmutableBitmap

Source§

fn draw( &self, gr_context: Option<&dyn ISkiaGrContext>, canvas: &Canvas, source_rect: &Rect, dest_rect: &Rect, sampling_options: SamplingOptions, paint: &Paint, )

Draws the bitmap onto a canvas. Read more
Source§

impl IReadableBitmapImpl for ImmutableBitmap

Source§

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

The pixel format, if known.
Source§

fn alpha_format(&self) -> Option<AlphaFormat>

The alpha format, if known.
Source§

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

Locks the pixels for reading (and writing, for writeable bitmaps).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.