Skip to content
The Graphics library from OCaml, in a standalone repository
C OCaml Makefile
Branch: master
Clone or download
xavierleroy Add missing const qualifier, continued
Follow-up to d334c02.  This commits updates the Win32 implementation
to cope with caml_named_value() returning a const value *
since OCaml 4.09.
Latest commit 0f2c389 Oct 1, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples ocamlformat Sep 16, 2019
src Add missing const qualifier, continued Oct 1, 2019
test ocamlformat Sep 16, 2019
.gitignore Setup the build of the project Mar 12, 2019
.ocamlformat ocamlformat Sep 16, 2019
CHANGES.md update changelog Sep 16, 2019
LICENSE Setup the build of the project Mar 12, 2019
Makefile Setup the build of the project Mar 12, 2019
README.md Add link to rendered documentation Sep 30, 2019
dune-project
dune-workspace.dev Abandon compatibility with older versions of OCaml Mar 12, 2019
graphics.opam Generate opam file Sep 16, 2019
libgraph.png Import the image from the doc Mar 12, 2019

README.md

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.

Screenshot

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 by Graphics.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 geometry
  • Graphics.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
You can’t perform that action at this time.