Function vizia::vg::surfaces::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 zeropixels
- pointer to destination pixels bufferrow_bytes
- interval from oneSurface
row to the nextsurface_props
- LCD striping orientation and setting for device independent fonts; may beNone
Returns:Surface
if all parameters are valid; otherwise,None