Slide 21
Slide 21 text
APNG generate
https://github.com/poccariswet/drawasm/blob/master/src/generate.rs#L149-L159
let b = js_sys::Uint8Array::new(&unsafe {
js_sys::Uint8Array::view(&buf) }.into());
let array = js_sys::Array::new();
array.push(&b.buffer());
let blob = Blob::new_with_u8_array_sequence_and_options(
&array,
BlobPropertyBag::new().type_("image/png"),
)
.unwrap();
let url = Url::create_object_url_with_blob(&blob).unwrap();
let window = window().unwrap();
window.open_with_url(&url).unwrap();
● js側(browser) でも相互作用できるようにUint8Array型に変
換して線形メモリ(linear memory) へビューする。
● open_with_url() で次タブで開く