Struct piet_common::BitmapTarget
source · pub struct BitmapTarget<'a> { /* private fields */ }
Expand description
A struct provides a RenderContext
and then can have its bitmap extracted.
Implementations§
source§impl<'a> BitmapTarget<'a>
impl<'a> BitmapTarget<'a>
sourcepub fn render_context(&mut self) -> CairoRenderContext<'_>
pub fn render_context(&mut self) -> CairoRenderContext<'_>
Get a piet RenderContext
for the bitmap.
Note: caller is responsible for calling finish
on the render
context at the end of rendering.
sourcepub fn copy_raw_pixels(
&mut self,
fmt: ImageFormat,
buf: &mut [u8]
) -> Result<usize, Error>
pub fn copy_raw_pixels(
&mut self,
fmt: ImageFormat,
buf: &mut [u8]
) -> Result<usize, Error>
Get raw RGBA pixels from the bitmap by copying them into buf
. If all the pixels were
copied, returns the number of bytes written. If buf
wasn’t big enough, returns an error
and doesn’t write anything.
Note: caller is responsible for making sure the requested ImageFormat
is supported.
sourcepub fn to_image_buf(&mut self, fmt: ImageFormat) -> Result<ImageBuf, Error>
pub fn to_image_buf(&mut self, fmt: ImageFormat) -> Result<ImageBuf, Error>
Get an in-memory pixel buffer from the bitmap.
Note: caller is responsible for making sure the requested ImageFormat
is supported.
Auto Trait Implementations§
impl<'a> RefUnwindSafe for BitmapTarget<'a>
impl<'a> !Send for BitmapTarget<'a>
impl<'a> !Sync for BitmapTarget<'a>
impl<'a> Unpin for BitmapTarget<'a>
impl<'a> UnwindSafe for BitmapTarget<'a>
Blanket Implementations§
source§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
source§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.