pub struct ImmutableBitmap { /* private fields */ }Expand description
Immutable Skia bitmap.
Implementations§
Source§impl ImmutableBitmap
impl ImmutableBitmap
Sourcepub fn from_stream(stream: &mut dyn Read) -> Result<Self>
pub fn from_stream(stream: &mut dyn Read) -> Result<Self>
Creates an immutable bitmap from the given stream.
Sourcepub fn from_image(
image: Image,
custom_image_dispose: Option<Box<dyn FnOnce(Image) + Send>>,
) -> Self
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).
Sourcepub fn resized(
src: &ImmutableBitmap,
destination_size: PixelSize,
interpolation_mode: BitmapInterpolationMode,
) -> Result<Self>
pub fn resized( src: &ImmutableBitmap, destination_size: PixelSize, interpolation_mode: BitmapInterpolationMode, ) -> Result<Self>
Creates a resized copy of src.
Sourcepub fn from_stream_to_size(
stream: &mut dyn Read,
decode_size: i32,
horizontal: bool,
interpolation_mode: BitmapInterpolationMode,
) -> Result<Self>
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.
Sourcepub fn from_pixels(
size: PixelSize,
dpi: Vector,
stride: i32,
format: PixelFormat,
alpha_format: AlphaFormat,
data: &[u8],
) -> Result<Self>
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.
Trait Implementations§
Source§impl IBitmapImpl for ImmutableBitmap
impl IBitmapImpl for ImmutableBitmap
Source§fn pixel_size(&self) -> PixelSize
fn pixel_size(&self) -> PixelSize
The size of the bitmap, in device pixels.
Source§fn save(
&self,
stream: &mut dyn Write,
options: &BitmapEncoderOptions,
) -> Result<()>
fn save( &self, stream: &mut dyn Write, options: &BitmapEncoderOptions, ) -> Result<()>
Saves the bitmap to a stream, encoded as selected by
options.Source§fn as_readable_bitmap(&self) -> Option<&dyn IReadableBitmapImpl>
fn as_readable_bitmap(&self) -> Option<&dyn IReadableBitmapImpl>
The bitmap viewed as
IReadableBitmapImpl, when its pixels can be
read.Source§impl IReadableBitmapImpl for ImmutableBitmap
impl IReadableBitmapImpl for ImmutableBitmap
Source§fn format(&self) -> Option<PixelFormat>
fn format(&self) -> Option<PixelFormat>
The pixel format, if known.
Source§fn alpha_format(&self) -> Option<AlphaFormat>
fn alpha_format(&self) -> Option<AlphaFormat>
The alpha format, if known.
Source§fn lock(&self) -> Rc<dyn ILockedFramebuffer>
fn lock(&self) -> Rc<dyn ILockedFramebuffer>
Locks the pixels for reading (and writing, for writeable bitmaps).
Auto Trait Implementations§
impl !Freeze for ImmutableBitmap
impl RefUnwindSafe for ImmutableBitmap
impl Send for ImmutableBitmap
impl Sync for ImmutableBitmap
impl Unpin for ImmutableBitmap
impl UnsafeUnpin for ImmutableBitmap
impl UnwindSafe for ImmutableBitmap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
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