graphics
The graphics library provides a set of portable drawing
primitives. Drawing takes place in a separate window that is created
when Graphics.open_graph is called. It used to be distributed with
OCaml up to OCaml 4.08.
Documentation
The API is documented
here
and as comments in the source file src/graphics.mli
.
On Unix
On Unix graphics uses the X11 windows system.
Here are the graphics mode specifications supported byGraphics.open_graph
on the X11 implementation of this library: the
argument to Graphics.open_graph
has the format "display-name geometry"
, where display-name is the name of the X-windows display to
connect to, and geometry is a standard X-windows geometry
specification. The two components are separated by a space. Either can
be omitted, or both. Examples:
Graphics.open_graph "foo:0"
: connects to the display foo:0 and
creates a window with the default geometryGraphics.open_graph "foo:0 300x100+50-0"
connects to the display
foo:0 and creates a window 300 pixels wide by 100 pixels tall, at
location (50,0)Graphics.open_graph " 300x100+50-0"
connects to the default
display and creates a window 300 pixels wide by 100 pixels tall, at
location (50,0)Graphics.open_graph ""
connects to the default display and creates
a window with the default geometry.
On Windows
On Windows graphics uses the native Win32 API.
Examples
The examples/
directory contains a few examples. You can run them
with:
dune exec examples/graph_example.exe
dune exec examples/graph_test.exe
dune exec examples/sorts.exe
sha256=400fd81d23f1cb4146b96979342c247971dd54f5879ffd2f80ec7cd0212e32d4
sha512=1387c1ecf5dfd62c3927f1f8ce0bcc8b162ef22f15bfd41eba47c955091f7ce5f19395beab550d31cff38d22c4ad097350975381e60936a0004271e96f65b09b
< "0.4.17"
< "0.5"
>= "3.10.0"
>= "2.71.10"
>= "0.8.7" & < "0.8.9"
>= "2.0.0"
>= "3.3"