Struct 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>

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> Freeze for BitmapTarget<'a>

§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: RoundFrom<T>,

Source§

fn round_into(self) -> U

Performs the conversion.
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.