annotate src/glyphs-msw.c @ 282:c42ec1d1cded r21-0b39

Import from CVS: tag r21-0b39
author cvs
date Mon, 13 Aug 2007 10:33:18 +0200
parents 7df0dd720c89
children 558f606b08ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
1 /* mswindows-specific Lisp objects.
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2 Copyright (C) 1998 Andy Piper.
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
3
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
4 This file is part of XEmacs.
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
5
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
9 later version.
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
10
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
14 for more details.
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
15
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
20
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
22
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
23 /* written by Andy Piper <andyp@parallax.co.uk> plagerising buts from
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
24 glyphs-x.c */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
25
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
26 #include <config.h>
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
27 #include "lisp.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
28 #include "lstream.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
29 #include "console-msw.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
30 #include "glyphs-msw.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
31 #include "objects-msw.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
32
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
33 #include "buffer.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
34 #include "frame.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
35 #include "insdel.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
36 #include "opaque.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
37 #include "sysfile.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
38 #include "faces.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
39 #include "imgproc.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
40
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
41 #ifdef FILE_CODING
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
42 #include "file-coding.h"
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
43 #endif
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
44
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
45 DEFINE_IMAGE_INSTANTIATOR_FORMAT (bmp);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
46 Lisp_Object Qbmp;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
47 Lisp_Object Vmswindows_bitmap_file_path;
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
48 static COLORREF transparent_color = RGB (1,1,1);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
49
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
50 static void
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
51 mswindows_initialize_dibitmap_image_instance (struct Lisp_Image_Instance *ii,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
52 enum image_instance_type type);
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
53 static void
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
54 mswindows_initialize_image_instance_mask (struct Lisp_Image_Instance* image,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
55 struct frame* f);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
56
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
57 COLORREF mswindows_string_to_color (CONST char *name);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
58
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
59 /************************************************************************/
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
60 /* convert from a series of RGB triples to a BITMAPINFO formated for the*/
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
61 /* proper display */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
62 /************************************************************************/
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
63 static BITMAPINFO* convert_EImage_to_DIBitmap (Lisp_Object device,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
64 int width, int height,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
65 unsigned char *pic,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
66 int *bit_count,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
67 unsigned char** bmp_data)
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
68 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
69 struct device *d = XDEVICE (device);
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
70 int i,j;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
71 RGBQUAD* colortbl;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
72 int ncolors;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
73 BITMAPINFO* bmp_info;
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
74 unsigned char *ip, *dp;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
75
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
76 if (DEVICE_MSWINDOWS_BITSPIXEL (d) > 0)
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
77 {
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
78 int bpline=(int)(~3UL & (unsigned long)((width*3) +3));
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
79 /* FIXME: we can do this because 24bpp implies no colour table, once
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
80 * we start paletizing this is no longer true. The X versions of
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
81 * this function quantises to 256 colours or bit masks down to a
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
82 * long. Windows can actually handle rgb triples in the raw so I
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
83 * don't see much point trying to optimize down to the best
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
84 * structure - unless it has memory / color allocation implications
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
85 * .... */
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
86 bmp_info=xnew_and_zero (BITMAPINFO);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
87
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
88 if (!bmp_info)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
89 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
90 return NULL;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
91 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
92
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
93 bmp_info->bmiHeader.biBitCount=24; /* just RGB triples for now */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
94 bmp_info->bmiHeader.biCompression=BI_RGB; /* just RGB triples for now */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
95 bmp_info->bmiHeader.biSizeImage=width*height*3;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
96
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
97 /* bitmap data needs to be in blue, green, red triples - in that
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
98 order, eimage is in RGB format so we need to convert */
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
99 *bmp_data = xnew_array_and_zero (unsigned char, bpline * height);
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
100 *bit_count = bpline * height;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
101
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
102 if (!bmp_data)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
103 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
104 xfree (bmp_info);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
105 return NULL;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
106 }
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
107
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
108 ip = pic;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
109 for (i = height-1; i >= 0; i--) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
110 dp = (*bmp_data) + (i * bpline);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
111 for (j = 0; j < width; j++) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
112 dp[2] =*ip++;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
113 dp[1] =*ip++;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
114 *dp =*ip++;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
115 dp += 3;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
116 }
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
117 }
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
118 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
119 else /* scale to 256 colors */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
120 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
121 int rd,gr,bl;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
122 quant_table *qtable;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
123 int bpline= (int)(~3UL & (unsigned long)(width +3));
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
124 /* Quantize the image and get a histogram while we're at it.
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
125 Do this first to save memory */
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
126 qtable = build_EImage_quantable(pic, width, height, 256);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
127 if (qtable == NULL) return NULL;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
128
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
129 /* use our quantize table to allocate the colors */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
130 ncolors = qtable->num_active_colors;
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
131 bmp_info=(BITMAPINFO*)xmalloc_and_zero (sizeof(BITMAPINFOHEADER) +
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
132 sizeof(RGBQUAD) * ncolors);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
133 if (!bmp_info)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
134 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
135 xfree (qtable);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
136 return NULL;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
137 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
138
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
139 colortbl=(RGBQUAD*)(((unsigned char*)bmp_info)+sizeof(BITMAPINFOHEADER));
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
140
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
141 bmp_info->bmiHeader.biBitCount=8;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
142 bmp_info->bmiHeader.biCompression=BI_RGB;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
143 bmp_info->bmiHeader.biSizeImage=bpline*height;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
144 bmp_info->bmiHeader.biClrUsed=ncolors;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
145 bmp_info->bmiHeader.biClrImportant=ncolors;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
146
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
147 *bmp_data = (unsigned char *) xmalloc_and_zero (bpline * height);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
148 *bit_count = bpline * height;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
149
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
150 if (!*bmp_data)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
151 {
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
152 xfree (qtable);
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
153 xfree (bmp_info);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
154 return NULL;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
155 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
156
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
157 /* build up an RGBQUAD colortable */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
158 for (i = 0; i < qtable->num_active_colors; i++) {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
159 colortbl[i].rgbRed = qtable->rm[i];
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
160 colortbl[i].rgbGreen = qtable->gm[i];
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
161 colortbl[i].rgbBlue = qtable->bm[i];
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
162 colortbl[i].rgbReserved = 0;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
163 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
164
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
165 /* now build up the data. picture has to be upside-down and
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
166 back-to-front for msw bitmaps */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
167 ip = pic;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
168 for (i = height-1; i >= 0; i--) {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
169 dp = (*bmp_data) + (i * bpline);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
170 for (j = 0; j < width; j++) {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
171 rd = *ip++;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
172 gr = *ip++;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
173 bl = *ip++;
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
174 *dp++ = QUANT_GET_COLOR (qtable,rd,gr,bl);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
175 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
176 }
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
177 xfree (qtable);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
178 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
179 /* fix up the standard stuff */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
180 bmp_info->bmiHeader.biWidth=width;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
181 bmp_info->bmiHeader.biHeight=height;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
182 bmp_info->bmiHeader.biPlanes=1;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
183 bmp_info->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
184 bmp_info->bmiHeader.biXPelsPerMeter=0; /* unless you know better */
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
185 bmp_info->bmiHeader.biYPelsPerMeter=0;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
186
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
187 return bmp_info;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
188 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
189
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
190 /* Given a pixmap filename, look through all of the "standard" places
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
191 where the file might be located. Return a full pathname if found;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
192 otherwise, return Qnil. */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
193
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
194 static Lisp_Object
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
195 mswindows_locate_pixmap_file (Lisp_Object name)
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
196 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
197 /* This function can GC if IN_REDISPLAY is false */
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
198 Lisp_Object found;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
199
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
200 /* Check non-absolute pathnames with a directory component relative to
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
201 the search path; that's the way Xt does it. */
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
202 if (IS_DIRECTORY_SEP(XSTRING_BYTE (name, 0)) ||
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
203 (XSTRING_BYTE (name, 0) == '.' &&
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
204 (IS_DIRECTORY_SEP(XSTRING_BYTE (name, 1)) ||
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
205 (XSTRING_BYTE (name, 1) == '.' &&
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
206 (IS_DIRECTORY_SEP(XSTRING_BYTE (name, 2)))))))
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
207 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
208 if (!NILP (Ffile_readable_p (name)))
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
209 return name;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
210 else
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
211 return Qnil;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
212 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
213
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
214 if (locate_file (Vmswindows_bitmap_file_path, name, "", &found, R_OK) < 0)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
215 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
216 Lisp_Object temp = list1 (Vdata_directory);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
217 struct gcpro gcpro1;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
218
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
219 GCPRO1 (temp);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
220 locate_file (temp, name, "", &found, R_OK);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
221 UNGCPRO;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
222 }
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
223
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
224 return found;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
225 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
226
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
227
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
228 /* Initialize an image instance from a bitmap
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
229
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
230 DEST_MASK specifies the mask of allowed image types.
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
231
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
232 If this fails, signal an error. INSTANTIATOR is only used
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
233 in the error message. */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
234
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
235 static void
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
236 init_image_instance_from_dibitmap (struct Lisp_Image_Instance *ii,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
237 BITMAPINFO *bmp_info,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
238 int dest_mask,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
239 void *bmp_data,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
240 int bmp_bits,
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
241 Lisp_Object instantiator,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
242 int x_hot, int y_hot,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
243 int create_mask)
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
244 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
245 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
246 struct device *d = XDEVICE (device);
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
247 struct frame *f = XFRAME (DEVICE_SELECTED_FRAME (d));
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
248 void* bmp_buf=0;
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
249 int type;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
250 HBITMAP bitmap;
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
251 HDC hdc;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
252
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
253 if (!DEVICE_MSWINDOWS_P (d))
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
254 signal_simple_error ("Not an mswindows device", device);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
255
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
256 if (NILP (DEVICE_SELECTED_FRAME (d)))
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
257 signal_simple_error ("No selected frame on mswindows device", device);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
258
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
259 if (dest_mask & IMAGE_COLOR_PIXMAP_MASK)
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
260 type = IMAGE_COLOR_PIXMAP;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
261 else if (dest_mask & IMAGE_POINTER_MASK)
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
262 type = IMAGE_POINTER;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
263 else
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
264 incompatible_image_types (instantiator, dest_mask,
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
265 IMAGE_COLOR_PIXMAP_MASK | IMAGE_POINTER_MASK);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
266 hdc = FRAME_MSWINDOWS_DC (f);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
267
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
268 bitmap=CreateDIBSection (hdc,
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
269 bmp_info,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
270 DIB_RGB_COLORS,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
271 &bmp_buf,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
272 0,0);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
273
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
274 if (!bitmap || !bmp_buf)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
275 signal_simple_error ("Unable to create bitmap", instantiator);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
276
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
277 /* copy in the actual bitmap */
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
278 memcpy (bmp_buf, bmp_data, bmp_bits);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
279
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
280 mswindows_initialize_dibitmap_image_instance (ii, type);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
281
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
282 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) =
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
283 find_keyword_in_vector (instantiator, Q_file);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
284
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
285 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = bitmap;
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
286 IMAGE_INSTANCE_MSWINDOWS_MASK (ii) = NULL;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
287 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = bmp_info->bmiHeader.biWidth;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
288 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = bmp_info->bmiHeader.biHeight;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
289 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = bmp_info->bmiHeader.biBitCount;
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
290 XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii), x_hot);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
291 XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii), y_hot);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
292
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
293 if (create_mask)
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
294 {
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
295 mswindows_initialize_image_instance_mask (ii, f);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
296 }
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
297
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
298 if (type == IMAGE_POINTER)
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
299 {
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
300 mswindows_initialize_image_instance_icon(ii, TRUE);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
301 }
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
302 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
303
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
304 static void
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
305 mswindows_init_image_instance_from_eimage (struct Lisp_Image_Instance *ii,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
306 int width, int height,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
307 unsigned char *eimage,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
308 int dest_mask,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
309 Lisp_Object instantiator,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
310 Lisp_Object domain)
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
311 {
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
312 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
313 BITMAPINFO* bmp_info;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
314 unsigned char* bmp_data;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
315 int bmp_bits;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
316 COLORREF bkcolor;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
317
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
318 if (!DEVICE_MSWINDOWS_P (XDEVICE (device)))
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
319 signal_simple_error ("Not an mswindows device", device);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
320
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
321 /* this is a hack but MaskBlt and TransparentBlt are not supported
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
322 on most windows variants */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
323 bkcolor = COLOR_INSTANCE_MSWINDOWS_COLOR
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
324 (XCOLOR_INSTANCE (FACE_BACKGROUND (Vdefault_face, domain)));
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
325
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
326 /* build a bitmap from the eimage */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
327 if (!(bmp_info=convert_EImage_to_DIBitmap (device, width, height, eimage,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
328 &bmp_bits, &bmp_data)))
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
329 {
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
330 signal_simple_error ("EImage to DIBitmap conversion failed",
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
331 instantiator);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
332 }
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
333
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
334 /* Now create the pixmap and set up the image instance */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
335 init_image_instance_from_dibitmap (ii, bmp_info, dest_mask,
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
336 bmp_data, bmp_bits, instantiator,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
337 0, 0, 0);
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
338
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
339 xfree (bmp_info);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
340 xfree (bmp_data);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
341 }
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
342
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
343 static void set_mono_pixel ( unsigned char* bits,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
344 int bpline, int height,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
345 int x, int y, int white )
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
346 {
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
347 int index;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
348 unsigned char bitnum;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
349 /* Find the byte on which this scanline begins */
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
350 index = (height - y - 1) * bpline;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
351 /* Find the byte containing this pixel */
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
352 index += (x >> 3);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
353 /* Which bit is it? */
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
354 bitnum = (unsigned char)( 7 - (x % 8) );
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
355 if( white ) /* Turn it on */
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
356 bits[index] |= (1<<bitnum);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
357 else /* Turn it off */
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
358 bits[index] &= ~(1<<bitnum);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
359 }
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
360
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
361 static void
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
362 mswindows_initialize_image_instance_mask (struct Lisp_Image_Instance* image,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
363 struct frame* f)
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
364 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
365 HBITMAP mask, bmp;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
366 HDC hcdc = FRAME_MSWINDOWS_CDC (f);
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
367 BITMAPINFO* bmp_info =
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
368 xmalloc_and_zero (sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD));
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
369 int i, j;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
370 int height = IMAGE_INSTANCE_PIXMAP_HEIGHT (image);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
371
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
372 void* and_bits;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
373 int bpline= (int)(~3UL & (unsigned long)
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
374 (((IMAGE_INSTANCE_PIXMAP_WIDTH (image)+7)/8) +3));
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
375
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
376 bmp_info->bmiHeader.biWidth=IMAGE_INSTANCE_PIXMAP_WIDTH (image);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
377 bmp_info->bmiHeader.biHeight = height;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
378 bmp_info->bmiHeader.biPlanes=1;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
379 bmp_info->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
380 bmp_info->bmiHeader.biBitCount=1;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
381 bmp_info->bmiHeader.biCompression=BI_RGB;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
382 bmp_info->bmiHeader.biClrUsed = 2;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
383 bmp_info->bmiHeader.biClrImportant = 2;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
384 bmp_info->bmiHeader.biSizeImage = height * bpline;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
385 bmp_info->bmiColors[0].rgbRed = 0;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
386 bmp_info->bmiColors[0].rgbGreen = 0;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
387 bmp_info->bmiColors[0].rgbBlue = 0;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
388 bmp_info->bmiColors[0].rgbReserved = 0;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
389 bmp_info->bmiColors[1].rgbRed = 255;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
390 bmp_info->bmiColors[1].rgbGreen = 255;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
391 bmp_info->bmiColors[1].rgbBlue = 255;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
392 bmp_info->bmiColors[0].rgbReserved = 0;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
393
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
394 if (!(mask = CreateDIBSection (hcdc,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
395 bmp_info,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
396 DIB_RGB_COLORS,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
397 &and_bits,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
398 0,0)))
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
399 {
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
400 xfree (bmp_info);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
401 return;
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
402 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
403
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
404 xfree (bmp_info);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
405 SelectObject (hcdc, IMAGE_INSTANCE_MSWINDOWS_BITMAP (image));
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
406
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
407 for(i=0; i<IMAGE_INSTANCE_PIXMAP_WIDTH (image); i++)
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
408 {
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
409 for(j=0; j<height; j++)
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
410 {
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
411 if( GetPixel( hcdc, i, j ) == transparent_color )
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
412 {
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
413 SetPixel( hcdc, i, j, RGB (0,0,0));
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
414 set_mono_pixel( and_bits, bpline, height, i, j, TRUE );
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
415 }
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
416 else
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
417 {
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
418 set_mono_pixel( and_bits, bpline, height, i, j, FALSE );
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
419 }
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
420 }
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
421 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
422
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
423 GdiFlush();
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
424 SelectObject(hcdc, 0);
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
425
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
426 IMAGE_INSTANCE_MSWINDOWS_MASK (image) = mask;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
427 }
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
428
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
429 void
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
430 mswindows_initialize_image_instance_icon (struct Lisp_Image_Instance* image,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
431 int cursor)
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
432 {
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
433 ICONINFO x_icon;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
434
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
435 /* we rely on windows to do any resizing necessary */
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
436 x_icon.fIcon=cursor ? FALSE : TRUE;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
437 x_icon.xHotspot=XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (image));
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
438 x_icon.yHotspot=XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (image));
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
439 x_icon.hbmMask=IMAGE_INSTANCE_MSWINDOWS_MASK (image);
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
440 x_icon.hbmColor=IMAGE_INSTANCE_MSWINDOWS_BITMAP (image);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
441
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
442 IMAGE_INSTANCE_MSWINDOWS_ICON (image)=
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
443 CreateIconIndirect (&x_icon);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
444 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
445
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
446 int
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
447 mswindows_resize_dibitmap_instance (struct Lisp_Image_Instance* ii,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
448 struct frame* f,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
449 int newx, int newy)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
450 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
451 HBITMAP newbmp;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
452 HDC hcdc = FRAME_MSWINDOWS_CDC (f);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
453 HDC hdcDst = CreateCompatibleDC (hcdc);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
454
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
455 SelectObject(hcdc, IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii));
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
456
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
457 newbmp = CreateCompatibleBitmap(hcdc, newx, newy);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
458
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
459 DeleteObject( SelectObject(hdcDst, newbmp) );
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
460
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
461 if (!StretchBlt(hdcDst, 0, 0, newx, newy,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
462 hcdc, 0, 0,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
463 IMAGE_INSTANCE_PIXMAP_WIDTH (ii),
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
464 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii),
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
465 SRCCOPY))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
466 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
467 return FALSE;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
468 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
469
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
470 SelectObject(hdcDst, 0);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
471 SelectObject(hcdc, 0);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
472
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
473 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
474 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii));
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
475 if (IMAGE_INSTANCE_MSWINDOWS_MASK (ii))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
476 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_MASK (ii));
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
477
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
478 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = newbmp;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
479 IMAGE_INSTANCE_MSWINDOWS_MASK (ii) = newbmp;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
480 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = newx;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
481 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = newy;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
482
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
483 DeleteDC(hdcDst);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
484
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
485 return TRUE;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
486 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
487
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
488 /**********************************************************************
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
489 * XPM *
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
490 **********************************************************************/
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
491
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
492 #ifdef HAVE_XPM
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
493
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
494 struct color_symbol
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
495 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
496 char* name;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
497 COLORREF color;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
498 };
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
499
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
500 static struct color_symbol*
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
501 extract_xpm_color_names (Lisp_Object device,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
502 Lisp_Object domain,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
503 Lisp_Object color_symbol_alist,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
504 int* nsymbols)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
505 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
506 /* This function can GC */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
507 Lisp_Object rest;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
508 Lisp_Object results = Qnil;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
509 int i, j;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
510 struct color_symbol *colortbl;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
511 struct gcpro gcpro1, gcpro2;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
512
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
513 GCPRO2 (results, device);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
514
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
515 /* We built up results to be (("name" . #<color>) ...) so that if an
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
516 error happens we don't lose any malloc()ed data, or more importantly,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
517 leave any pixels allocated in the server. */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
518 i = 0;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
519 LIST_LOOP (rest, color_symbol_alist)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
520 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
521 Lisp_Object cons = XCAR (rest);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
522 Lisp_Object name = XCAR (cons);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
523 Lisp_Object value = XCDR (cons);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
524 if (NILP (value))
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
525 continue;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
526 if (STRINGP (value))
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
527 value =
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
528 Fmake_color_instance
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
529 (value, device, encode_error_behavior_flag (ERROR_ME_NOT));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
530 else
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
531 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
532 assert (COLOR_SPECIFIERP (value));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
533 value = Fspecifier_instance (value, domain, Qnil, Qnil);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
534 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
535 if (NILP (value))
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
536 continue;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
537 results = noseeum_cons (noseeum_cons (name, value), results);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
538 i++;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
539 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
540 UNGCPRO; /* no more evaluation */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
541
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
542 *nsymbols=i;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
543 if (i == 0) return 0;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
544
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
545 colortbl = xnew_array_and_zero (struct color_symbol, i);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
546
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
547 for (j=0; j<i; j++)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
548 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
549 Lisp_Object cons = XCAR (results);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
550 colortbl[j].color =
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
551 COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (XCDR (cons)));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
552
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
553 colortbl[j].name = (char *) XSTRING_DATA (XCAR (cons));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
554 free_cons (XCONS (cons));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
555 cons = results;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
556 results = XCDR (results);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
557 free_cons (XCONS (cons));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
558 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
559 return colortbl;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
560 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
561
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
562 static int xpm_to_eimage (Lisp_Object image, CONST Extbyte *buffer,
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
563 unsigned char** data,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
564 int* width, int* height,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
565 int* x_hot, int* y_hot,
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
566 int* transp,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
567 struct color_symbol* color_symbols,
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
568 int nsymbols)
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
569 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
570 XpmImage xpmimage;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
571 XpmInfo xpminfo;
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
572 int result, i, j, transp_idx, maskbpline;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
573 unsigned char* dptr;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
574 unsigned int* sptr;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
575 COLORREF color; /* the american spelling virus hits again .. */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
576 COLORREF* colortbl;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
577
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
578 xzero (xpmimage);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
579 xzero (xpminfo);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
580 xpminfo.valuemask=XpmHotspot;
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
581 *transp=FALSE;
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
582
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
583 result = XpmCreateXpmImageFromBuffer ((char*)buffer,
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
584 &xpmimage,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
585 &xpminfo);
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
586 switch (result)
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
587 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
588 case XpmSuccess:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
589 break;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
590 case XpmFileInvalid:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
591 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
592 signal_simple_error ("invalid XPM data", image);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
593 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
594 case XpmNoMemory:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
595 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
596 signal_double_file_error ("Parsing pixmap data",
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
597 "out of memory", image);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
598 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
599 default:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
600 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
601 signal_double_file_error_2 ("Parsing pixmap data",
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
602 "unknown error code",
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
603 make_int (result), image);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
604 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
605 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
606
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
607 *width = xpmimage.width;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
608 *height = xpmimage.height;
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
609 maskbpline = (int)(~3UL & (unsigned long)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
610 (((~7UL & (unsigned long)(*width + 7)) / 8) + 3));
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
611
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
612 *data = xnew_array_and_zero (unsigned char, *width * *height * 3);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
613
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
614 if (!*data)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
615 {
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
616 XpmFreeXpmImage (&xpmimage);
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
617 XpmFreeXpmInfo (&xpminfo);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
618 return 0;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
619 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
620
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
621 /* build a color table to speed things up */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
622 colortbl = xnew_array_and_zero (COLORREF, xpmimage.ncolors);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
623 if (!colortbl)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
624 {
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
625 xfree (*data);
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
626 XpmFreeXpmImage (&xpmimage);
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
627 XpmFreeXpmInfo (&xpminfo);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
628 return 0;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
629 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
630
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
631 for (i=0; i<xpmimage.ncolors; i++)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
632 {
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
633 /* pick up symbolic colors */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
634 if (xpmimage.colorTable[i].c_color == 0
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
635 &&
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
636 xpmimage.colorTable[i].symbolic != 0)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
637 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
638 if (!color_symbols)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
639 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
640 xfree (*data);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
641 xfree (colortbl);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
642 XpmFreeXpmImage (&xpmimage);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
643 XpmFreeXpmInfo (&xpminfo);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
644 return 0;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
645 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
646 for (j = 0; j<nsymbols; j++)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
647 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
648 if (!strcmp (xpmimage.colorTable[i].symbolic,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
649 color_symbols[j].name ))
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
650 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
651 colortbl[i]=color_symbols[j].color;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
652 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
653 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
654 }
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
655 /* pick up transparencies */
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
656 else if (!strcasecmp (xpmimage.colorTable[i].c_color,"None")
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
657 ||
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
658 xpmimage.colorTable[i].symbolic
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
659 &&
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
660 (!strcasecmp (xpmimage.colorTable[i].symbolic,"BgColor")
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
661 ||
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
662 !strcasecmp (xpmimage.colorTable[i].symbolic,"None")))
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
663 {
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
664 *transp=TRUE;
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
665 colortbl[i]=transparent_color;
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
666 transp_idx=i;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
667 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
668 else
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
669 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
670 colortbl[i]=
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
671 mswindows_string_to_color (xpmimage.colorTable[i].c_color);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
672 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
673 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
674
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
675 /* convert the image */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
676 sptr=xpmimage.data;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
677 dptr=*data;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
678 for (i = 0; i< *width * *height; i++)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
679 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
680 color = colortbl[*sptr++];
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
681
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
682 /* split out the 0x02bbggrr colorref into an rgb triple */
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
683 *dptr++=GetRValue (color); /* red */
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
684 *dptr++=GetGValue (color); /* green */
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
685 *dptr++=GetBValue (color); /* blue */
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
686 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
687
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
688 *x_hot=xpminfo.x_hotspot;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
689 *y_hot=xpminfo.y_hotspot;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
690
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
691 XpmFreeXpmImage (&xpmimage);
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
692 XpmFreeXpmInfo (&xpminfo);
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
693 xfree (colortbl);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
694 return TRUE;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
695 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
696
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
697 static void
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
698 mswindows_xpm_instantiate (Lisp_Object image_instance,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
699 Lisp_Object instantiator,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
700 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
701 int dest_mask, Lisp_Object domain)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
702 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
703 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
704 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
705 CONST Extbyte *bytes;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
706 Extcount len;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
707 unsigned char *eimage;
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
708 int width, height, x_hot, y_hot;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
709 BITMAPINFO* bmp_info;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
710 unsigned char* bmp_data;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
711 int bmp_bits;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
712 COLORREF bkcolor;
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
713 int nsymbols=0, transp;
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
714 struct color_symbol* color_symbols=NULL;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
715
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
716 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
717 Lisp_Object color_symbol_alist = find_keyword_in_vector (instantiator,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
718 Q_color_symbols);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
719
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
720 if (!DEVICE_MSWINDOWS_P (XDEVICE (device)))
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
721 signal_simple_error ("Not an mswindows device", device);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
722
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
723 assert (!NILP (data));
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
724
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
725 GET_STRING_BINARY_DATA_ALLOCA (data, bytes, len);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
726
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
727 /* in case we have color symbols */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
728 color_symbols = extract_xpm_color_names (device, domain,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
729 color_symbol_alist, &nsymbols);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
730
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
731 /* convert to an eimage to make processing easier */
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
732 if (!xpm_to_eimage (image_instance, bytes, &eimage, &width, &height,
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
733 &x_hot, &y_hot, &transp, color_symbols, nsymbols))
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
734 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
735 signal_simple_error ("XPM to EImage conversion failed",
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
736 image_instance);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
737 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
738
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
739 if (color_symbols)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
740 xfree(color_symbols);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
741
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
742 /* build a bitmap from the eimage */
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
743 if (!(bmp_info=convert_EImage_to_DIBitmap (device, width, height, eimage,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
744 &bmp_bits, &bmp_data)))
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
745 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
746 signal_simple_error ("XPM to EImage conversion failed",
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
747 image_instance);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
748 }
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
749 xfree (eimage);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
750
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
751 /* Now create the pixmap and set up the image instance */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
752 init_image_instance_from_dibitmap (ii, bmp_info, dest_mask,
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
753 bmp_data, bmp_bits, instantiator,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
754 x_hot, y_hot, transp);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
755
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
756 xfree (bmp_info);
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
757 xfree (bmp_data);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
758 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
759 #endif /* HAVE_XPM */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
760
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
761 /**********************************************************************
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
762 * BMP *
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
763 **********************************************************************/
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
764
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
765 static void
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
766 bmp_validate (Lisp_Object instantiator)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
767 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
768 file_or_data_must_be_present (instantiator);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
769 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
770
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
771 static Lisp_Object
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
772 bmp_normalize (Lisp_Object inst, Lisp_Object console_type)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
773 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
774 return simple_image_type_normalize (inst, console_type, Qbmp);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
775 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
776
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
777 static int
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
778 bmp_possible_dest_types (void)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
779 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
780 return IMAGE_COLOR_PIXMAP_MASK;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
781 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
782
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
783 static void
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
784 bmp_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
785 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
786 int dest_mask, Lisp_Object domain)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
787 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
788 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
789 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
790 CONST Extbyte *bytes;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
791 Extcount len;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
792 BITMAPFILEHEADER* bmp_file_header;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
793 BITMAPINFO* bmp_info;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
794 void* bmp_data;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
795 int bmp_bits;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
796 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
797
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
798 if (!DEVICE_MSWINDOWS_P (XDEVICE (device)))
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
799 signal_simple_error ("Not an mswindows device", device);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
800
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
801 assert (!NILP (data));
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
802
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
803 GET_STRING_BINARY_DATA_ALLOCA (data, bytes, len);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
804
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
805 /* Then slurp the image into memory, decoding along the way.
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
806 The result is the image in a simple one-byte-per-pixel
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
807 format. */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
808
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
809 bmp_file_header=(BITMAPFILEHEADER*)bytes;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
810 bmp_info = (BITMAPINFO*)(bytes + sizeof(BITMAPFILEHEADER));
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
811 bmp_data = (Extbyte*)bytes + bmp_file_header->bfOffBits;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
812 bmp_bits = bmp_file_header->bfSize - bmp_file_header->bfOffBits;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
813
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
814 /* Now create the pixmap and set up the image instance */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
815 init_image_instance_from_dibitmap (ii, bmp_info, dest_mask,
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
816 bmp_data, bmp_bits, instantiator,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
817 0, 0, 0);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
818 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
819
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
820
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
821 /************************************************************************/
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
822 /* image instance methods */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
823 /************************************************************************/
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
824
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
825 static void
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
826 mswindows_print_image_instance (struct Lisp_Image_Instance *p,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
827 Lisp_Object printcharfun,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
828 int escapeflag)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
829 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
830 char buf[100];
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
831
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
832 switch (IMAGE_INSTANCE_TYPE (p))
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
833 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
834 case IMAGE_MONO_PIXMAP:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
835 case IMAGE_COLOR_PIXMAP:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
836 case IMAGE_POINTER:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
837 sprintf (buf, " (0x%lx",
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
838 (unsigned long) IMAGE_INSTANCE_MSWINDOWS_BITMAP (p));
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
839 write_c_string (buf, printcharfun);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
840 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p))
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
841 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
842 sprintf (buf, "/0x%lx",
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
843 (unsigned long) IMAGE_INSTANCE_MSWINDOWS_MASK (p));
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
844 write_c_string (buf, printcharfun);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
845 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
846 write_c_string (")", printcharfun);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
847 break;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
848 default:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
849 break;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
850 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
851 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
852
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
853 static void
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
854 mswindows_finalize_image_instance (struct Lisp_Image_Instance *p)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
855 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
856 if (!p->data)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
857 return;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
858
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
859 if (DEVICE_LIVE_P (XDEVICE (p->device)))
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
860 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
861 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP (p))
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
862 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_BITMAP (p));
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
863 IMAGE_INSTANCE_MSWINDOWS_BITMAP (p) = 0;
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
864 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
865 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_MASK (p));
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
866 IMAGE_INSTANCE_MSWINDOWS_MASK (p) = 0;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
867 if (IMAGE_INSTANCE_MSWINDOWS_ICON (p))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
868 DestroyIcon (IMAGE_INSTANCE_MSWINDOWS_ICON (p));
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
869 IMAGE_INSTANCE_MSWINDOWS_ICON (p) = 0;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
870 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
871
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
872 xfree (p->data);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
873 p->data = 0;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
874 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
875
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
876 static int
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
877 mswindows_image_instance_equal (struct Lisp_Image_Instance *p1,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
878 struct Lisp_Image_Instance *p2, int depth)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
879 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
880 switch (IMAGE_INSTANCE_TYPE (p1))
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
881 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
882 case IMAGE_MONO_PIXMAP:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
883 case IMAGE_COLOR_PIXMAP:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
884 case IMAGE_POINTER:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
885 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP (p1)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
886 != IMAGE_INSTANCE_MSWINDOWS_BITMAP (p2))
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
887 return 0;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
888 break;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
889 default:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
890 break;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
891 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
892
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
893 return 1;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
894 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
895
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
896 static unsigned long
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
897 mswindows_image_instance_hash (struct Lisp_Image_Instance *p, int depth)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
898 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
899 switch (IMAGE_INSTANCE_TYPE (p))
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
900 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
901 case IMAGE_MONO_PIXMAP:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
902 case IMAGE_COLOR_PIXMAP:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
903 case IMAGE_POINTER:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
904 return (unsigned long) IMAGE_INSTANCE_MSWINDOWS_BITMAP (p);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
905 default:
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
906 return 0;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
907 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
908 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
909
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
910 /* Set all the slots in an image instance structure to reasonable
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
911 default values. This is used somewhere within an instantiate
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
912 method. It is assumed that the device slot within the image
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
913 instance is already set -- this is the case when instantiate
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
914 methods are called. */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
915
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
916 static void
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
917 mswindows_initialize_dibitmap_image_instance (struct Lisp_Image_Instance *ii,
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
918 enum image_instance_type type)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
919 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
920 ii->data = xnew_and_zero (struct mswindows_image_instance_data);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
921 IMAGE_INSTANCE_TYPE (ii) = type;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
922 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) = Qnil;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
923 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (ii) = Qnil;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
924 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = Qnil;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
925 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = Qnil;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
926 IMAGE_INSTANCE_PIXMAP_FG (ii) = Qnil;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
927 IMAGE_INSTANCE_PIXMAP_BG (ii) = Qnil;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
928 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
929
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
930
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
931 /************************************************************************/
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
932 /* initialization */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
933 /************************************************************************/
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
934
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
935 void
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
936 syms_of_glyphs_mswindows (void)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
937 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
938 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
939
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
940 void
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
941 console_type_create_glyphs_mswindows (void)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
942 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
943 /* image methods */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
944
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
945 CONSOLE_HAS_METHOD (mswindows, print_image_instance);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
946 CONSOLE_HAS_METHOD (mswindows, finalize_image_instance);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
947 CONSOLE_HAS_METHOD (mswindows, image_instance_equal);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
948 CONSOLE_HAS_METHOD (mswindows, image_instance_hash);
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
949 CONSOLE_HAS_METHOD (mswindows, init_image_instance_from_eimage);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
950 CONSOLE_HAS_METHOD (mswindows, locate_pixmap_file);
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
951 #ifdef HAVE_XPM
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
952 CONSOLE_HAS_METHOD (mswindows, xpm_instantiate);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
953 #endif
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
954 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
955
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
956 void
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
957 image_instantiator_format_create_glyphs_mswindows (void)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
958 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
959 /* image-instantiator types */
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
960
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
961 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (bmp, "bmp");
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
962
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
963 IIFORMAT_HAS_METHOD (bmp, validate);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
964 IIFORMAT_HAS_METHOD (bmp, normalize);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
965 IIFORMAT_HAS_METHOD (bmp, possible_dest_types);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
966 IIFORMAT_HAS_METHOD (bmp, instantiate);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
967
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
968 IIFORMAT_VALID_KEYWORD (bmp, Q_data, check_valid_string);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
969 IIFORMAT_VALID_KEYWORD (bmp, Q_file, check_valid_string);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
970 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
971
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
972 void
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
973 vars_of_glyphs_mswindows (void)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
974 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
975 Fprovide (Qbmp);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
976 DEFVAR_LISP ("mswindows-bitmap-file-path", &Vmswindows_bitmap_file_path /*
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
977 A list of the directories in which mswindows bitmap files may be found.
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
978 This is used by the `make-image-instance' function.
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
979 */ );
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
980 Vmswindows_bitmap_file_path = Qnil;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
981 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
982
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
983 void
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
984 complex_vars_of_glyphs_mswindows (void)
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
985 {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents:
diff changeset
986 }