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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 17<br />

Graphics<br />

This section describes the data types color, window, panel, and menu.<br />

17.1 Colors ( color )<br />

1. Definition<br />

<strong>The</strong> data type color is the type of all colors available for drawing operations in windows<br />

(cf. 17.2). Each color is defined by a triple of integers (r, g, b) with 0 ≤ r, g, b ≤ 255,<br />

the so-called rgb-value of the color. <strong>The</strong> number of available colors is restricted and<br />

depends on the underlying hardware. Colors can be created from rgb-values, from<br />

names in a color data base (X11), or from the 16 integer constants (enumeration in<br />

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

cyan, brown, pink, green2, blue2, grey1, grey2, grey3.<br />

#include < <strong>LEDA</strong>/graphics/color.h ><br />

2. Creation<br />

color col; creates a color with rgb-value (0, 0, 0) (i.e. black).<br />

color<br />

color<br />

col(int r, int g, int b);<br />

col(const char ∗ name);<br />

creates a color with rgb-value (r, g, b).<br />

creates a color and initializes it with the rgb-value of color name<br />

from the X11 color data base ((0, 0, 0) if name does not exist).<br />

color col(int i); creates a color and initializes it with one of the 16 predefined colors.<br />

Here i is one of the 16 integer constants black, white, red, green,<br />

blue, yellow, violet, orange, cyan, brown, pink, green2, blue2,<br />

grey1, grey2, or grey3.<br />

601

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

Saved successfully!

Ooh no, something went wrong!