summaryrefslogtreecommitdiffstats
path: root/src/ocaml-cairo-test.ml
diff options
context:
space:
mode:
authorWilliam <r.3@libertysurf.fr>2012-10-04 12:36:21 (GMT)
committerWilliam <r.3@libertysurf.fr>2012-12-13 13:02:21 (GMT)
commit2439c534bb5676643492f0d28fd8f1ac824d91db (patch)
treebceeb37c82612de8b4a0f54ee3dbd9ab4d2ec2ec /src/ocaml-cairo-test.ml
parentdaacabc066b2b02d5e70b3972f39d98f160d01e0 (diff)
downloadmxe-2439c534bb5676643492f0d28fd8f1ac824d91db.zip
mxe-2439c534bb5676643492f0d28fd8f1ac824d91db.tar.gz
mxe-2439c534bb5676643492f0d28fd8f1ac824d91db.tar.bz2
add package ocaml-cairo
Diffstat (limited to 'src/ocaml-cairo-test.ml')
-rw-r--r--src/ocaml-cairo-test.ml26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ocaml-cairo-test.ml b/src/ocaml-cairo-test.ml
new file mode 100644
index 0000000..f58315d
--- /dev/null
+++ b/src/ocaml-cairo-test.ml
@@ -0,0 +1,26 @@
+let on_expose_event widget _ =
+ let open Cairo in
+ let drawable = widget#misc#window in
+ let cr = Cairo_lablgtk.create drawable in
+ let i = ref 1 in
+ while !i <= 10 do
+ let i' = float !i in
+ set_source_rgba cr 0. 0. 1. (i'*.0.1);
+ rectangle cr (50.*.i') 20. 40. 40.;
+ fill cr;
+ incr i
+ done;
+ false
+
+let () =
+ let window = GWindow.window
+ ~title:"transparency"
+ ~position:`CENTER () in
+ ignore(window#event#connect#after#expose
+ (on_expose_event window));
+ ignore(window#connect#destroy GMain.quit);
+ window#misc#set_app_paintable true;
+ window#set_default_size ~width:590 ~height:80;
+ window#show ();
+ GMain.main ()
+