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>

source

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.

source

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.

source

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.

source

pub fn save_to_file<P: AsRef<Path>>(self, _path: P) -> Result<(), Error>

Stub for feature is missing

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> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> RoundFrom<T> for T

source§

fn round_from(x: T) -> T

Performs the conversion.
source§

impl<T, U> RoundInto<U> for Twhere
    U: RoundFrom<T>,

source§

fn round_into(self) -> U

Performs the conversion.
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.