pub struct BitmapTarget<'a> { /* private fields */ }Expand description
A struct provides a RenderContext and then can have its bitmap extracted.
Implementations§
§impl<'a> BitmapTarget<'a>
impl<'a> BitmapTarget<'a>
pub 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.
pub 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.
pub 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§
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> RoundFrom<T> for T
impl<T> RoundFrom<T> for T
§fn round_from(x: T) -> T
fn round_from(x: T) -> T
Performs the conversion.
§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere U: RoundFrom<T>,
§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.