use crate::{
Nc, NcError, NcPlane, NcPlaneOptions, NcResult, NcVisual, NcVisualFlag, NcVisualOptions,
};
#[allow(dead_code)]
pub fn ncvisualplane_create<'a>(
nc: &'a mut Nc,
opts: &NcPlaneOptions,
ncv: &mut NcVisual,
vopts: Option<&NcVisualOptions>,
) -> NcResult<&'a mut NcPlane> {
let plane: &mut NcPlane;
if let Some(vo) = vopts {
if vo.n.is_null() {
plane = NcPlane::new_pile(nc, opts)?;
} else if vo.flags & NcVisualFlag::ChildPlane != NcVisualFlag::None {
return Err(NcError::new_msg("ncvisualplane_create() ERR"));
} else {
plane = NcPlane::new_child(unsafe { &mut *vo.n }, opts)?;
}
} else {
plane = NcPlane::new_pile(nc, opts)?;
}
let _vopts2: NcVisualOptions;
let vopts2_ref: &NcVisualOptions;
if let Some(vo) = vopts {
vopts2_ref = vo;
} else {
_vopts2 = NcVisualOptions::default();
vopts2_ref = &_vopts2;
}
unsafe { ncv.blit(nc, Some(vopts2_ref))? };
Ok(plane)
}