For non-NI functions, there is cairo::Surface which is a shared impl for the surface types.
use cairo::{Format, ImageSurface, PdfSurface};
pub fn test() {
let surface = ImageSurface::create(Format::ARgb32, 100, 100).expect("ok");
let pdf = PdfSurface::new(100., 100., "test.pdf").expect("ok");
foo(&surface);
foo(&pdf);
}
fn foo(surface: &cairo::Surface) {
println!("{:#?}", surface);
println!(" {:#?}", surface.type_());
}
Perhaps a surface wrapper enum, like
enum Surface {
Image(cairo::ImageSurface)
Pdf(cairo::PdfSurface)
...
}
that can be passed as a reference up to Elixir, then passed back, matched on, and the surface passed directly to the helper functions.
Device
implement this as a struct, I think?
Enums
For non-NI functions, there is
cairo::Surfacewhich is a shared impl for the surface types.Perhaps a surface wrapper enum, like
that can be passed as a reference up to Elixir, then passed back, matched on, and the surface passed directly to the helper functions.
Device
implement this as a struct, I think?
Enums