comparison src/glyphs-x.c @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents e121b013d1f0
children 169c0442b401
comparison
equal deleted inserted replaced
184:bcd2674570bf 185:3d6bfa290dbd
27 /* Original author: Jamie Zawinski for 19.8 27 /* Original author: Jamie Zawinski for 19.8
28 font-truename stuff added by Jamie Zawinski for 19.10 28 font-truename stuff added by Jamie Zawinski for 19.10
29 subwindow support added by Chuck Thompson 29 subwindow support added by Chuck Thompson
30 additional XPM support added by Chuck Thompson 30 additional XPM support added by Chuck Thompson
31 initial X-Face support added by Stig 31 initial X-Face support added by Stig
32 rewritten/restructured by Ben Wing for 19.12/19.13 32 rewritten/restructured by Ben Wing for 19.12/19.13
33 GIF/JPEG support added by Ben Wing for 19.14 33 GIF/JPEG support added by Ben Wing for 19.14
34 PNG support added by Bill Perry for 19.14 34 PNG support added by Bill Perry for 19.14
35 Improved GIF/JPEG support added by Bill Perry for 19.14 35 Improved GIF/JPEG support added by Bill Perry for 19.14
36 Cleanup/simplification of error handling by Ben Wing for 19.14 36 Cleanup/simplification of error handling by Ben Wing for 19.14
37 Pointer/icon overhaul, more restructuring by Ben Wing for 19.14 37 Pointer/icon overhaul, more restructuring by Ben Wing for 19.14
56 #include "opaque.h" 56 #include "opaque.h"
57 57
58 #include "sysfile.h" 58 #include "sysfile.h"
59 59
60 #ifdef HAVE_PNG 60 #ifdef HAVE_PNG
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
61 #include <png.h> 64 #include <png.h>
65 #ifdef __cplusplus
66 }
67 #endif
62 #else 68 #else
63 #include <setjmp.h> 69 #include <setjmp.h>
64 #endif 70 #endif
65 71
66 #define LISP_DEVICE_TO_X_SCREEN(dev) \ 72 #define LISP_DEVICE_TO_X_SCREEN(dev) \
247 253
248 static void 254 static void
249 x_initialize_pixmap_image_instance (struct Lisp_Image_Instance *ii, 255 x_initialize_pixmap_image_instance (struct Lisp_Image_Instance *ii,
250 enum image_instance_type type) 256 enum image_instance_type type)
251 { 257 {
252 ii->data = malloc_type_and_zero (struct x_image_instance_data); 258 ii->data = xnew_and_zero (struct x_image_instance_data);
253 IMAGE_INSTANCE_TYPE (ii) = type; 259 IMAGE_INSTANCE_TYPE (ii) = type;
254 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) = Qnil; 260 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) = Qnil;
255 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (ii) = Qnil; 261 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (ii) = Qnil;
256 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = Qnil; 262 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = Qnil;
257 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = Qnil; 263 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = Qnil;
368 { 374 {
369 Lisp_Object file; 375 Lisp_Object file;
370 Lisp_Object data; 376 Lisp_Object data;
371 377
372 assert (VECTORP (instantiator)); 378 assert (VECTORP (instantiator));
373 379
374 data = find_keyword_in_vector (instantiator, data_keyword); 380 data = find_keyword_in_vector (instantiator, data_keyword);
375 file = find_keyword_in_vector (instantiator, file_keyword); 381 file = find_keyword_in_vector (instantiator, file_keyword);
376 382
377 if (!NILP (file) && NILP (data)) 383 if (!NILP (file) && NILP (data))
378 { 384 {
393 { 399 {
394 /* This function can call lisp */ 400 /* This function can call lisp */
395 Lisp_Object file = Qnil; 401 Lisp_Object file = Qnil;
396 struct gcpro gcpro1, gcpro2; 402 struct gcpro gcpro1, gcpro2;
397 Lisp_Object alist = Qnil; 403 Lisp_Object alist = Qnil;
398 404
399 GCPRO2 (file, alist); 405 GCPRO2 (file, alist);
400 406
401 /* Now, convert any file data into inline data. At the end of this, 407 /* Now, convert any file data into inline data. At the end of this,
402 `data' will contain the inline data (if any) or Qnil, and `file' 408 `data' will contain the inline data (if any) or Qnil, and `file'
403 will contain the name this data was derived from (if known) or 409 will contain the name this data was derived from (if known) or
437 write_lisp_string_to_temp_file (Lisp_Object string, char *filename_out) 443 write_lisp_string_to_temp_file (Lisp_Object string, char *filename_out)
438 { 444 {
439 Extbyte *bytes; 445 Extbyte *bytes;
440 Extcount len; 446 Extcount len;
441 FILE *stream; 447 FILE *stream;
442 448
443 /* #### This is a definite problem under Mule due to the amount of 449 /* #### This is a definite problem under Mule due to the amount of
444 stack data it might allocate. Need to be able to convert and 450 stack data it might allocate. Need to be able to convert and
445 write out to a file. */ 451 write out to a file. */
446 GET_STRING_BINARY_DATA_ALLOCA (string, bytes, len); 452 GET_STRING_BINARY_DATA_ALLOCA (string, bytes, len);
447 453
514 else 520 else
515 { 521 {
516 xfg->pixel = 0; 522 xfg->pixel = 0;
517 xfg->red = xfg->green = xfg->blue = 0; 523 xfg->red = xfg->green = xfg->blue = 0;
518 } 524 }
519 525
520 if (!NILP (*background) && !COLOR_INSTANCEP (*background)) 526 if (!NILP (*background) && !COLOR_INSTANCEP (*background))
521 *background = 527 *background =
522 Fmake_color_instance (*background, device, 528 Fmake_color_instance (*background, device,
523 encode_error_behavior_flag (ERROR_ME)); 529 encode_error_behavior_flag (ERROR_ME));
524 if (COLOR_INSTANCEP (*background)) 530 if (COLOR_INSTANCEP (*background))
596 d = RootWindowOfScreen (xs); 602 d = RootWindowOfScreen (xs);
597 603
598 if (!(dest_mask & IMAGE_COLOR_PIXMAP_MASK)) 604 if (!(dest_mask & IMAGE_COLOR_PIXMAP_MASK))
599 incompatible_image_types (instantiator, dest_mask, 605 incompatible_image_types (instantiator, dest_mask,
600 IMAGE_COLOR_PIXMAP_MASK); 606 IMAGE_COLOR_PIXMAP_MASK);
601 607
602 pixmap = XCreatePixmap (dpy, d, ximage->width, 608 pixmap = XCreatePixmap (dpy, d, ximage->width,
603 ximage->height, ximage->depth); 609 ximage->height, ximage->depth);
604 if (!pixmap) 610 if (!pixmap)
605 signal_simple_error ("Unable to create pixmap", instantiator); 611 signal_simple_error ("Unable to create pixmap", instantiator);
606 612
608 if (!gc) 614 if (!gc)
609 { 615 {
610 XFreePixmap (dpy, pixmap); 616 XFreePixmap (dpy, pixmap);
611 signal_simple_error ("Unable to create GC", instantiator); 617 signal_simple_error ("Unable to create GC", instantiator);
612 } 618 }
613 619
614 XPutImage (dpy, pixmap, gc, ximage, 0, 0, 0, 0, 620 XPutImage (dpy, pixmap, gc, ximage, 0, 0, 0, 0,
615 ximage->width, ximage->height); 621 ximage->width, ximage->height);
616 622
617 XFreeGC (dpy, gc); 623 XFreeGC (dpy, gc);
618 624
619 x_initialize_pixmap_image_instance (ii, IMAGE_COLOR_PIXMAP); 625 x_initialize_pixmap_image_instance (ii, IMAGE_COLOR_PIXMAP);
620 626
621 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) = 627 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) =
622 find_keyword_in_vector (instantiator, Q_file); 628 find_keyword_in_vector (instantiator, Q_file);
623 629
624 IMAGE_INSTANCE_X_PIXMAP (ii) = pixmap; 630 IMAGE_INSTANCE_X_PIXMAP (ii) = pixmap;
625 IMAGE_INSTANCE_X_MASK (ii) = 0; 631 IMAGE_INSTANCE_X_MASK (ii) = 0;
626 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = ximage->width; 632 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = ximage->width;
627 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = ximage->height; 633 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = ximage->height;
628 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = ximage->depth; 634 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = ximage->depth;
686 692
687 -- if OK_IF_DATA_INVALID is set and the data was invalid, 693 -- if OK_IF_DATA_INVALID is set and the data was invalid,
688 return Qt. 694 return Qt.
689 -- maybe return an error, or return Qnil. 695 -- maybe return an error, or return Qnil.
690 */ 696 */
691 697
692 698
693 static Lisp_Object 699 static Lisp_Object
694 bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot, 700 bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot,
695 int ok_if_data_invalid) 701 int ok_if_data_invalid)
696 { 702 {
785 xbm_normalize (Lisp_Object inst, Lisp_Object console_type) 791 xbm_normalize (Lisp_Object inst, Lisp_Object console_type)
786 { 792 {
787 Lisp_Object file = Qnil, mask_file = Qnil; 793 Lisp_Object file = Qnil, mask_file = Qnil;
788 struct gcpro gcpro1, gcpro2, gcpro3; 794 struct gcpro gcpro1, gcpro2, gcpro3;
789 Lisp_Object alist = Qnil; 795 Lisp_Object alist = Qnil;
790 796
791 GCPRO3 (file, mask_file, alist); 797 GCPRO3 (file, mask_file, alist);
792 798
793 /* Now, convert any file data into inline data for both the regular 799 /* Now, convert any file data into inline data for both the regular
794 data and the mask data. At the end of this, `data' will contain 800 data and the mask data. At the end of this, `data' will contain
795 the inline data (if any) or Qnil, and `file' will contain 801 the inline data (if any) or Qnil, and `file' will contain
1058 1064
1059 /********************************************************************** 1065 /**********************************************************************
1060 * JPEG * 1066 * JPEG *
1061 **********************************************************************/ 1067 **********************************************************************/
1062 1068
1069 #ifdef __cplusplus
1070 extern "C" {
1071 #endif
1063 #include <jpeglib.h> 1072 #include <jpeglib.h>
1064 #include <jerror.h> 1073 #include <jerror.h>
1074 #ifdef __cplusplus
1075 }
1076 #endif
1065 1077
1066 /* The in-core jpeg code doesn't work, so I'm avoiding it for now. -sb */ 1078 /* The in-core jpeg code doesn't work, so I'm avoiding it for now. -sb */
1067 /* Late-breaking update, we're going to give it a try, I think it's */ 1079 /* Late-breaking update, we're going to give it a try, I think it's */
1068 /* fixed now -sb */ 1080 /* fixed now -sb */
1069 /*#define USE_TEMP_FILES_FOR_JPEG_IMAGES 1*/ 1081 /*#define USE_TEMP_FILES_FOR_JPEG_IMAGES 1*/
1235 1247
1236 static void 1248 static void
1237 jpeg_memory_src (j_decompress_ptr cinfo, JOCTET *data, unsigned int len) 1249 jpeg_memory_src (j_decompress_ptr cinfo, JOCTET *data, unsigned int len)
1238 { 1250 {
1239 struct jpeg_source_mgr *src = NULL; 1251 struct jpeg_source_mgr *src = NULL;
1240 1252
1241 if (cinfo->src == NULL) { /* first time for this JPEG object? */ 1253 if (cinfo->src == NULL) { /* first time for this JPEG object? */
1242 cinfo->src = (struct jpeg_source_mgr *) 1254 cinfo->src = (struct jpeg_source_mgr *)
1243 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, 1255 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
1244 sizeof(our_jpeg_source_mgr)); 1256 sizeof(our_jpeg_source_mgr));
1245 src = (struct jpeg_source_mgr *) cinfo->src; 1257 src = (struct jpeg_source_mgr *) cinfo->src;
1330 if ((unwind.instream = fopen (unwind.tempfile, "r")) == NULL) 1342 if ((unwind.instream = fopen (unwind.tempfile, "r")) == NULL)
1331 report_file_error ("Opening JPEG temp file", 1343 report_file_error ("Opening JPEG temp file",
1332 list1 (build_string (unwind.tempfile))); 1344 list1 (build_string (unwind.tempfile)));
1333 } 1345 }
1334 #endif 1346 #endif
1335 1347
1336 /* Step 1: allocate and initialize JPEG decompression object */ 1348 /* Step 1: allocate and initialize JPEG decompression object */
1337 1349
1338 /* We set up the normal JPEG error routines, then override error_exit. */ 1350 /* We set up the normal JPEG error routines, then override error_exit. */
1339 cinfo.err = jpeg_std_error (&jerr.pub); 1351 cinfo.err = jpeg_std_error (&jerr.pub);
1340 jerr.pub.error_exit = my_jpeg_error_exit; 1352 jerr.pub.error_exit = my_jpeg_error_exit;
1347 */ 1359 */
1348 1360
1349 { 1361 {
1350 Lisp_Object errstring; 1362 Lisp_Object errstring;
1351 char buffer[JMSG_LENGTH_MAX]; 1363 char buffer[JMSG_LENGTH_MAX];
1352 1364
1353 /* Create the message */ 1365 /* Create the message */
1354 (*cinfo.err->format_message) ((j_common_ptr) &cinfo, buffer); 1366 (*cinfo.err->format_message) ((j_common_ptr) &cinfo, buffer);
1355 errstring = build_string (buffer); 1367 errstring = build_string (buffer);
1356 1368
1357 signal_simple_error_2 ("JPEG decoding error", 1369 signal_simple_error_2 ("JPEG decoding error",
1358 errstring, instantiator); 1370 errstring, instantiator);
1359 } 1371 }
1360 } 1372 }
1361 1373
1370 #else 1382 #else
1371 { 1383 {
1372 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); 1384 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
1373 Extbyte *bytes; 1385 Extbyte *bytes;
1374 Extcount len; 1386 Extcount len;
1375 1387
1376 /* #### This is a definite problem under Mule due to the amount of 1388 /* #### This is a definite problem under Mule due to the amount of
1377 stack data it might allocate. Need to be able to convert and 1389 stack data it might allocate. Need to be able to convert and
1378 write out to a file. */ 1390 write out to a file. */
1379 GET_STRING_BINARY_DATA_ALLOCA (data, bytes, len); 1391 GET_STRING_BINARY_DATA_ALLOCA (data, bytes, len);
1380 jpeg_memory_src (&cinfo, bytes, len); 1392 jpeg_memory_src (&cinfo, bytes, len);
1429 { 1441 {
1430 int i; 1442 int i;
1431 1443
1432 /* Just in case the image contains out-of-range pixels, we go 1444 /* Just in case the image contains out-of-range pixels, we go
1433 ahead and allocate space for all of them. */ 1445 ahead and allocate space for all of them. */
1434 unwind.pixels = (unsigned long *) xmalloc (256 * sizeof (unsigned long)); 1446 unwind.pixels = xnew_array (unsigned long, 256);
1435 unwind.npixels = cinfo.actual_number_of_colors; 1447 unwind.npixels = cinfo.actual_number_of_colors;
1436 1448
1437 for (i = 0; i < 256; i++) 1449 for (i = 0; i < 256; i++)
1438 unwind.pixels[i] = 0; /* Use a reasonable color for out of range. */ 1450 unwind.pixels[i] = 0; /* Use a reasonable color for out of range. */
1439 1451
1464 { 1476 {
1465 int height = cinfo.output_height; 1477 int height = cinfo.output_height;
1466 int width = cinfo.output_width; 1478 int width = cinfo.output_width;
1467 int depth; 1479 int depth;
1468 int bitmap_pad; 1480 int bitmap_pad;
1469 1481
1470 depth = DefaultDepthOfScreen (scr); 1482 depth = DefaultDepthOfScreen (scr);
1471 1483
1472 /* first get bitmap_pad (from XPM) */ 1484 /* first get bitmap_pad (from XPM) */
1473 if (depth > 16) 1485 bitmap_pad = ((depth > 16) ? 32 :
1474 bitmap_pad = 32; 1486 (depth > 8) ? 16 :
1475 else if (depth > 8) 1487 8);
1476 bitmap_pad = 16; 1488
1477 else
1478 bitmap_pad = 8;
1479
1480 unwind.ximage = XCreateImage (dpy, DefaultVisualOfScreen (scr), 1489 unwind.ximage = XCreateImage (dpy, DefaultVisualOfScreen (scr),
1481 depth, ZPixmap, 0, 0, width, height, 1490 depth, ZPixmap, 0, 0, width, height,
1482 bitmap_pad, 0); 1491 bitmap_pad, 0);
1483 1492
1484 if (!unwind.ximage) 1493 if (!unwind.ximage)
1497 /* We may need to do some setup of our own at this point before reading 1506 /* We may need to do some setup of our own at this point before reading
1498 * the data. After jpeg_start_decompress() we have the correct scaled 1507 * the data. After jpeg_start_decompress() we have the correct scaled
1499 * output image dimensions available, as well as the output colormap 1508 * output image dimensions available, as well as the output colormap
1500 * if we asked for color quantization. 1509 * if we asked for color quantization.
1501 * In this example, we need to make an output work buffer of the right size. 1510 * In this example, we need to make an output work buffer of the right size.
1502 */ 1511 */
1503 /* JSAMPLEs per row in output buffer. 1512 /* JSAMPLEs per row in output buffer.
1504 Since we asked for quantized output, cinfo.output_components 1513 Since we asked for quantized output, cinfo.output_components
1505 will always be 1. */ 1514 will always be 1. */
1506 row_stride = cinfo.output_width * cinfo.output_components; 1515 row_stride = cinfo.output_width * cinfo.output_components;
1507 /* Make a one-row-high sample array that will go away when done 1516 /* Make a one-row-high sample array that will go away when done
1508 with image */ 1517 with image */
1509 row_buffer = ((*cinfo.mem->alloc_sarray) 1518 row_buffer = ((*cinfo.mem->alloc_sarray)
1510 ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1)); 1519 ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1));
1511 1520
1512 /* Here we use the library's state variable cinfo.output_scanline as the 1521 /* Here we use the library's state variable cinfo.output_scanline as the
1513 * loop counter, so that we don't have to keep track ourselves. 1522 * loop counter, so that we don't have to keep track ourselves.
1514 */ 1523 */
1515 while (cinfo.output_scanline < cinfo.output_height) 1524 while (cinfo.output_scanline < cinfo.output_height)
1516 { 1525 {
1660 static int InterlacedJumps[] = { 8, 8, 4, 2 }; 1669 static int InterlacedJumps[] = { 8, 8, 4, 2 };
1661 1670
1662 GifPixelType *ScreenBuffer = 1671 GifPixelType *ScreenBuffer =
1663 (GifPixelType *) xmalloc (GifFile->SHeight * GifFile->SWidth * 1672 (GifPixelType *) xmalloc (GifFile->SHeight * GifFile->SWidth *
1664 sizeof (GifPixelType)); 1673 sizeof (GifPixelType));
1665 GifFile->SavedImages = (SavedImage *) xmalloc (sizeof(SavedImage)); 1674 GifFile->SavedImages = xnew (SavedImage);
1666 1675
1667 for (i = 0; i < GifFile->SHeight * GifFile->SWidth; i++) 1676 for (i = 0; i < GifFile->SHeight * GifFile->SWidth; i++)
1668 ScreenBuffer[i] = GifFile->SBackGroundColor; 1677 ScreenBuffer[i] = GifFile->SBackGroundColor;
1669 1678
1670 /* Scan the content of the GIF file and load the image(s) in: */ 1679 /* Scan the content of the GIF file and load the image(s) in: */
1688 GifFile->Image.Top + GifFile->Image.Height > GifFile->SHeight) 1697 GifFile->Image.Top + GifFile->Image.Height > GifFile->SHeight)
1689 return -1; 1698 return -1;
1690 1699
1691 sp->RasterBits = (GifPixelType*) xmalloc(Width * Height * 1700 sp->RasterBits = (GifPixelType*) xmalloc(Width * Height *
1692 sizeof (GifPixelType)); 1701 sizeof (GifPixelType));
1693 1702
1694 if (GifFile->Image.Interlace) 1703 if (GifFile->Image.Interlace)
1695 { 1704 {
1696 /* Need to perform 4 passes on the images: */ 1705 /* Need to perform 4 passes on the images: */
1697 for (Count = i = 0; i < 4; i++) 1706 for (Count = i = 0; i < 4; i++)
1698 for (j = Row + InterlacedOffset[i]; j < Row + Height; 1707 for (j = Row + InterlacedOffset[i]; j < Row + Height;
1798 } 1807 }
1799 #if 0 1808 #if 0
1800 if (our_own_dgif_slurp_from_gif2x11_c(unwind.giffile) != GIF_OK) 1809 if (our_own_dgif_slurp_from_gif2x11_c(unwind.giffile) != GIF_OK)
1801 #else 1810 #else
1802 /* DGifSlurp() doesn't handle interlaced files. */ 1811 /* DGifSlurp() doesn't handle interlaced files. */
1803 /* Actually, it does, sort of. It just sets the Interlace flag 1812 /* Actually, it does, sort of. It just sets the Interlace flag
1804 and stores RasterBits in interlaced order. We handle that below. */ 1813 and stores RasterBits in interlaced order. We handle that below. */
1805 if (DGifSlurp (unwind.giffile) != GIF_OK) 1814 if (DGifSlurp (unwind.giffile) != GIF_OK)
1806 #endif 1815 #endif
1807 goto gif_decode_error; 1816 goto gif_decode_error;
1808 } 1817 }
1811 { 1820 {
1812 int i; 1821 int i;
1813 ColorMapObject *cmap = unwind.giffile->SColorMap; 1822 ColorMapObject *cmap = unwind.giffile->SColorMap;
1814 /* Just in case the image contains out-of-range pixels, we go 1823 /* Just in case the image contains out-of-range pixels, we go
1815 ahead and allocate space for all of them. */ 1824 ahead and allocate space for all of them. */
1816 unwind.pixels = (unsigned long *) xmalloc (256 * sizeof (unsigned long)); 1825 unwind.pixels = xnew_array (unsigned long, 256);
1817 unwind.npixels = cmap->ColorCount; 1826 unwind.npixels = cmap->ColorCount;
1818 1827
1819 for (i = 0; i < 256; i++) 1828 for (i = 0; i < 256; i++)
1820 unwind.pixels[i] = 0; /* Use a reasonable color for out of range. */ 1829 unwind.pixels[i] = 0; /* Use a reasonable color for out of range. */
1821 1830
1844 /* interlaced gifs have rows in this order: 1853 /* interlaced gifs have rows in this order:
1845 0, 8, 16, ..., 4, 12, 20, ..., 2, 6, 10, ..., 1, 3, 5, ... */ 1854 0, 8, 16, ..., 4, 12, 20, ..., 2, 6, 10, ..., 1, 3, 5, ... */
1846 static int InterlacedOffset[] = { 0, 4, 2, 1 }; 1855 static int InterlacedOffset[] = { 0, 4, 2, 1 };
1847 static int InterlacedJumps[] = { 8, 8, 4, 2 }; 1856 static int InterlacedJumps[] = { 8, 8, 4, 2 };
1848 1857
1849 1858
1850 depth = DefaultDepthOfScreen (scr); 1859 depth = DefaultDepthOfScreen (scr);
1851 1860
1852 /* first get bitmap_pad (from XPM) */ 1861 /* first get bitmap_pad (from XPM) */
1853 if (depth > 16) 1862 bitmap_pad = ((depth > 16) ? 32 :
1854 bitmap_pad = 32; 1863 (depth > 8) ? 16 :
1855 else if (depth > 8) 1864 8);
1856 bitmap_pad = 16; 1865
1857 else
1858 bitmap_pad = 8;
1859
1860 unwind.ximage = XCreateImage (dpy, DefaultVisualOfScreen (scr), 1866 unwind.ximage = XCreateImage (dpy, DefaultVisualOfScreen (scr),
1861 depth, ZPixmap, 0, 0, width, height, 1867 depth, ZPixmap, 0, 0, width, height,
1862 bitmap_pad, 0); 1868 bitmap_pad, 0);
1863 1869
1864 if (!unwind.ximage) 1870 if (!unwind.ximage)
1875 stuff; but it's doubtful that this will be faster in the 1881 stuff; but it's doubtful that this will be faster in the
1876 long run, what with all the XPM overhead. If this proves 1882 long run, what with all the XPM overhead. If this proves
1877 to be a bottleneck here, maybe we should just copy the 1883 to be a bottleneck here, maybe we should just copy the
1878 optimization routines from XPM (they're in turn mostly 1884 optimization routines from XPM (they're in turn mostly
1879 copied from the Xlib source code). */ 1885 copied from the Xlib source code). */
1880 1886
1881 /* Note: We just use the first image in the file and ignore the rest. 1887 /* Note: We just use the first image in the file and ignore the rest.
1882 We check here that that image covers the full "screen" size. 1888 We check here that that image covers the full "screen" size.
1883 I don't know whether that's always the case. 1889 I don't know whether that's always the case.
1884 -dkindred@cs.cmu.edu */ 1890 -dkindred@cs.cmu.edu */
1885 if (unwind.giffile->SavedImages[0].ImageDesc.Height != height 1891 if (unwind.giffile->SavedImages[0].ImageDesc.Height != height
1886 || unwind.giffile->SavedImages[0].ImageDesc.Width != width 1892 || unwind.giffile->SavedImages[0].ImageDesc.Width != width
2051 signal_simple_error ("Not an X device", device); 2057 signal_simple_error ("Not an X device", device);
2052 2058
2053 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); 2059 dpy = DEVICE_X_DISPLAY (XDEVICE (device));
2054 scr = DefaultScreenOfDisplay (dpy); 2060 scr = DefaultScreenOfDisplay (dpy);
2055 2061
2056 png_ptr = (png_struct *) xmalloc (sizeof (png_struct)); 2062 png_ptr = xnew (png_struct);
2057 info_ptr = (png_info *) xmalloc (sizeof (png_info)); 2063 info_ptr = xnew (png_info);
2058 2064
2059 memset (&unwind, 0, sizeof (unwind)); 2065 memset (&unwind, 0, sizeof (unwind));
2060 unwind.png_ptr = png_ptr; 2066 unwind.png_ptr = png_ptr;
2061 unwind.info_ptr = info_ptr; 2067 unwind.info_ptr = info_ptr;
2062 unwind.dpy = dpy; 2068 unwind.dpy = dpy;
2109 { 2115 {
2110 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); 2116 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
2111 Extbyte *bytes; 2117 Extbyte *bytes;
2112 Extcount len; 2118 Extcount len;
2113 struct png_memory_storage tbr; /* Data to be read */ 2119 struct png_memory_storage tbr; /* Data to be read */
2114 2120
2115 assert (!NILP (data)); 2121 assert (!NILP (data));
2116 2122
2117 /* #### This is a definite problem under Mule due to the amount of 2123 /* #### This is a definite problem under Mule due to the amount of
2118 stack data it might allocate. Need to be able to convert and 2124 stack data it might allocate. Need to be able to convert and
2119 write out to a file. */ 2125 write out to a file. */
2120 GET_STRING_BINARY_DATA_ALLOCA (data, bytes, len); 2126 GET_STRING_BINARY_DATA_ALLOCA (data, bytes, len);
2121 tbr.bytes = bytes; 2127 tbr.bytes = bytes;
2147 png_byte *png_pixels; 2153 png_byte *png_pixels;
2148 png_byte **row_pointers; 2154 png_byte **row_pointers;
2149 png_color static_color_cube[216]; 2155 png_color static_color_cube[216];
2150 2156
2151 /* Wow, allocate all the memory. Truly, exciting. */ 2157 /* Wow, allocate all the memory. Truly, exciting. */
2152 unwind.pixels = (unsigned long *) xmalloc (256 * sizeof (unsigned long)); 2158 unwind.pixels = xnew_array (unsigned long, 256);
2153 png_pixels = (png_byte *) xmalloc (linesize * height * sizeof (png_byte*)); 2159 png_pixels = xnew_array (png_byte, linesize * height);
2154 row_pointers = (png_byte **) xmalloc (height * sizeof (png_byte *)); 2160 row_pointers = xnew_array (png_byte *, height);
2155 2161
2156 for (y = 0; y < 256; y++) 2162 for (y = 0; y < 256; y++)
2157 unwind.pixels[y] = 0; 2163 unwind.pixels[y] = 0;
2158 for (y = 0; y < height; y++) 2164 for (y = 0; y < height; y++)
2159 row_pointers[y] = png_pixels + (linesize * y); 2165 row_pointers[y] = png_pixels + (linesize * y);
2193 { 2199 {
2194 png_set_dither (png_ptr, info_ptr->palette, info_ptr->num_palette, 2200 png_set_dither (png_ptr, info_ptr->palette, info_ptr->num_palette,
2195 info_ptr->num_palette, info_ptr->hist, 1); 2201 info_ptr->num_palette, info_ptr->hist, 1);
2196 } 2202 }
2197 } 2203 }
2198 2204
2199 png_read_image (png_ptr, row_pointers); 2205 png_read_image (png_ptr, row_pointers);
2200 png_read_end (png_ptr, info_ptr); 2206 png_read_end (png_ptr, info_ptr);
2201 2207
2202 /* Ok, now we go and allocate all the colors */ 2208 /* Ok, now we go and allocate all the colors */
2203 if (info_ptr->valid & PNG_INFO_PLTE) 2209 if (info_ptr->valid & PNG_INFO_PLTE)
2252 } 2258 }
2253 } 2259 }
2254 #endif 2260 #endif
2255 2261
2256 /* Now create the image */ 2262 /* Now create the image */
2257 2263
2258 depth = DefaultDepthOfScreen (scr); 2264 depth = DefaultDepthOfScreen (scr);
2259 2265
2260 /* first get bitmap_pad (from XPM) */ 2266 /* first get bitmap_pad (from XPM) */
2261 if (depth > 16) 2267 bitmap_pad = ((depth > 16) ? 32 :
2262 bitmap_pad = 32; 2268 (depth > 8) ? 16 :
2263 else if (depth > 8) 2269 8);
2264 bitmap_pad = 16; 2270
2265 else
2266 bitmap_pad = 8;
2267
2268 unwind.ximage = XCreateImage (dpy, DefaultVisualOfScreen (scr), 2271 unwind.ximage = XCreateImage (dpy, DefaultVisualOfScreen (scr),
2269 depth, ZPixmap, 0, 0, width, height, 2272 depth, ZPixmap, 0, 0, width, height,
2270 bitmap_pad, 0); 2273 bitmap_pad, 0);
2271 2274
2272 if (!unwind.ximage) 2275 if (!unwind.ximage)
2282 for (i = 0; i < height; i++) 2285 for (i = 0; i < height; i++)
2283 for (j = 0; j < width; j++) 2286 for (j = 0; j < width; j++)
2284 XPutPixel (unwind.ximage, j, i, 2287 XPutPixel (unwind.ximage, j, i,
2285 unwind.pixels[png_pixels[i * width + j]]); 2288 unwind.pixels[png_pixels[i * width + j]]);
2286 } 2289 }
2287 2290
2288 xfree (row_pointers); 2291 xfree (row_pointers);
2289 xfree (png_pixels); 2292 xfree (png_pixels);
2290 } 2293 }
2291 2294
2292 init_image_instance_from_x_image (ii, unwind.ximage, dest_mask, 2295 init_image_instance_from_x_image (ii, unwind.ximage, dest_mask,
2344 2347
2345 static void 2348 static void
2346 check_valid_xpm_color_symbols (Lisp_Object data) 2349 check_valid_xpm_color_symbols (Lisp_Object data)
2347 { 2350 {
2348 Lisp_Object rest; 2351 Lisp_Object rest;
2349 2352
2350 for (rest = data; !NILP (rest); rest = XCDR (rest)) 2353 for (rest = data; !NILP (rest); rest = XCDR (rest))
2351 { 2354 {
2352 if (!CONSP (rest) || 2355 if (!CONSP (rest) ||
2353 !CONSP (XCAR (rest)) || 2356 !CONSP (XCAR (rest)) ||
2354 !STRINGP (XCAR (XCAR (rest))) || 2357 !STRINGP (XCAR (XCAR (rest))) ||
2483 { 2486 {
2484 Lisp_Object file = Qnil; 2487 Lisp_Object file = Qnil;
2485 Lisp_Object color_symbols; 2488 Lisp_Object color_symbols;
2486 struct gcpro gcpro1, gcpro2; 2489 struct gcpro gcpro1, gcpro2;
2487 Lisp_Object alist = Qnil; 2490 Lisp_Object alist = Qnil;
2488 2491
2489 GCPRO2 (file, alist); 2492 GCPRO2 (file, alist);
2490 2493
2491 /* Now, convert any file data into inline data. At the end of this, 2494 /* Now, convert any file data into inline data. At the end of this,
2492 `data' will contain the inline data (if any) or Qnil, and 2495 `data' will contain the inline data (if any) or Qnil, and
2493 `file' will contain the name this data was derived from (if 2496 `file' will contain the name this data was derived from (if
2601 } 2604 }
2602 UNGCPRO; /* no more evaluation */ 2605 UNGCPRO; /* no more evaluation */
2603 2606
2604 if (i == 0) return 0; 2607 if (i == 0) return 0;
2605 2608
2606 symbols = (XpmColorSymbol *) xmalloc (i * sizeof (XpmColorSymbol)); 2609 symbols = xnew_array (XpmColorSymbol, i);
2607 xpmattrs->valuemask |= XpmColorSymbols; 2610 xpmattrs->valuemask |= XpmColorSymbols;
2608 xpmattrs->colorsymbols = symbols; 2611 xpmattrs->colorsymbols = symbols;
2609 xpmattrs->numsymbols = i; 2612 xpmattrs->numsymbols = i;
2610 2613
2611 while (--i >= 0) 2614 while (--i >= 0)
2699 else 2702 else
2700 { 2703 {
2701 xpmattrs.closeness = 65535; 2704 xpmattrs.closeness = 65535;
2702 xpmattrs.valuemask |= XpmCloseness; 2705 xpmattrs.valuemask |= XpmCloseness;
2703 } 2706 }
2704 2707
2705 color_symbols = extract_xpm_color_names (&xpmattrs, device, domain, 2708 color_symbols = extract_xpm_color_names (&xpmattrs, device, domain,
2706 color_symbol_alist); 2709 color_symbol_alist);
2707 2710
2708 result = XpmCreatePixmapFromBuffer (dpy, 2711 result = XpmCreatePixmapFromBuffer (dpy,
2709 RootWindowOfScreen (xs), 2712 RootWindowOfScreen (xs),
2769 w = xpmattrs.width; 2772 w = xpmattrs.width;
2770 h = xpmattrs.height; 2773 h = xpmattrs.height;
2771 2774
2772 { 2775 {
2773 int npixels = xpmattrs.npixels; 2776 int npixels = xpmattrs.npixels;
2774 Pixel *pixels = 0; 2777 Pixel *pixels;
2775 2778
2776 if (npixels != 0) 2779 if (npixels != 0)
2777 { 2780 {
2778 pixels = xmalloc (npixels * sizeof (Pixel)); 2781 pixels = xnew_array (Pixel, npixels);
2779 memcpy (pixels, xpmattrs.pixels, npixels * sizeof (Pixel)); 2782 memcpy (pixels, xpmattrs.pixels, npixels * sizeof (Pixel));
2780 } 2783 }
2781 else 2784 else
2782 pixels = 0; 2785 pixels = NULL;
2783 2786
2784 IMAGE_INSTANCE_X_PIXMAP (ii) = pixmap; 2787 IMAGE_INSTANCE_X_PIXMAP (ii) = pixmap;
2785 IMAGE_INSTANCE_X_MASK (ii) = mask; 2788 IMAGE_INSTANCE_X_MASK (ii) = mask;
2786 IMAGE_INSTANCE_X_PIXELS (ii) = pixels; 2789 IMAGE_INSTANCE_X_PIXELS (ii) = pixels;
2787 IMAGE_INSTANCE_X_NPIXELS (ii) = npixels; 2790 IMAGE_INSTANCE_X_NPIXELS (ii) = npixels;
2847 { 2850 {
2848 /* With an XBM file, it's obvious which bit is foreground 2851 /* With an XBM file, it's obvious which bit is foreground
2849 and which is background, or rather, it's implicit: in 2852 and which is background, or rather, it's implicit: in
2850 an XBM file, a 1 bit is foreground, and a 0 bit is 2853 an XBM file, a 1 bit is foreground, and a 0 bit is
2851 background. 2854 background.
2852 2855
2853 XCreatePixmapCursor() assumes this property of the 2856 XCreatePixmapCursor() assumes this property of the
2854 pixmap it is called with as well; the `foreground' 2857 pixmap it is called with as well; the `foreground'
2855 color argument is used for the 1 bits. 2858 color argument is used for the 1 bits.
2856 2859
2857 With an XPM file, it's tricker, since the elements of 2860 With an XPM file, it's tricker, since the elements of
2859 pixel values. So we need to figure out which of those 2862 pixel values. So we need to figure out which of those
2860 pixels is the foreground color and which is the 2863 pixels is the foreground color and which is the
2861 background. We do it by comparing RGB and assuming 2864 background. We do it by comparing RGB and assuming
2862 that the darker color is the foreground. This works 2865 that the darker color is the foreground. This works
2863 with the result of xbmtopbm|ppmtoxpm, at least. 2866 with the result of xbmtopbm|ppmtoxpm, at least.
2864 2867
2865 It might be nice if there was some way to tag the 2868 It might be nice if there was some way to tag the
2866 colors in the XPM file with whether they are the 2869 colors in the XPM file with whether they are the
2867 foreground - perhaps with logical color names somehow? 2870 foreground - perhaps with logical color names somehow?
2868 2871
2869 Once we have decided which color is the foreground, we 2872 Once we have decided which color is the foreground, we
2870 need to ensure that that color corresponds to a `1' bit 2873 need to ensure that that color corresponds to a `1' bit
2871 in the Pixmap. The XPM library wrote into the (1-bit) 2874 in the Pixmap. The XPM library wrote into the (1-bit)
2872 pixmap with XPutPixel, which will ignore all but the 2875 pixmap with XPutPixel, which will ignore all but the
2873 least significant bit. 2876 least significant bit.
2874 2877
2875 This means that a 1 bit in the image corresponds to 2878 This means that a 1 bit in the image corresponds to
2876 `fg' only if `fg.pixel' is odd. 2879 `fg' only if `fg.pixel' is odd.
2877 2880
2878 (This also means that the image will be all the same 2881 (This also means that the image will be all the same
2879 color if both `fg' and `bg' are odd or even, but we can 2882 color if both `fg' and `bg' are odd or even, but we can
2880 safely assume that that won't happen if the XPM file is 2883 safely assume that that won't happen if the XPM file is
2881 sensible I think.) 2884 sensible I think.)
2882 2885
2883 The desired result is that the image use `1' to 2886 The desired result is that the image use `1' to
2884 represent the foreground color, and `0' to represent 2887 represent the foreground color, and `0' to represent
2885 the background color. So, we may need to invert the 2888 the background color. So, we may need to invert the
2886 image to accomplish this; we invert if fg is 2889 image to accomplish this; we invert if fg is
2887 odd. (Remember that WhitePixel and BlackPixel are not 2890 odd. (Remember that WhitePixel and BlackPixel are not
2922 swap = fg; 2925 swap = fg;
2923 fg = bg; 2926 fg = bg;
2924 bg = swap; 2927 bg = swap;
2925 } 2928 }
2926 } 2929 }
2927 2930
2928 /* If the fg pixel corresponds to a `0' in the bitmap, invert it. 2931 /* If the fg pixel corresponds to a `0' in the bitmap, invert it.
2929 (This occurs (only?) on servers with Black=0, White=1.) 2932 (This occurs (only?) on servers with Black=0, White=1.)
2930 */ 2933 */
2931 if ((fg.pixel & 1) == 0) 2934 if ((fg.pixel & 1) == 0)
2932 { 2935 {
2956 break; 2959 break;
2957 2960
2958 default: 2961 default:
2959 abort (); 2962 abort ();
2960 } 2963 }
2961 2964
2962 xpm_free (&xpmattrs); /* after we've read pixels and hotspot */ 2965 xpm_free (&xpmattrs); /* after we've read pixels and hotspot */
2963 } 2966 }
2964 2967
2965 #endif /* HAVE_XPM */ 2968 #endif /* HAVE_XPM */
2966 2969
2982 { 2985 {
2983 /* This funcation can call lisp */ 2986 /* This funcation can call lisp */
2984 Lisp_Object file = Qnil, mask_file = Qnil; 2987 Lisp_Object file = Qnil, mask_file = Qnil;
2985 struct gcpro gcpro1, gcpro2, gcpro3; 2988 struct gcpro gcpro1, gcpro2, gcpro3;
2986 Lisp_Object alist = Qnil; 2989 Lisp_Object alist = Qnil;
2987 2990
2988 GCPRO3 (file, mask_file, alist); 2991 GCPRO3 (file, mask_file, alist);
2989 2992
2990 /* Now, convert any file data into inline data for both the regular 2993 /* Now, convert any file data into inline data for both the regular
2991 data and the mask data. At the end of this, `data' will contain 2994 data and the mask data. At the end of this, `data' will contain
2992 the inline data (if any) or Qnil, and `file' will contain 2995 the inline data (if any) or Qnil, and `file' will contain
3041 #undef EXTERN 3044 #undef EXTERN
3042 #endif 3045 #endif
3043 /* We have to define SYSV32 so that compface.h includes string.h 3046 /* We have to define SYSV32 so that compface.h includes string.h
3044 instead of strings.h. */ 3047 instead of strings.h. */
3045 #define SYSV32 3048 #define SYSV32
3049 #ifdef __cplusplus
3050 extern "C" {
3051 #endif
3046 #include <compface.h> 3052 #include <compface.h>
3053 #ifdef __cplusplus
3054 }
3055 #endif
3047 /* JMP_BUF cannot be used here because if it doesn't get defined 3056 /* JMP_BUF cannot be used here because if it doesn't get defined
3048 to jmp_buf we end up with a conflicting type error with the 3057 to jmp_buf we end up with a conflicting type error with the
3049 definition in compface.h */ 3058 definition in compface.h */
3050 extern jmp_buf comp_env; 3059 extern jmp_buf comp_env;
3051 #undef SYSV32 3060 #undef SYSV32
3149 /* #### Apparently some versions of XpmReadFileToData, which is 3158 /* #### Apparently some versions of XpmReadFileToData, which is
3150 called by pixmap_to_lisp_data, don't return an error value 3159 called by pixmap_to_lisp_data, don't return an error value
3151 if the given file is not a valid XPM file. Instead, they 3160 if the given file is not a valid XPM file. Instead, they
3152 just seg fault. It is definitely caused by passing a 3161 just seg fault. It is definitely caused by passing a
3153 bitmap. To try and avoid this we check for bitmaps first. */ 3162 bitmap. To try and avoid this we check for bitmaps first. */
3154 3163
3155 data = bitmap_to_lisp_data (filename, &xhot, &yhot, 1); 3164 data = bitmap_to_lisp_data (filename, &xhot, &yhot, 1);
3156 3165
3157 if (!EQ (data, Qt)) 3166 if (!EQ (data, Qt))
3158 { 3167 {
3159 alist = remassq_no_quit (Q_data, alist); 3168 alist = remassq_no_quit (Q_data, alist);
3539 write_c_string (buf, printcharfun); 3548 write_c_string (buf, printcharfun);
3540 3549
3541 /* This is stolen from frame.c. Subwindows are strange in that they 3550 /* This is stolen from frame.c. Subwindows are strange in that they
3542 are specific to a particular frame so we want to print in their 3551 are specific to a particular frame so we want to print in their
3543 description what that frame is. */ 3552 description what that frame is. */
3544 3553
3545 write_c_string (" on #<", printcharfun); 3554 write_c_string (" on #<", printcharfun);
3546 if (!FRAME_LIVE_P (frm)) 3555 if (!FRAME_LIVE_P (frm))
3547 write_c_string ("dead", printcharfun); 3556 write_c_string ("dead", printcharfun);
3548 else if (FRAME_TTY_P (frm)) 3557 else if (FRAME_TTY_P (frm))
3549 write_c_string ("tty", printcharfun); 3558 write_c_string ("tty", printcharfun);
3639 ih = XINT (height); 3648 ih = XINT (height);
3640 if (ih < 1) ih = 1; 3649 if (ih < 1) ih = 1;
3641 } 3650 }
3642 3651
3643 { 3652 {
3644 struct Lisp_Subwindow *sw = alloc_lcrecord (sizeof (struct Lisp_Subwindow), 3653 struct Lisp_Subwindow *sw =
3645 lrecord_subwindow); 3654 alloc_lcrecord_type (struct Lisp_Subwindow, lrecord_subwindow);
3646 Lisp_Object val; 3655 Lisp_Object val;
3647 sw->frame = frame; 3656 sw->frame = frame;
3648 sw->xscreen = xs; 3657 sw->xscreen = xs;
3649 sw->parent_window = pw; 3658 sw->parent_window = pw;
3650 sw->height = ih; 3659 sw->height = ih;
3896 IIFORMAT_HAS_METHOD (png, instantiate); 3905 IIFORMAT_HAS_METHOD (png, instantiate);
3897 3906
3898 IIFORMAT_VALID_KEYWORD (png, Q_data, check_valid_string); 3907 IIFORMAT_VALID_KEYWORD (png, Q_data, check_valid_string);
3899 IIFORMAT_VALID_KEYWORD (png, Q_file, check_valid_string); 3908 IIFORMAT_VALID_KEYWORD (png, Q_file, check_valid_string);
3900 #endif 3909 #endif
3901 3910
3902 #ifdef HAVE_TIFF 3911 #ifdef HAVE_TIFF
3903 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tiff, "tiff"); 3912 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tiff, "tiff");
3904 3913
3905 IIFORMAT_HAS_METHOD (tiff, validate); 3914 IIFORMAT_HAS_METHOD (tiff, validate);
3906 IIFORMAT_HAS_METHOD (tiff, normalize); 3915 IIFORMAT_HAS_METHOD (tiff, normalize);
3936 IIFORMAT_VALID_KEYWORD (xface, Q_file, check_valid_string); 3945 IIFORMAT_VALID_KEYWORD (xface, Q_file, check_valid_string);
3937 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_x, check_valid_int); 3946 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_x, check_valid_int);
3938 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_y, check_valid_int); 3947 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_y, check_valid_int);
3939 IIFORMAT_VALID_KEYWORD (xface, Q_foreground, check_valid_string); 3948 IIFORMAT_VALID_KEYWORD (xface, Q_foreground, check_valid_string);
3940 IIFORMAT_VALID_KEYWORD (xface, Q_background, check_valid_string); 3949 IIFORMAT_VALID_KEYWORD (xface, Q_background, check_valid_string);
3941 #endif 3950 #endif
3942 3951
3943 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (autodetect, 3952 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (autodetect,
3944 "autodetect"); 3953 "autodetect");
3945 3954
3946 IIFORMAT_HAS_METHOD (autodetect, validate); 3955 IIFORMAT_HAS_METHOD (autodetect, validate);
3963 #endif 3972 #endif
3964 3973
3965 #ifdef HAVE_PNG 3974 #ifdef HAVE_PNG
3966 Fprovide (Qpng); 3975 Fprovide (Qpng);
3967 #endif 3976 #endif
3968 3977
3969 #ifdef HAVE_TIFF 3978 #ifdef HAVE_TIFF
3970 Fprovide (Qtiff); 3979 Fprovide (Qtiff);
3971 #endif 3980 #endif
3972 3981
3973 #ifdef HAVE_XPM 3982 #ifdef HAVE_XPM
3983 3992
3984 The default value of this variable defines the logical color names 3993 The default value of this variable defines the logical color names
3985 \"foreground\" and \"background\" to be the colors of the `default' face. 3994 \"foreground\" and \"background\" to be the colors of the `default' face.
3986 */ ); 3995 */ );
3987 Vxpm_color_symbols = Qnil; /* initialized in x-faces.el */ 3996 Vxpm_color_symbols = Qnil; /* initialized in x-faces.el */
3988 #endif 3997 #endif
3989 3998
3990 #ifdef HAVE_XFACE 3999 #ifdef HAVE_XFACE
3991 Fprovide (Qxface); 4000 Fprovide (Qxface);
3992 #endif 4001 #endif
3993 4002
3994 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path /* 4003 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path /*
3995 A list of the directories in which X bitmap files may be found. 4004 A list of the directories in which X bitmap files may be found.
3996 If nil, this is initialized from the \"*bitmapFilePath\" resource. 4005 If nil, this is initialized from the "*bitmapFilePath" resource.
3997 This is used by the `make-image-instance' function (however, note that if 4006 This is used by the `make-image-instance' function (however, note that if
3998 the environment variable XBMLANGPATH is set, it is consulted first). 4007 the environment variable XBMLANGPATH is set, it is consulted first).
3999 */ ); 4008 */ );
4000 Vx_bitmap_file_path = Qnil; 4009 Vx_bitmap_file_path = Qnil;
4001 } 4010 }