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.
|
|
#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 */
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"eeeebbbbbeeeeeeeeeeeeeeedeeeeeee",
"eebjbjbjbbbeeeeeeeeeeeeedeeeeeee",
"ebjbjjjbjbbbeeeeeeeeeeedi`eeeeee",
"ejbjcjjjbjbbeeeeeeeeeeedi`eeeeee",
"bbjcccjjjbjbbeeeeeeeeedifd`eeeee",
"bjjjcjjjjjbbbeeeeeeeeedifd`eeeee",
"bbjjjjjjihhhhhhhhhhhedfifdd`eeee",
"bjbjjjjjiihhhhhhhhhhhdfifdd`eeee",
"bbjbjjjbiiihhhhhhhhhdfifdddd`eee",
"ebbjbjbjiiigggggggggdfifdddd`eee",
"ebbbjbjbiiiggggggggdffifdddd``ee",
"eebbbbbbiiiggggggggdffifddddd`ee",
"eeeebbbbiiigggggggdffiffddddd``e",
"eeeeeeeeiiigggggggdffifddddddd`e",
"eeeeeeeeiiiggggggddddddddddddd``",
"eeeeeeeeiiiggggggggggggaaaaaaaee",
"eeeeeeeeiiiggggggggggggaaaaaaaae",
"eeeeeeeeeiiggggggggggggaaaaeeeee",
"eeeeeeeeeeiggggggggggggaaaaaeeee",
"eeeeeeeeeeeeaaaaaaaaaaaaaaaaaeee",
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
};
int main()
{
leda::window W(400,400);
W.display();
char * pr = W.create_pixrect(win_icon_xpm);
leda::point p;
while (W>>p) W.put_pixrect(p,pr);
W.del_pixrect(pr);
return 0;
}
|
See also:
Pixrects (Pixmaps)
Bitmaps
Windows and Panels
Manual Pages:
Manual
Page Windows
|