home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.pdx.edu
/
2014.02.ftp.ee.pdx.edu.tar
/
ftp.ee.pdx.edu
/
oss
/
cvs-2004
/
psang
/
xpm2pixmap.c,v
< prev
next >
Wrap
Text File
|
2003-07-07
|
3KB
|
104 lines
head 1.1;
branch 1.1.1;
access ;
symbols Initial:1.1.1.1 psang:1.1.1;
locks ; strict;
comment @ * @;
1.1
date 2003.07.07.19.32.23; author jhoffman; state Exp;
branches 1.1.1.1;
next ;
1.1.1.1
date 2003.07.07.19.32.23; author jhoffman; state Exp;
branches ;
next ;
desc
@@
1.1
log
@Initial revision
@
text
@/* xpm2pixmap.c - xtron v1.1 routine to convert from xpm to pixmap
*
* Copyright (C) 1995 Rhett D. Jacobs <rhett@@hotel.canberra.edu.au>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Last Modified: 16/4/95
*/
#include "xpm2pixmap.h"
extern Window main_window;
extern Display *display;
extern int screen;
/* ReadXPM is copyright (c) 1994 Alex Brown All Rights Reserved. Used by permission. */
Pixmap ReadXPM(char *filename)
{
Window root;
Pixmap rootXpm;
char real_filename[MAX_PATH_LEN];
XWindowAttributes root_attr;
XpmAttributes xpm_attributes;
int val;
char resfilename[MAX_PATH_LEN];
PixmapsDIR(resfilename);
strcpy(real_filename, resfilename);
strcat(real_filename, filename);
root = RootWindow(display, screen);
XGetWindowAttributes(display,root,&root_attr);
xpm_attributes.colormap = root_attr.colormap;
xpm_attributes.valuemask = XpmSize | XpmReturnPixels|XpmColormap;
if((val = XpmReadFileToPixmap(display, root, real_filename,
&rootXpm, NULL,
&xpm_attributes))!= XpmSuccess) {
if(val == XpmOpenFailed)
fprintf(stderr, "Couldn't open pixmap file %s\n", real_filename);
else if(val == XpmColorFailed)
fprintf(stderr, "Couldn't allocated required colors\n");
else if(val == XpmFileInvalid)
fprintf(stderr, "Invalid Format for an Xpm File\n");
else if(val == XpmColorError)
fprintf(stderr, "Invalid Color specified in Xpm FIle\n");
else if(val == XpmNoMemory)
fprintf(stderr, "Insufficient Memory\n");
return -1;
}
return(rootXpm);
}
@
1.1.1.1
log
@Protocol for Simple Arcade-Style Network Gaming
@
text
@@