pub struct ImmutableBitmap { /* private fields */ }Expand description
Immutable bitmap: pixels that never change.
The bitmap is drawn from an image of premultiplied RGBA pixels, the one format the renderers draw. A bitmap that was created from pixels in another format keeps those as well: it reports their format and is read in it, as a bitmap of the Skia backend, which draws every format it has a color type for.
Implementations§
Source§impl ImmutableBitmap
impl ImmutableBitmap
Sourcepub fn from_image(image: ImageData) -> Self
pub fn from_image(image: ImageData) -> Self
Wraps an image of premultiplied RGBA pixels.
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_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 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_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.
§Panics
Panics when the pixel format is unknown to the backend.
Trait Implementations§
Source§impl IBitmapImpl for ImmutableBitmap
impl IBitmapImpl for ImmutableBitmap
Source§fn pixel_size(&self) -> PixelSize
fn pixel_size(&self) -> PixelSize
Source§fn save(
&self,
stream: &mut dyn Write,
options: &BitmapEncoderOptions,
) -> Result<()>
fn save( &self, stream: &mut dyn Write, options: &BitmapEncoderOptions, ) -> Result<()>
options.Source§fn as_readable_bitmap(&self) -> Option<&dyn IReadableBitmapImpl>
fn as_readable_bitmap(&self) -> Option<&dyn IReadableBitmapImpl>
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>
Source§fn alpha_format(&self) -> Option<AlphaFormat>
fn alpha_format(&self) -> Option<AlphaFormat>
Source§fn lock(&self) -> Rc<dyn ILockedFramebuffer>
fn lock(&self) -> Rc<dyn ILockedFramebuffer>
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§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more