vizia::vg::surfaces

Function raster

pub fn raster(
    image_info: &Handle<SkImageInfo>,
    row_bytes: impl Into<Option<usize>>,
    surface_props: Option<&SurfaceProps>,
) -> Option<RCHandle<SkSurface>>
Expand description

Allocates raster Surface. crate::Canvas returned by Surface draws directly into pixels. Allocates and zeroes pixel memory. Pixel memory size is image_info.height() times row_bytes, or times image_info.min_row_bytes() if row_bytes is zero. Pixel memory is deleted when Surface is deleted.

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; row_bytes is large enough to contain info width pixels of crate::ColorType, or is zero.

If row_bytes is zero, a suitable value will be chosen internally.

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

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