1 /*
2  * Motif
3  *
4  * Copyright (c) 1987-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22 */
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 
28 #ifdef REV_INFO
29 #ifndef lint
30 static char rcsid[] = "$XConsortium: ReadImage.c /main/15 1996/10/21 11:40:15 cde-osf $"
31 #endif
32 #endif
33 
34 #include "XmI.h"		/* for _XmCreateImage() */
35 #include "ReadImageI.h"
36 
37 /************************************************************************
38  *
39  *  _XmReadImageAndHotSpotFromFile
40  *	Given a filename, extract and create an image from the file data.
41  *      This one takes a Display.
42  ************************************************************************/
43 XImage *
44 _XmReadImageAndHotSpotFromFile(
45         Display * display,
46         char *filename,
47 	int *hot_x,
48 	int *hot_y)
49 {
50    unsigned int width;
51    unsigned int height;
52    unsigned char * data;
53 
54    if (BitmapSuccess == XReadBitmapFileData(filename, &width, &height, &data,
55 			       hot_x, hot_y))
56    {
57       XImage * image;
58       _XmCreateImage(image, display, (char*)data, width, height, LSBFirst);
59 
60       return (image);
61    }
62 
63    return (NULL);
64 }
65 
66 
67