Update Help menu
[MacVim.git] / src / xpm_w32.c
blob45765e1f1535fedea448f9135a3c8838abd8d2e3
1 /*
2 * Load XPM image.
4 * This function is placed in separate file because Xpm headers conflict with
5 * Vim ones :(
7 * Written by Sergey Khorev.
8 * http://iamphet.nm.ru/vim/index.html
9 */
11 #ifndef WIN32_LEAN_AND_MEAN
12 # define WIN32_LEAN_AND_MEAN
13 #endif
14 #include <windows.h>
16 /* reduced def from Vim.h */
17 #ifndef __ARGS
18 # if defined(__STDC__) || defined(__GNUC__) || defined(WIN3264)
19 # define __ARGS(x) x
20 # else
21 # define __ARGS(x) ()
22 # endif
23 #endif
25 #include "xpm_w32.h"
27 /* Engage Windows support in libXpm */
28 #define FOR_MSW
30 #include "xpm.h"
33 * Tries to load Xpm image from file 'filename'.
34 * If fails return -1.
35 * success - 0 and image and mask BITMAPS
37 int
38 LoadXpmImage(filename, hImage, hShape)
39 char *filename;
40 HBITMAP *hImage;
41 HBITMAP *hShape;
43 XImage *img; /* loaded image */
44 XImage *shp; /* shapeimage */
45 XpmAttributes attr;
46 int res;
47 HDC hdc = CreateCompatibleDC(NULL);
49 attr.valuemask = 0;
50 res = XpmReadFileToImage(&hdc, filename, &img, &shp, &attr);
51 DeleteDC(hdc);
52 if (res < 0)
53 return -1;
54 else
56 *hImage = img->bitmap;
57 *hShape = shp->bitmap;
58 return 0;