vizia::vg::surfaces

Function wrap_pixels

pub fn wrap_pixels<'pixels>(
    image_info: &Handle<SkImageInfo>,
    pixels: &'pixels mut [u8],
    row_bytes: impl Into<Option<usize>>,
    surface_props: Option<&SurfaceProps>,
) -> Option<Borrows<'pixels, RCHandle<SkSurface>>>
Expand description

Allocates raster Surface. crate::Canvas returned by Surface draws directly into pixels.

Surface is returned if all parameters are valid. Valid parameters include: info dimensions are greater than zero; info contains crate::ColorType and crate::AlphaType supported by raster surface; pixels is not None; row_bytes is large enough to contain info width pixels of crate::ColorType.

Pixel buffer size should be info height times computed row_bytes. Pixels are not initialized. To access pixels after drawing, Surface::peek_pixels() or Surface::read_pixels().

  • image_info - width, height, crate::ColorType, crate::AlphaType, crate::ColorSpace, of raster surface; width and height must be greater than zero
  • pixels - pointer to destination pixels buffer
  • row_bytes - interval from one Surface row to the next
  • surface_props - LCD striping orientation and setting for device independent fonts; may be None

Returns: Surface if all parameters are valid; otherwise, None