summaryrefslogtreecommitdiffstats
path: root/src/ocaml-cairo-test.ml
diff options
context:
space:
mode:
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 ()
+