[−][src]Struct piet::ImageBuf
An in-memory pixel buffer.
Contains raw bytes, dimensions, and image format (piet::ImageFormat
).
Implementations
impl ImageBuf
[src]
pub fn empty() -> Self
[src]
Create an empty image buffer.
pub fn from_raw(
pixels: impl Into<Arc<[u8]>>,
format: ImageFormat,
width: usize,
height: usize
) -> ImageBuf
[src]
pixels: impl Into<Arc<[u8]>>,
format: ImageFormat,
width: usize,
height: usize
) -> ImageBuf
Creates a new image buffer from an array of bytes.
format
specifies the pixel format of the pixel data, which must have length
width * height * format.bytes_per_pixel()
.
Panics
Panics if the pixel data has the wrong length.
pub fn raw_pixels(&self) -> &[u8]
[src]
Returns the raw pixel data of this image buffer.
pub fn raw_pixels_shared(&self) -> Arc<[u8]>
[src]
Returns a shared reference to the raw pixel data of this image buffer.
pub fn format(&self) -> ImageFormat
[src]
Returns the format of the raw pixel data.
pub fn width(&self) -> usize
[src]
The width, in pixels, of this image.
pub fn height(&self) -> usize
[src]
The height, in pixels, of this image.
pub fn size(&self) -> Size
[src]
The size of this image, in pixels.
pub fn pixel_colors(
&self
) -> impl Iterator<Item = impl Iterator<Item = Color> + '_>
[src]
&self
) -> impl Iterator<Item = impl Iterator<Item = Color> + '_>
Returns an iterator over the pixels in this image.
The return value is an iterator over "rows", where each "row" is an iterator over the color of the pixels in that row.
pub fn to_image<Ctx: RenderContext>(&self, ctx: &mut Ctx) -> Ctx::Image
[src]
Converts this buffer an image that is optimized for drawing into a RenderContext
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ImageBuf
[src]
impl Send for ImageBuf
[src]
impl Sync for ImageBuf
[src]
impl Unpin for ImageBuf
[src]
impl UnwindSafe for ImageBuf
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,