MCPcopy Create free account
hub / github.com/ImageOptim/libimagequant / liq_image_create_rgba_bitmap_impl

Function liq_image_create_rgba_bitmap_impl

src/capi.rs:30–37  ·  view source on GitHub ↗
(attr: &Attributes, rows: Box<[*const RGBA]>, width: u32, height: u32, gamma: f64)

Source from the content-addressed store, hash-verified

28
29#[must_use]
30pub unsafe fn liq_image_create_rgba_bitmap_impl<'rows>(attr: &Attributes, rows: Box<[*const RGBA]>, width: u32, height: u32, gamma: f64) -> Option<crate::image::Image<'rows>> {
31 let rows = SeaCow::boxed(std::mem::transmute::<Box<[*const RGBA]>, Box<[Pointer<RGBA>]>>(rows));
32 let rows_slice = rows.as_slice();
33 if rows_slice.iter().any(|r| r.0.is_null()) {
34 return None;
35 }
36 crate::image::Image::new_internal(attr, crate::rows::PixelsSource::Pixels { rows, pixels: None }, width, height, gamma).ok()
37}
38
39#[must_use]
40pub unsafe fn liq_image_create_custom_impl<'rows>(attr: &Attributes, row_callback: Box<RowCallback<'rows>>, width: u32, height: u32, gamma: f64) -> Option<Image<'rows>> {

Callers 1

liq_image_create_rgbaFunction · 0.85

Calls 1

as_sliceMethod · 0.45

Tested by

no test coverage detected