]> git.saurik.com Git - wxWidgets.git/blame - src/xpm/readme.msw
wxX11 might compile now.
[wxWidgets.git] / src / xpm / readme.msw
CommitLineData
cfbe03c9
JS
1
2README.MSW hedu@cul-ipn.uni-kiel.de 5/94
3
4 The XPM library for MS-Windows
5
6Motivated by the wxWindows library, which is a (freely available) toolkit
7for developing multi-platform, graphical applications from the same body
e6ed776f 8of C++ code, I wanted to have XPM pixmaps for MS-windows. Instead of rewriting
cfbe03c9 9a XPM-parser I managed to port the XPM-library-code to MS-windows.
e6ed776f 10Thanks to Anaud Le Hors this became a part of the official XPM-library.
cfbe03c9
JS
11
12Until now it's only used together with wxWindows. And even there it's more
13a kind of beta. But it should be possible to run it as a simple libxpm.a
14without wxWindows.
15
16The key is a transformation of some X types plus some basic X functions.
17There is not yet a special MSW-API, so you should know the X types used.
18
19The following is done in simx.h:
20
21typedef HDC Display;
22typedef COLORREF Pixel;
23
24typedef struct {
25 Pixel pixel;
26 BYTE red, green, blue;
27} XColor;
28
29typedef struct {
30 HBITMAP bitmap;
31 unsigned int width;
32 unsigned int height;
33 unsigned int depth;
34} XImage;
35
36With these defines and the according functions from simx.c you can call
37XPM-functions the way it's done under X windows. It can look like this:
38
39 ErrorStatus=XpmCreateImageFromData(&dc, data,
40 &ximage,(XImage **)NULL, &xpmAttr);
41 ms_bitmap = ximage->bitmap;
42 // releases the malloc,but do not destroy the bitmap
43 XImageFree(ximage);
44
45Supported functions are the Xpm*Image* but not the Xpm*Pixmap*.
46
47DRAWBACKS:
48The main drawback is the missing support for Colormaps! There was nothing for
49it in wxWindows, so I did not know how to deal with Colormaps.
50
51The size of the pixmaps is bounded by malloc() (width*height*2 < 64K).
52
53Close colors do not look that close. But that seems to be the window system.
54
55Neither a special API for MSW nor a special MSW documentation other than this.
56(I can only point you to wxxpm as an example , see below.)
57
58INSTALLATION:
59There is not yet a makefile with it. Simply take all the *.c files
e6ed776f 60into your project except the files related to Pixmap operations: *P*.c.
cfbe03c9
JS
61!!!You MUST set FOR_MSW on the preprocessor options!!!
62(You might uncomment NEED_STRCASECMP in xpm.h if it's in your lib)
63This should compile into libxpm.a. Good luck...
64
65FTP:
66wxWindows is currently available from the Artificial Intelligence
67Applications Institute (University of Edinburgh) by anonymous FTP.
68 skye.aiai.ed.ac.uk pub/wxwin/
69or read http://burray.aiai.ed.ac.uk/aiai/aiai.html
70
71wxxpm, XPM support for wxWindows, the latest version is available at
72 yoda.cul-ipn.uni-kiel.de pub/wxxpm/
73 and maybe in the contrib or tools of wxWindows
74
75Please contact me if you have suggestions, comments or problems!
76
e6ed776f
GRG
77================================================================
78Some fixes and comments by Jan Wielemaker (jan@swi.psy.uva.nl),
79Oct 24, 1996:
80
81 * Please try not to disturb me on this, XPM is not my
82 piece of cake.
83
84 * Hermann Dunkel has appearently moved in virtual space.
85
86Changes:
87
88 * I've used the xpm package under NT 4.0 and MSVC++ 4.2.
89
90 * I've made a big performance improvement in
91 ParseAndPutPixels(), fixed creation of the mask in
92 SetColor() in create.c. I looked into XCreateImage()
93 in simx.c, but commented out my improvement for reasons
94 you'll find there. If you know what is going on, statement
95 (1) does not apply to you.
96
97Comments on installation:
98
99 * Donot include the to/from pixmap files into the project.
100 These are the ones containing a capital P somewhere in their
101 name. You can also first include all, and then remove all
102 the files you get errors on :-)
103
104 * The DC that is requested should be a valid memory DC, thus
105 CreateCompatibleDC(NULL) provides a good generic one, but
106 GetDC(NULL) doesn't! This costed me some time.
107
108 * The real difficulty is using the mask, mostly due to the
109 bad documentation. If 95 or NT is your target, use:
110
111 MaskBlt(context.hdc, // Destination DC
112 x, y, w, h, // Destination area
113 mhdc, // Memory DC with the image selected
114 sx, sy, // Source X,Y
115 msk, // HBITMAP of the mask
116 sx, sy, // Mask X,Y
117 MAKEROP4(SRCPAINT, SRCCOPY)); // The magic op code.
118================================================================
119
120
cfbe03c9
JS
121--
122 ////|\\\\ \\\\\\ Hermann Dunkel
123 O O ////// IPN Uni Kiel, Germany
124 | \\\\\\ Tel: +49 431 / 880 3144
125 \___/ ////// E-mail: hedu@cul-ipn.uni-kiel.de
126 \_/ \\\\\\ X.400 : c=de;a=d400;p=uni-kiel;ou=nw-didaktik;s=dunkel
127