Algorithmic Solutions > LEDA > LEDA Guide > Windows and Panels > Bitmaps


A bitmap is a pixrect with only two possible colors. It is represented by a triple (w,h,s) where w is the width, h the height, and s the string of bits (type char *) of the bitmap.


The following operations are available to create, draw, and delete bitmaps
  char * W.create_bitmap(int w, int h, char** xbm);
  char * W.put_bitmap(double x, double y, char* bmap, color c);
  char * W.put_bitmap(point p, char* bmap, color c);
  char * W.delete_bitmap(char* bmap);
On the right you see the screenshot of the program below.

Example of Convex Hull


The following example constructs a bitmap from the leda icon and places it at the point where the left mouse button is clicked.
#include <LEDA/graphics/window.h>
#include <LEDA/graphics/bitmaps/leda_icon.xbm>

using namespace leda;

int main()
  window W(400,400);

  char * bm = W.create_bitmap(leda_icon_width,leda_icon_height,leda_icon_bits);
  //leda_icon_width, leda_icon_height, leda_icon_bits
  //are defined in 	<LEDA/bitmaps/leda_icon.xbm>

  point p;
  while (W>>p) W.put_bitmap(p.xcoord(),p.ycoord(),bm,blue);

  return 0;

See also:

Pixrects (Pixmaps)


Windows and Panels

Input and Output Operators

Basic Data Types for 2D Geometry

Manual Pages:

Manual Page Windows

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