~ubuntu-branches/ubuntu/maverick/xbill/maverick

« back to all changes in this revision

Viewing changes to Picture.cc

  • Committer: Bazaar Package Importer
  • Author(s): Adrian Bridgett
  • Date: 2001-06-24 22:44:40 UTC
  • Revision ID: james.westby@ubuntu.com-20010624224440-r8kbgt5ae7q1230g
Tags: upstream-2.0
ImportĀ upstreamĀ versionĀ 2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "Picture.h"
 
2
#include "objects.h"
 
3
 
 
4
void Picture::load(const char *name, int index) {
 
5
        static char *dir = strdup(
 
6
                access(XBILL_HOME "pixmaps/logo.xpm", R_OK) ? "" : XBILL_HOME);
 
7
        int i;
 
8
        char file[255];
 
9
        Pixmap mask;
 
10
        XpmAttributes attr;
 
11
        unsigned long gcmask;
 
12
        XGCValues gcval;
 
13
        gcmask = GCForeground|GCBackground|GCGraphicsExposures;
 
14
        gcval.graphics_exposures = False;
 
15
        attr.valuemask= XpmCloseness | XpmReturnPixels | XpmColormap | XpmDepth;
 
16
        attr.closeness = 65535;
 
17
        attr.colormap = ui.colormap;
 
18
        attr.depth = ui.depth;
 
19
        if (index>=0)
 
20
                sprintf (file, "%spixmaps/%s_%d.xpm", dir, name, index);
 
21
        else sprintf
 
22
                (file, "%spixmaps/%s.xpm", dir, name);
 
23
        i = XpmReadFileToPixmap(ui.display, ui.rootwindow, file, &pix,
 
24
                &mask, &attr);
 
25
        if (i<0) {
 
26
                printf ("cannot open %s\n", file);
 
27
                exit(1);
 
28
        }
 
29
        gc = XCreateGC (ui.display, ui.offscreen, gcmask, &gcval);
 
30
        XSetClipMask(ui.display, gc, mask);
 
31
        width = attr.width;
 
32
        height = attr.height;
 
33
}