File: manual039.html

package info (click to toggle)
ocaml-doc 3.09-1
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 10,428 kB
  • ctags: 4,963
  • sloc: ml: 9,244; makefile: 2,413; ansic: 122; sh: 49; asm: 17
file content (100 lines) | stat: -rw-r--r-- 3,797 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="manual.css">
<TITLE>
The graphics library
</TITLE>
</HEAD>
<BODY >
<A HREF="manual038.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="manual040.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H1 CLASS="chapter"><A NAME="htoc257">Chapter&nbsp;25</A>&nbsp;&nbsp;The graphics library</H1>

The <TT>graphics</TT> library provides a set of portable drawing primitives.
Drawing takes place
in a separate window that is created when <TT>open_graph</TT> is called.<BR>
<BR>

&nbsp;&nbsp;<FONT COLOR=purple>Unix:</FONT>
<BLOCKQUOTE CLASS="quote">
This library is implemented under the X11 windows system. 
Programs that use the <TT>graphics</TT> library must be linked as follows:
<PRE>
        ocamlc <I>other options</I> graphics.cma <I>other files</I>
</PRE>
For interactive use of the <TT>graphics</TT> library, do:
<PRE>
        ocamlmktop -o mytop graphics.cma
        ./mytop
</PRE>
or (if dynamic linking of C libraries is supported on your platform),
start <TT>ocaml</TT> and type <TT>#load "graphics.cma";;</TT>.<BR>
<BR>
Here are the graphics mode specifications supported by <TT>open_graph</TT> on
the X11 implementation of this library:
the argument to <TT>open_graph</TT> has the format
<TT>"</TT><I>display-name geometry</I><TT>"</TT>,
where <I>display-name</I> is the name of the X-windows display to
connect to, and <I>geometry</I> is a standard X-windows geometry
specification. The two components are separated by a space. Either can
be omitted, or both. Examples:
<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description">
<TT><B>open_graph "foo:0"</B></TT><DD CLASS="dd-description">
connects to the display <TT>foo:0</TT> and creates a window with the default geometry
<DT CLASS="dt-description"><TT><B>open_graph "foo:0 300x100+50-0"</B></TT><DD CLASS="dd-description">
connects to the display <TT>foo:0</TT> and creates a window 300 pixels wide
by 100 pixels tall, at location (50,0)
<DT CLASS="dt-description"><TT><B>open_graph " 300x100+50-0"</B></TT><DD CLASS="dd-description">
connects to the default display and creates a window 300 pixels wide
by 100 pixels tall, at location (50,0)
<DT CLASS="dt-description"><TT><B>open_graph ""</B></TT><DD CLASS="dd-description">
connects to the default display and creates a window with the default
geometry.
</DL>
</BLOCKQUOTE>

&nbsp;&nbsp;<FONT COLOR=purple>Windows:</FONT>
<BLOCKQUOTE CLASS="quote">
This library is available both for standalone compiled programs and
under the toplevel application <TT>ocamlwin.exe</TT>. For the latter, this
library must be loaded in-core by typing
<PRE CLASS="verbatim">
        #load "graphics.cma";;
</PRE></BLOCKQUOTE>
The screen coordinates are interpreted as shown in the figure below.
Notice that the coordinate system used is the same as in mathematics:
<I>y</I> increases from the bottom of the screen to the top of the screen,
and angles are measured counterclockwise (in degrees).
Drawing is clipped to the screen.
<BR>
<BR>

<DIV CLASS="center">
<IMG SRC="libgraph.gif">
</DIV>

<BR>
<BR>

<a HREF="libref/Graphics.html"> Module <tt>Graphics</tt>: machine-independent graphics primitives</a> <img alt="updated" src="updated_tiny.gif">
<BR>
<BR>

<BR>
<BR>
<HR>
<A HREF="manual038.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="manual040.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>