Algorithmic Solutions > LEDA > LEDA Guide > Windows and Panels > Pixrects (Pixmaps) > Example of XPM Data String

Example of an XPM Data String

The following program first defines an xpm data string and uses it in the main program to create a pixrect and draw it in a window.

On the right there is a screenshot of the program. Clicking on the picture shows the window in original size.

Picture of Convex Hull
#include <LEDA/graphics/window.h>
#include <LEDA/geo/point.h>

/* XPM */
static const char *win_icon_xpm[] = {
	/* width height ncolors chars_per_pixel */
	"32 32 11 1",
	/* colors */
	"` c #020202",
	"a c #999999",
	"b c #000099",
	"c c #CCCCCC",
	"d c #CC0000",
	"e c None",
	"f c #FF0000",
	"g c #999900",
	"h c #FFFFFF",
	"i c #FFFF00",
	"j c #0000FF",
	/* pixels */

int main()
  leda::window W(400,400);
  char * pr = W.create_pixrect(win_icon_xpm);
  leda::point p;	
  while (W>>p) W.put_pixrect(p,pr);
  return 0;

See also:

Pixrects (Pixmaps)


Windows and Panels

Manual Pages:

Manual Page Windows

Please send any suggestions, comments or questions to
© Copyright 2001-2003, Algorithmic Solutions Software GmbH