~ubuntu-branches/ubuntu/quantal/xbill/quantal

« back to all changes in this revision

Viewing changes to Picture.cc

  • Committer: Bazaar Package Importer
  • Author(s): Adrian Bridgett
  • Date: 2004-09-07 09:52:14 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040907095214-d0m46ojc8f7upuqm
Tags: 2.1-4
maintainer upload of NMU - many thanks Tollef (closes: #268885) 

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
 
}