31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

17.2 Windows ( window )<br />

1. Definition<br />

<strong>The</strong> data type window provides an interface for graphical input and output of basic twodimensional<br />

geometric objects. Application programs using this data type have to be<br />

linked with libW.a and (on UNIX systems) with the X11 base library libX11.a (cf. section<br />

1.6):<br />

CC prog.c -lW -lP -lG -lL -lX11 -lm<br />

An instance W of type window is an iso-oriented rectangular window in the twodimensional<br />

plane. <strong>The</strong> default representation of W on the screen is a square of maximal<br />

possible edge length positioned in the upper right corner of the display.<br />

In general, a window consists of two rectangular sections, a panel section in the upper<br />

part and a drawing section in the rest of the window. <strong>The</strong> panel section contains panel<br />

items such as sliders, choice fields, string items and buttons. <strong>The</strong>y have to be created<br />

before the window is opened by special panel operations described in section 17.2.<br />

<strong>The</strong> drawing section can be used for the output of geometric objects such as points, lines,<br />

segments, arrows, circles, polygons, graph, . . . and for the input of all these objects using<br />

the mouse input device. All drawing and input operations in the drawing section use a<br />

coordinate system that is defined by three parameters of type double: xmin, the minimal<br />

x-coordinate, xmax, the maximal x-coordinate, and ymin, the minimal y-coordinate. <strong>The</strong><br />

two parameters xmin and xmax define the scaling factor scaling as w/(xmax − xmin),<br />

where w is the width of the drawing section in pixels. <strong>The</strong> maximal y-coordinate ymax<br />

of the drawing section is equal to ymin + h · scaling and depends on the actual shape of<br />

the window on the screen. Here, h is the height of the drawing section in pixels.<br />

A list of all window parameters:<br />

1. <strong>The</strong> foreground color parameter (default black) defines the default color to be<br />

used in all drawing operations. <strong>The</strong>re are 18 predefined colors (enumeration in<br />

): black, white, red, green, blue, yellow, violet,<br />

orange, cyan, brown, pink, green2, blue2, grey1, grey2, grey3 ivory, and invisible.<br />

Note that all drawing operations have an optional color argument that can be used<br />

to override the default foreground color. On monochrome systems all colors different<br />

from white are displayed as black. <strong>The</strong> color invisible can be used for invisible<br />

(transparent) objects.<br />

2. <strong>The</strong> background color parameter (default white) defines the default background color<br />

(e.g. used by W .clear()).<br />

3. <strong>The</strong> text font parameter defines the name of the font to be used in all text drawing<br />

operations.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!