diff --git a/Makefile b/Makefile
index 9fd4d06..86326c7 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,11 @@ doc-common: build
mkdir -p _build/docs
rsync -auv docs/. _build/docs/.
+doc-examples: build
+ mkdir -p _build/docs/examples
+ cp _build/default/examples/*.js _build/docs/examples/.
+ cp _build/default/examples/*.html _build/docs/examples/.
+
sphinx: doc-common
sphinx-build sphinx ${SPHINX_TARGET}
@@ -34,7 +39,7 @@ odoc: doc-common
opam exec -- dune build @doc
rsync -auv --delete _build/default/_doc/_html/. ${ODOC_TARGET}
-doc: doc-common odoc sphinx
+doc: doc-common doc-examples odoc sphinx
view:
xdg-open file://$$(pwd)/_build/docs/index.html
diff --git a/docs/index.html b/docs/index.html
index 9c4f63c..dd4e554 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -25,6 +25,7 @@
OCaml-Canvas
Project on Github
General Documentation
API Documentation
+ Examples
Bug reports
Authors:
diff --git a/src/stubs/ml_canvas.js b/src/stubs/ml_canvas.js
index cf9036e..19b819b 100644
--- a/src/stubs/ml_canvas.js
+++ b/src/stubs/ml_canvas.js
@@ -217,14 +217,15 @@ function _frame_handler(timestamp) {
/* Image Data (aka Pixmaps) */
//Provides: _ml_canvas_image_of_png_file
-//Requires: caml_read_file_content
+//Requires: caml_read_file_content, caml_raise_with_string, caml_named_value
function _ml_canvas_image_of_png_file(filename) {
var file = caml_read_file_content(filename);
if (file === null) {
return null;
}
var fc = caml_read_file_content(filename);
- var data = window.btoa(fc.toUft16 === undefined ? fc.c : fc);
+ // Test for mlBytes or JS-string
+ var data = window.btoa(fc.c === undefined ? fc : fc.c);
var img = new window.Image();
img.loading = 'eager';
img.decoding = 'sync';
@@ -294,8 +295,6 @@ function ml_canvas_image_data_create_from_png(filename, onload) {
var ba = _ml_canvas_ba_of_img(img[1]);
onload(ba);
return 0;
- }, function (__err) {
- return 0;
});
return 0;
}
@@ -440,8 +439,6 @@ function ml_canvas_image_data_import_png(data, pos, filename, onload) {
}
onload(data);
return 0;
- }, function (__err) {
- return 0;
});
return 0;
}
@@ -850,8 +847,6 @@ function ml_canvas_create_offscreen_from_png(filename, onload) {
canvas.ctxt.drawImage(img[1], 0, 0);
onload(canvas);
return 0;
- }, function (__err) {
- return 0;
});
return 0;
}
@@ -1550,8 +1545,6 @@ function ml_canvas_import_png(canvas, pos, filename, onload) {
// image, sx, sy, sWitdh, sHeight, dx, dy, dWidth, dHeight
onload(canvas);
return 0;
- }, function (__err) {
- return 0;
});
return 0;
}