comparison src/glyphs-msw.c @ 593:5fd7ba8b56e7

[xemacs-hg @ 2001-05-31 12:45:27 by ben] xemacs-faq.texi: Major rewrite. Update all MS Windows info to current. Redo section 6.1 almost completely. Incorporate sections 1 and 2 of Hrvoje's FAQ. etags.el: Fix infloop when going up to the root. s\cygwin32.h: Don't unilaterally include ntplay, but only when we're compiling with native sound (look in configure now). event-msw.c: Fix yet more problems with C-g handling. Implement debug-mswindows-events. event-stream.c, events.h, signal.c, sysdep.h: Rearrange the signal-handling code to eliminate the former spaghetti logic paths in it. Document clearly what "low-level" and "high-level" timeouts are. Rename some functions with unclear names (e.g. "...alarm...") to names that reflect what they actually do (e.g. "...async_timeout..."). Fix numerous bugs discovered in the process. console-x.h, event-Xt.c, event-msw.c, frame-x.c: Hopefully make XEmacs properly maintain the "iconified" state on frames at all times. This should fix the "can't delete a frame with C-x 5 0 when there's another iconified frame out there" bug. Put a notice in of further changes that should probably be made to clean up the frame-visibility support. (especially directed at Jan Vroonhof) lisp.h, miscplay.c: Rename SBufbyte to CBufbyte to avoid a misleading name. Eliminate UChar, which is not used anywhere and contributes no semantic info. Add a comment about the documentation-only properties of the char/unsigned char typedefs. Add SChar_Binary as an explicitly `signed' version of Char_Binary and put back the `signed' declarations in miscplay.c. alloc.c: Use char typedefs. console-msw.c, device-msw.c, dialog-msw.c, editfns.c, fileio.c, glyphs-eimage.c, menubar-msw.c, ntplay.c, objects-msw.c, realpath.c, redisplay-msw.c, select-msw.c, syswindows.h, win32.c: Eliminate numerous C++ errors. frame-msw.c: Eliminate numerous C++ errors and Mule-ize. glyphs-msw.c: Eliminate numerous C++ errors and use char typedefs. configure.in: Fix problems detecting both native and Linux sound on Cygwin when compiled with --with-msw=no. Rearrange file-coding handling a bit to avoid warning when compiling with Mule. configure.in, configure.usage, INSTALL: Document XEMACS_CC and corresponding compiler option --xemacs-compiler. Explain how to build xemacs using a C++ compiler.
author ben
date Thu, 31 May 2001 12:45:41 +0000
parents 183866b06e0b
children 4d7fdf497470
comparison
equal deleted inserted replaced
592:4f6ba8f1fb3d 593:5fd7ba8b56e7
158 /* convert from a series of RGB triples to a BITMAPINFO formated for the*/ 158 /* convert from a series of RGB triples to a BITMAPINFO formated for the*/
159 /* proper display */ 159 /* proper display */
160 /************************************************************************/ 160 /************************************************************************/
161 static BITMAPINFO* convert_EImage_to_DIBitmap (Lisp_Object device, 161 static BITMAPINFO* convert_EImage_to_DIBitmap (Lisp_Object device,
162 int width, int height, 162 int width, int height,
163 unsigned char *pic, 163 UChar_Binary *pic,
164 int *bit_count, 164 int *bit_count,
165 unsigned char** bmp_data) 165 UChar_Binary** bmp_data)
166 { 166 {
167 struct device *d = XDEVICE (device); 167 struct device *d = XDEVICE (device);
168 int i,j; 168 int i,j;
169 RGBQUAD* colortbl; 169 RGBQUAD* colortbl;
170 int ncolors; 170 int ncolors;
171 BITMAPINFO* bmp_info; 171 BITMAPINFO* bmp_info;
172 unsigned char *ip, *dp; 172 UChar_Binary *ip, *dp;
173 173
174 if (GetDeviceCaps (get_device_compdc (d), BITSPIXEL) > 0) 174 if (GetDeviceCaps (get_device_compdc (d), BITSPIXEL) > 0)
175 { 175 {
176 int bpline = BPLINE(width * 3); 176 int bpline = BPLINE(width * 3);
177 /* FIXME: we can do this because 24bpp implies no color table, once 177 /* FIXME: we can do this because 24bpp implies no color table, once
192 bmp_info->bmiHeader.biCompression=BI_RGB; /* just RGB triples for now */ 192 bmp_info->bmiHeader.biCompression=BI_RGB; /* just RGB triples for now */
193 bmp_info->bmiHeader.biSizeImage=width*height*3; 193 bmp_info->bmiHeader.biSizeImage=width*height*3;
194 194
195 /* bitmap data needs to be in blue, green, red triples - in that 195 /* bitmap data needs to be in blue, green, red triples - in that
196 order, eimage is in RGB format so we need to convert */ 196 order, eimage is in RGB format so we need to convert */
197 *bmp_data = xnew_array_and_zero (unsigned char, bpline * height); 197 *bmp_data = xnew_array_and_zero (UChar_Binary, bpline * height);
198 *bit_count = bpline * height; 198 *bit_count = bpline * height;
199 199
200 if (!bmp_data) 200 if (!bmp_data)
201 { 201 {
202 xfree (bmp_info); 202 xfree (bmp_info);
232 { 232 {
233 xfree (qtable); 233 xfree (qtable);
234 return NULL; 234 return NULL;
235 } 235 }
236 236
237 colortbl=(RGBQUAD*)(((unsigned char*)bmp_info)+sizeof(BITMAPINFOHEADER)); 237 colortbl=(RGBQUAD*)(((UChar_Binary*)bmp_info)+sizeof(BITMAPINFOHEADER));
238 238
239 bmp_info->bmiHeader.biBitCount=8; 239 bmp_info->bmiHeader.biBitCount=8;
240 bmp_info->bmiHeader.biCompression=BI_RGB; 240 bmp_info->bmiHeader.biCompression=BI_RGB;
241 bmp_info->bmiHeader.biSizeImage=bpline*height; 241 bmp_info->bmiHeader.biSizeImage=bpline*height;
242 bmp_info->bmiHeader.biClrUsed=ncolors; 242 bmp_info->bmiHeader.biClrUsed=ncolors;
243 bmp_info->bmiHeader.biClrImportant=ncolors; 243 bmp_info->bmiHeader.biClrImportant=ncolors;
244 244
245 *bmp_data = (unsigned char *) xmalloc_and_zero (bpline * height); 245 *bmp_data = (UChar_Binary *) xmalloc_and_zero (bpline * height);
246 *bit_count = bpline * height; 246 *bit_count = bpline * height;
247 247
248 if (!*bmp_data) 248 if (!*bmp_data)
249 { 249 {
250 xfree (qtable); 250 xfree (qtable);
427 427
428 static void 428 static void
429 mswindows_init_image_instance_from_eimage (Lisp_Image_Instance *ii, 429 mswindows_init_image_instance_from_eimage (Lisp_Image_Instance *ii,
430 int width, int height, 430 int width, int height,
431 int slices, 431 int slices,
432 unsigned char *eimage, 432 UChar_Binary *eimage,
433 int dest_mask, 433 int dest_mask,
434 Lisp_Object instantiator, 434 Lisp_Object instantiator,
435 Lisp_Object domain) 435 Lisp_Object domain)
436 { 436 {
437 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); 437 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
438 BITMAPINFO* bmp_info; 438 BITMAPINFO* bmp_info;
439 unsigned char* bmp_data; 439 UChar_Binary* bmp_data;
440 int bmp_bits; 440 int bmp_bits;
441 COLORREF bkcolor; 441 COLORREF bkcolor;
442 int slice; 442 int slice;
443 443
444 CHECK_MSGDI_DEVICE (device); 444 CHECK_MSGDI_DEVICE (device);
472 xfree (bmp_data); 472 xfree (bmp_data);
473 } 473 }
474 } 474 }
475 475
476 inline static void 476 inline static void
477 set_mono_pixel (unsigned char* bits, 477 set_mono_pixel (UChar_Binary* bits,
478 int bpline, int height, 478 int bpline, int height,
479 int x, int y, int white) 479 int x, int y, int white)
480 { 480 {
481 int i; 481 int i;
482 unsigned char bitnum; 482 UChar_Binary bitnum;
483 /* Find the byte on which this scanline begins */ 483 /* Find the byte on which this scanline begins */
484 i = (height - y - 1) * bpline; 484 i = (height - y - 1) * bpline;
485 /* Find the byte containing this pixel */ 485 /* Find the byte containing this pixel */
486 i += (x >> 3); 486 i += (x >> 3);
487 /* Which bit is it? */ 487 /* Which bit is it? */
488 bitnum = (unsigned char) (7 - (x & 7)); 488 bitnum = (UChar_Binary) (7 - (x & 7));
489 if (white) /* Turn it on */ 489 if (white) /* Turn it on */
490 bits[i] |= (1 << bitnum); 490 bits[i] |= (1 << bitnum);
491 else /* Turn it off */ 491 else /* Turn it off */
492 bits[i] &= ~(1 << bitnum); 492 bits[i] &= ~(1 << bitnum);
493 } 493 }
496 mswindows_initialize_image_instance_mask (Lisp_Image_Instance* image, 496 mswindows_initialize_image_instance_mask (Lisp_Image_Instance* image,
497 HDC hcdc) 497 HDC hcdc)
498 { 498 {
499 HBITMAP mask; 499 HBITMAP mask;
500 HGDIOBJ old = NULL; 500 HGDIOBJ old = NULL;
501 unsigned char *dibits, *and_bits; 501 UChar_Binary *dibits, *and_bits;
502 BITMAPINFO *bmp_info = 502 BITMAPINFO *bmp_info =
503 (BITMAPINFO*) xmalloc_and_zero (sizeof (BITMAPINFO) + sizeof (RGBQUAD)); 503 (BITMAPINFO*) xmalloc_and_zero (sizeof (BITMAPINFO) + sizeof (RGBQUAD));
504 int i, j; 504 int i, j;
505 int height = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (image); 505 int height = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (image);
506 506
550 bmp_info->bmiHeader.biCompression = BI_RGB; 550 bmp_info->bmiHeader.biCompression = BI_RGB;
551 bmp_info->bmiHeader.biClrUsed = 0; 551 bmp_info->bmiHeader.biClrUsed = 0;
552 bmp_info->bmiHeader.biClrImportant = 0; 552 bmp_info->bmiHeader.biClrImportant = 0;
553 bmp_info->bmiHeader.biSizeImage = height * bpline; 553 bmp_info->bmiHeader.biSizeImage = height * bpline;
554 554
555 dibits = (unsigned char*) xmalloc_and_zero (bpline * height); 555 dibits = (UChar_Binary*) xmalloc_and_zero (bpline * height);
556 if (GetDIBits (hcdc, 556 if (GetDIBits (hcdc,
557 IMAGE_INSTANCE_MSWINDOWS_BITMAP (image), 557 IMAGE_INSTANCE_MSWINDOWS_BITMAP (image),
558 0, 558 0,
559 height, 559 height,
560 dibits, 560 dibits,
569 black in the original */ 569 black in the original */
570 for (i = 0; i < IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (image); i++) 570 for (i = 0; i < IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (image); i++)
571 { 571 {
572 for (j=0; j<height; j++) 572 for (j=0; j<height; j++)
573 { 573 {
574 unsigned char* idx = &dibits[j * bpline + i * 3]; 574 UChar_Binary* idx = &dibits[j * bpline + i * 3];
575 575
576 if (RGB (idx[2], idx[1], idx[0]) == transparent_color) 576 if (RGB (idx[2], idx[1], idx[0]) == transparent_color)
577 { 577 {
578 idx[0] = idx[1] = idx[2] = 0; 578 idx[0] = idx[1] = idx[2] = 0;
579 set_mono_pixel (and_bits, maskbpline, height, i, j, TRUE); 579 set_mono_pixel (and_bits, maskbpline, height, i, j, TRUE);
784 } 784 }
785 return colortbl; 785 return colortbl;
786 } 786 }
787 787
788 static int xpm_to_eimage (Lisp_Object image, const Extbyte *buffer, 788 static int xpm_to_eimage (Lisp_Object image, const Extbyte *buffer,
789 unsigned char** data, 789 UChar_Binary** data,
790 int* width, int* height, 790 int* width, int* height,
791 int* x_hot, int* y_hot, 791 int* x_hot, int* y_hot,
792 int* transp, 792 int* transp,
793 struct color_symbol* color_symbols, 793 struct color_symbol* color_symbols,
794 int nsymbols) 794 int nsymbols)
795 { 795 {
796 XpmImage xpmimage; 796 XpmImage xpmimage;
797 XpmInfo xpminfo; 797 XpmInfo xpminfo;
798 int result, i, j, transp_idx, maskbpline; 798 int result, i, j, transp_idx, maskbpline;
799 unsigned char* dptr; 799 UChar_Binary* dptr;
800 unsigned int* sptr; 800 unsigned int* sptr;
801 COLORREF color; /* the american spelling virus hits again .. */ 801 COLORREF color; /* the american spelling virus hits again .. */
802 COLORREF* colortbl; 802 COLORREF* colortbl;
803 803
804 xzero (xpmimage); 804 xzero (xpmimage);
832 832
833 *width = xpmimage.width; 833 *width = xpmimage.width;
834 *height = xpmimage.height; 834 *height = xpmimage.height;
835 maskbpline = BPLINE ((~7UL & (unsigned long)(*width + 7)) / 8); 835 maskbpline = BPLINE ((~7UL & (unsigned long)(*width + 7)) / 8);
836 836
837 *data = xnew_array_and_zero (unsigned char, *width * *height * 3); 837 *data = xnew_array_and_zero (UChar_Binary, *width * *height * 3);
838 838
839 if (!*data) 839 if (!*data)
840 { 840 {
841 XpmFreeXpmImage (&xpmimage); 841 XpmFreeXpmImage (&xpmimage);
842 XpmFreeXpmInfo (&xpminfo); 842 XpmFreeXpmInfo (&xpminfo);
941 { 941 {
942 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); 942 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
943 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); 943 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
944 const Extbyte *bytes; 944 const Extbyte *bytes;
945 Extcount len; 945 Extcount len;
946 unsigned char *eimage; 946 UChar_Binary *eimage;
947 int width, height, x_hot, y_hot; 947 int width, height, x_hot, y_hot;
948 BITMAPINFO* bmp_info; 948 BITMAPINFO* bmp_info;
949 unsigned char* bmp_data; 949 UChar_Binary* bmp_data;
950 int bmp_bits; 950 int bmp_bits;
951 int nsymbols=0, transp; 951 int nsymbols=0, transp;
952 struct color_symbol* color_symbols=NULL; 952 struct color_symbol* color_symbols=NULL;
953 953
954 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); 954 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
1497 * first and left-most bit first. If it doesn't return BitmapSuccess then 1497 * first and left-most bit first. If it doesn't return BitmapSuccess then
1498 * its arguments won't have been touched. This routine should look as much 1498 * its arguments won't have been touched. This routine should look as much
1499 * like the Xlib routine XReadBitmapfile as possible. 1499 * like the Xlib routine XReadBitmapfile as possible.
1500 */ 1500 */
1501 int read_bitmap_data (FILE* fstream, unsigned int *width, 1501 int read_bitmap_data (FILE* fstream, unsigned int *width,
1502 unsigned int *height, unsigned char **datap, 1502 unsigned int *height, UChar_Binary **datap,
1503 int *x_hot, int *y_hot) 1503 int *x_hot, int *y_hot)
1504 { 1504 {
1505 unsigned char *data = NULL; /* working variable */ 1505 UChar_Binary *data = NULL; /* working variable */
1506 char line[MAX_SIZE]; /* input line from file */ 1506 char line[MAX_SIZE]; /* input line from file */
1507 int size; /* number of bytes of data */ 1507 int size; /* number of bytes of data */
1508 char name_and_type[MAX_SIZE]; /* an input line */ 1508 char name_and_type[MAX_SIZE]; /* an input line */
1509 char *type; /* for parsing */ 1509 char *type; /* for parsing */
1510 int value; /* from an input line */ 1510 int value; /* from an input line */
1575 padding = 0; 1575 padding = 0;
1576 1576
1577 bytes_per_line = (ww+7)/8 + padding; 1577 bytes_per_line = (ww+7)/8 + padding;
1578 1578
1579 size = bytes_per_line * hh; 1579 size = bytes_per_line * hh;
1580 data = (unsigned char *) Xmalloc ((unsigned int) size); 1580 data = (UChar_Binary *) Xmalloc ((unsigned int) size);
1581 if (!data) 1581 if (!data)
1582 RETURN (BitmapNoMemory); 1582 RETURN (BitmapNoMemory);
1583 1583
1584 if (version10p) { 1584 if (version10p) {
1585 unsigned char *ptr; 1585 UChar_Binary *ptr;
1586 int bytes; 1586 int bytes;
1587 1587
1588 for (bytes=0, ptr=data; bytes<size; (bytes += 2)) { 1588 for (bytes=0, ptr=data; bytes<size; (bytes += 2)) {
1589 if ((value = NextInt(fstream)) < 0) 1589 if ((value = NextInt(fstream)) < 0)
1590 RETURN (BitmapFileInvalid); 1590 RETURN (BitmapFileInvalid);
1591 *(ptr++) = value; 1591 *(ptr++) = value;
1592 if (!padding || ((bytes+2) % bytes_per_line)) 1592 if (!padding || ((bytes+2) % bytes_per_line))
1593 *(ptr++) = value >> 8; 1593 *(ptr++) = value >> 8;
1594 } 1594 }
1595 } else { 1595 } else {
1596 unsigned char *ptr; 1596 UChar_Binary *ptr;
1597 int bytes; 1597 int bytes;
1598 1598
1599 for (bytes=0, ptr=data; bytes<size; bytes++, ptr++) { 1599 for (bytes=0, ptr=data; bytes<size; bytes++, ptr++) {
1600 if ((value = NextInt(fstream)) < 0) 1600 if ((value = NextInt(fstream)) < 0)
1601 RETURN (BitmapFileInvalid); 1601 RETURN (BitmapFileInvalid);
1619 RETURN (BitmapSuccess); 1619 RETURN (BitmapSuccess);
1620 } 1620 }
1621 1621
1622 1622
1623 int read_bitmap_data_from_file (const char *filename, unsigned int *width, 1623 int read_bitmap_data_from_file (const char *filename, unsigned int *width,
1624 unsigned int *height, unsigned char **datap, 1624 unsigned int *height, UChar_Binary **datap,
1625 int *x_hot, int *y_hot) 1625 int *x_hot, int *y_hot)
1626 { 1626 {
1627 FILE *fstream; 1627 FILE *fstream;
1628 int status; 1628 int status;
1629 1629
1648 black. It must be converted to the following format: Widths are 1648 black. It must be converted to the following format: Widths are
1649 padded to a multiple of 16. Scan lines are stored in increasing 1649 padded to a multiple of 16. Scan lines are stored in increasing
1650 byte order from left to right, big-endian within a byte. 0 = 1650 byte order from left to right, big-endian within a byte. 0 =
1651 black, 1 = white. */ 1651 black, 1 = white. */
1652 static HBITMAP 1652 static HBITMAP
1653 xbm_create_bitmap_from_data (HDC hdc, char *data, 1653 xbm_create_bitmap_from_data (HDC hdc, const UChar_Binary *data,
1654 unsigned int width, unsigned int height, 1654 unsigned int width, unsigned int height,
1655 int mask, COLORREF fg, COLORREF bg) 1655 int mask, COLORREF fg, COLORREF bg)
1656 { 1656 {
1657 int old_width = (width + 7)/8; 1657 int old_width = (width + 7)/8;
1658 int new_width = BPLINE (2*((width + 15)/16)); 1658 int new_width = BPLINE (2*((width + 15)/16));
1659 unsigned char *offset; 1659 const UChar_Binary *offset;
1660 void *bmp_buf = 0; 1660 void *bmp_buf = 0;
1661 unsigned char *new_data, *new_offset; 1661 UChar_Binary *new_data, *new_offset;
1662 int i, j; 1662 int i, j;
1663 BITMAPINFO *bmp_info = 1663 BITMAPINFO *bmp_info =
1664 (BITMAPINFO*) xmalloc_and_zero (sizeof(BITMAPINFO) + sizeof(RGBQUAD)); 1664 (BITMAPINFO*) xmalloc_and_zero (sizeof(BITMAPINFO) + sizeof(RGBQUAD));
1665 HBITMAP bitmap; 1665 HBITMAP bitmap;
1666 1666
1667 if (!bmp_info) 1667 if (!bmp_info)
1668 return NULL; 1668 return NULL;
1669 1669
1670 new_data = (unsigned char *) xmalloc_and_zero (height * new_width); 1670 new_data = (UChar_Binary *) xmalloc_and_zero (height * new_width);
1671 1671
1672 if (!new_data) 1672 if (!new_data)
1673 { 1673 {
1674 xfree (bmp_info); 1674 xfree (bmp_info);
1675 return NULL; 1675 return NULL;
1681 new_offset = new_data + i*new_width; 1681 new_offset = new_data + i*new_width;
1682 1682
1683 for (j=0; j<old_width; j++) 1683 for (j=0; j<old_width; j++)
1684 { 1684 {
1685 int byte = offset[j]; 1685 int byte = offset[j];
1686 new_offset[j] = ~ (unsigned char) 1686 new_offset[j] = ~ (UChar_Binary)
1687 ((flip_table[byte & 0xf] << 4) + flip_table[byte >> 4]); 1687 ((flip_table[byte & 0xf] << 4) + flip_table[byte >> 4]);
1688 } 1688 }
1689 } 1689 }
1690 1690
1691 /* if we want a mask invert the bits */ 1691 /* if we want a mask invert the bits */
1741 image instance accordingly. */ 1741 image instance accordingly. */
1742 1742
1743 static void 1743 static void
1744 init_image_instance_from_xbm_inline (Lisp_Image_Instance *ii, 1744 init_image_instance_from_xbm_inline (Lisp_Image_Instance *ii,
1745 int width, int height, 1745 int width, int height,
1746 /* Note that data is in ext-format! */ 1746 const UChar_Binary *bits,
1747 const char *bits,
1748 Lisp_Object instantiator, 1747 Lisp_Object instantiator,
1749 Lisp_Object pointer_fg, 1748 Lisp_Object pointer_fg,
1750 Lisp_Object pointer_bg, 1749 Lisp_Object pointer_bg,
1751 int dest_mask, 1750 int dest_mask,
1752 HBITMAP mask, 1751 HBITMAP mask,
1793 XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii), 0); 1792 XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii), 0);
1794 XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii), 0); 1793 XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii), 0);
1795 init_image_instance_geometry (ii); 1794 init_image_instance_geometry (ii);
1796 1795
1797 IMAGE_INSTANCE_MSWINDOWS_MASK (ii) = mask ? mask : 1796 IMAGE_INSTANCE_MSWINDOWS_MASK (ii) = mask ? mask :
1798 xbm_create_bitmap_from_data (hdc, (Extbyte *) bits, width, height, 1797 xbm_create_bitmap_from_data (hdc, bits, width, height, TRUE, black, white);
1799 TRUE, black, white);
1800 1798
1801 switch (type) 1799 switch (type)
1802 { 1800 {
1803 case IMAGE_MONO_PIXMAP: 1801 case IMAGE_MONO_PIXMAP:
1804 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = 1802 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) =
1805 xbm_create_bitmap_from_data (hdc, (Extbyte *) bits, width, height, 1803 xbm_create_bitmap_from_data (hdc, bits, width, height,
1806 FALSE, black, black); 1804 FALSE, black, black);
1807 break; 1805 break;
1808 1806
1809 case IMAGE_COLOR_PIXMAP: 1807 case IMAGE_COLOR_PIXMAP:
1810 { 1808 {
1829 1827
1830 IMAGE_INSTANCE_PIXMAP_FG (ii) = foreground; 1828 IMAGE_INSTANCE_PIXMAP_FG (ii) = foreground;
1831 IMAGE_INSTANCE_PIXMAP_BG (ii) = background; 1829 IMAGE_INSTANCE_PIXMAP_BG (ii) = background;
1832 1830
1833 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = 1831 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) =
1834 xbm_create_bitmap_from_data (hdc, (Extbyte *) bits, width, height, 1832 xbm_create_bitmap_from_data (hdc, bits, width, height,
1835 FALSE, fg, black); 1833 FALSE, fg, black);
1836 } 1834 }
1837 break; 1835 break;
1838 1836
1839 case IMAGE_POINTER: 1837 case IMAGE_POINTER:
1856 fg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (foreground)); 1854 fg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (foreground));
1857 if (COLOR_INSTANCEP (background)) 1855 if (COLOR_INSTANCEP (background))
1858 bg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (background)); 1856 bg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (background));
1859 1857
1860 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = 1858 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) =
1861 xbm_create_bitmap_from_data (hdc, (Extbyte *) bits, width, height, 1859 xbm_create_bitmap_from_data (hdc, bits, width, height,
1862 TRUE, fg, black); 1860 TRUE, fg, black);
1863 mswindows_initialize_image_instance_icon (ii, TRUE); 1861 mswindows_initialize_image_instance_icon (ii, TRUE);
1864 } 1862 }
1865 break; 1863 break;
1866 1864
1871 1869
1872 static void 1870 static void
1873 xbm_instantiate_1 (Lisp_Object image_instance, Lisp_Object instantiator, 1871 xbm_instantiate_1 (Lisp_Object image_instance, Lisp_Object instantiator,
1874 Lisp_Object pointer_fg, Lisp_Object pointer_bg, 1872 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
1875 int dest_mask, int width, int height, 1873 int dest_mask, int width, int height,
1876 /* Note that data is in ext-format! */ 1874 const UChar_Binary *bits)
1877 const char *bits)
1878 { 1875 {
1879 Lisp_Object mask_data = find_keyword_in_vector (instantiator, Q_mask_data); 1876 Lisp_Object mask_data = find_keyword_in_vector (instantiator, Q_mask_data);
1880 Lisp_Object mask_file = find_keyword_in_vector (instantiator, Q_mask_file); 1877 Lisp_Object mask_file = find_keyword_in_vector (instantiator, Q_mask_file);
1881 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); 1878 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
1882 HDC hdc = get_device_compdc (XDEVICE (IMAGE_INSTANCE_DEVICE (ii))); 1879 HDC hdc = get_device_compdc (XDEVICE (IMAGE_INSTANCE_DEVICE (ii)));
1883 HBITMAP mask = 0; 1880 HBITMAP mask = 0;
1884 1881
1885 if (!NILP (mask_data)) 1882 if (!NILP (mask_data))
1886 { 1883 {
1887 const char *ext_data; 1884 UChar_Binary *ext_data;
1888 1885
1889 TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (mask_data))), 1886 TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (mask_data))),
1890 C_STRING_ALLOCA, ext_data, 1887 C_STRING_ALLOCA, ext_data,
1891 Qbinary); 1888 Qbinary);
1892 mask = xbm_create_bitmap_from_data (hdc, 1889 mask = xbm_create_bitmap_from_data (hdc,
1893 (unsigned char *) ext_data, 1890 ext_data,
1894 XINT (XCAR (mask_data)), 1891 XINT (XCAR (mask_data)),
1895 XINT (XCAR (XCDR (mask_data))), 1892 XINT (XCAR (XCDR (mask_data))),
1896 FALSE, 1893 FALSE,
1897 PALETTERGB (0,0,0), 1894 PALETTERGB (0,0,0),
1898 PALETTERGB (255,255,255)); 1895 PALETTERGB (255,255,255));
1910 Lisp_Object instantiator, 1907 Lisp_Object instantiator,
1911 Lisp_Object pointer_fg, Lisp_Object pointer_bg, 1908 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
1912 int dest_mask, Lisp_Object domain) 1909 int dest_mask, Lisp_Object domain)
1913 { 1910 {
1914 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); 1911 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
1915 const char *ext_data; 1912 const UChar_Binary *ext_data;
1916 1913
1917 assert (!NILP (data)); 1914 assert (!NILP (data));
1918 1915
1919 TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (data))), 1916 TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (data))),
1920 C_STRING_ALLOCA, ext_data, 1917 C_STRING_ALLOCA, ext_data,
1955 Lisp_Object pointer_fg, Lisp_Object pointer_bg, 1952 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
1956 int dest_mask, Lisp_Object domain) 1953 int dest_mask, Lisp_Object domain)
1957 { 1954 {
1958 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); 1955 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
1959 int i, stattis; 1956 int i, stattis;
1960 char *p, *bits, *bp; 1957 UChar_Binary *p, *bits, *bp;
1961 const char * volatile emsg = 0; 1958 const CBufbyte * volatile emsg = 0;
1962 const char * volatile dstring; 1959 const UChar_Binary * volatile dstring;
1963 1960
1964 assert (!NILP (data)); 1961 assert (!NILP (data));
1965 1962
1966 TO_EXTERNAL_FORMAT (LISP_STRING, data, 1963 TO_EXTERNAL_FORMAT (LISP_STRING, data,
1967 C_STRING_ALLOCA, dstring, 1964 C_STRING_ALLOCA, dstring,
1968 Qbinary); 1965 Qbinary);
1969 1966
1970 if ((p = strchr (dstring, ':'))) 1967 if ((p = (UChar_Binary *) strchr ((char *) dstring, ':')))
1971 { 1968 {
1972 dstring = p + 1; 1969 dstring = p + 1;
1973 } 1970 }
1974 1971
1975 /* Must use setjmp not SETJMP because we used jmp_buf above not JMP_BUF */ 1972 /* Must use setjmp not SETJMP because we used jmp_buf above not JMP_BUF */
1993 } 1990 }
1994 1991
1995 if (emsg) 1992 if (emsg)
1996 signal_image_error_2 (emsg, data, Qimage); 1993 signal_image_error_2 (emsg, data, Qimage);
1997 1994
1998 bp = bits = (char *) alloca (PIXELS / 8); 1995 bp = bits = (UChar_Binary *) alloca (PIXELS / 8);
1999 1996
2000 /* the compface library exports char F[], which uses a single byte per 1997 /* the compface library exports char F[], which uses a single byte per
2001 pixel to represent a 48x48 bitmap. Yuck. */ 1998 pixel to represent a 48x48 bitmap. Yuck. */
2002 for (i = 0, p = F; i < (PIXELS / 8); ++i) 1999 for (i = 0, p = F; i < (PIXELS / 8); ++i)
2003 { 2000 {
2005 /* reverse the bit order of each byte... */ 2002 /* reverse the bit order of each byte... */
2006 for (b = n = 0; b < 8; ++b) 2003 for (b = n = 0; b < 8; ++b)
2007 { 2004 {
2008 n |= ((*p++) << b); 2005 n |= ((*p++) << b);
2009 } 2006 }
2010 *bp++ = (char) n; 2007 *bp++ = (UChar_Binary) n;
2011 } 2008 }
2012 2009
2013 xbm_instantiate_1 (image_instance, instantiator, pointer_fg, 2010 xbm_instantiate_1 (image_instance, instantiator, pointer_fg,
2014 pointer_bg, dest_mask, 48, 48, bits); 2011 pointer_bg, dest_mask, 48, 48, bits);
2015 } 2012 }