1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#[allow(unused_imports)] use crate::*; extern "C" { fn htmlcanvas_get_width(instance: DOMReference) -> i32; fn htmlcanvas_set_width(instance: DOMReference, value: i32); } pub fn get_width(instance: DOMReference) -> i32 { unsafe { htmlcanvas_get_width(instance) } } pub fn set_width(instance: DOMReference, value: i32) { unsafe { htmlcanvas_set_width(instance, value); } } extern "C" { fn htmlcanvas_get_height(instance: DOMReference) -> i32; fn htmlcanvas_set_height(instance: DOMReference, value: i32); } pub fn get_height(instance: DOMReference) -> i32 { unsafe { htmlcanvas_get_height(instance) } } pub fn set_height(instance: DOMReference, value: i32) { unsafe { htmlcanvas_set_height(instance, value); } } extern "C" { fn htmlcanvas_get_context(instance: i32, context_id: CString) -> i32; } pub fn get_context(instance: i32, context_id: &str) -> i32 { unsafe { htmlcanvas_get_context(instance, to_cstring(context_id)) } } extern "C" { fn htmlcanvas_to_data_url(instance: i32, data_type: CString, encoder_options: i32) -> CString; } pub fn to_data_url(instance: i32, data_type: &str, encoder_options: i32) -> String { unsafe { to_string(htmlcanvas_to_data_url( instance, to_cstring(data_type), encoder_options, )) } } extern "C" { fn htmlcanvas_to_blob(instance: i32, callback: i32, blob_type: CString, encoder_options: i32); } pub fn to_blob(instance: i32, callback: i32, blob_type: &str, encoder_options: i32) { unsafe { htmlcanvas_to_blob(instance, callback, to_cstring(blob_type), encoder_options) } } extern "C" { fn htmlcanvas_transfer_control_to_offscreen(instance: i32) -> i32; } pub fn transfer_control_to_offscreen(instance: i32) -> i32 { unsafe { htmlcanvas_transfer_control_to_offscreen(instance) } }