Mercurial > hg > xemacs-beta
comparison src/glyphs-x.c @ 278:90d73dddcdc4 r21-0b37
Import from CVS: tag r21-0b37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:31:29 +0200 |
parents | 6330739388db |
children | 7df0dd720c89 |
comparison
equal
deleted
inserted
replaced
277:cfdf3ff11843 | 278:90d73dddcdc4 |
---|---|
74 #endif | 74 #endif |
75 #ifdef FILE_CODING | 75 #ifdef FILE_CODING |
76 #include "file-coding.h" | 76 #include "file-coding.h" |
77 #endif | 77 #endif |
78 | 78 |
79 #undef HAVE_PNG | |
80 #undef HAVE_TIFF | |
81 #undef HAVE_JPEG | |
82 #undef HAVE_GIF | |
83 | |
79 #if INTBITS == 32 | 84 #if INTBITS == 32 |
80 # define FOUR_BYTE_TYPE unsigned int | 85 # define FOUR_BYTE_TYPE unsigned int |
81 #elif LONGBITS == 32 | 86 #elif LONGBITS == 32 |
82 # define FOUR_BYTE_TYPE unsigned long | 87 # define FOUR_BYTE_TYPE unsigned long |
83 #elif SHORTBITS == 32 | 88 #elif SHORTBITS == 32 |
91 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xbm); | 96 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xbm); |
92 Lisp_Object Qxbm; | 97 Lisp_Object Qxbm; |
93 | 98 |
94 Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y; | 99 Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y; |
95 Lisp_Object Q_foreground, Q_background; | 100 Lisp_Object Q_foreground, Q_background; |
96 | |
97 #ifdef HAVE_XPM | |
98 Lisp_Object Q_color_symbols; | |
99 #endif | |
100 | 101 |
101 #ifdef HAVE_XFACE | 102 #ifdef HAVE_XFACE |
102 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xface); | 103 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xface); |
103 Lisp_Object Qxface; | 104 Lisp_Object Qxface; |
104 #endif | 105 #endif |
471 | 472 |
472 /* Given a pixmap filename, look through all of the "standard" places | 473 /* Given a pixmap filename, look through all of the "standard" places |
473 where the file might be located. Return a full pathname if found; | 474 where the file might be located. Return a full pathname if found; |
474 otherwise, return Qnil. */ | 475 otherwise, return Qnil. */ |
475 | 476 |
476 static Lisp_Object | 477 Lisp_Object |
477 locate_pixmap_file (Lisp_Object name) | 478 x_locate_pixmap_file (Lisp_Object name) |
478 { | 479 { |
479 /* This function can GC if IN_REDISPLAY is false */ | 480 /* This function can GC if IN_REDISPLAY is false */ |
480 Display *display; | 481 Display *display; |
481 | 482 |
482 /* Check non-absolute pathnames with a directory component relative to | 483 /* Check non-absolute pathnames with a directory component relative to |
546 | 547 |
547 return found; | 548 return found; |
548 } | 549 } |
549 } | 550 } |
550 | 551 |
552 static Lisp_Object | |
553 locate_pixmap_file (Lisp_Object name) | |
554 { | |
555 return x_locate_pixmap_file (name); | |
556 } | |
557 | |
558 #if 0 | |
551 /* If INSTANTIATOR refers to inline data, return Qnil. | 559 /* If INSTANTIATOR refers to inline data, return Qnil. |
552 If INSTANTIATOR refers to data in a file, return the full filename | 560 If INSTANTIATOR refers to data in a file, return the full filename |
553 if it exists; otherwise, return a cons of (filename). | 561 if it exists; otherwise, return a cons of (filename). |
554 | 562 |
555 FILE_KEYWORD and DATA_KEYWORD are symbols specifying the | 563 FILE_KEYWORD and DATA_KEYWORD are symbols specifying the |
600 Qnil. | 608 Qnil. |
601 | 609 |
602 Note that if we cannot generate any regular inline data, we | 610 Note that if we cannot generate any regular inline data, we |
603 skip out. */ | 611 skip out. */ |
604 | 612 |
605 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data); | 613 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
606 | 614 console_type); |
615 | |
607 if (CONSP (file)) /* failure locating filename */ | 616 if (CONSP (file)) /* failure locating filename */ |
608 signal_double_file_error ("Opening pixmap file", | 617 signal_double_file_error ("Opening pixmap file", |
609 "no such file or directory", | 618 "no such file or directory", |
610 Fcar (file)); | 619 Fcar (file)); |
611 | 620 |
626 Lisp_Object result = alist_to_tagged_vector (image_type_tag, alist); | 635 Lisp_Object result = alist_to_tagged_vector (image_type_tag, alist); |
627 free_alist (alist); | 636 free_alist (alist); |
628 RETURN_UNGCPRO (result); | 637 RETURN_UNGCPRO (result); |
629 } | 638 } |
630 } | 639 } |
640 #endif | |
631 | 641 |
632 #if 0 | 642 #if 0 |
633 static void | 643 static void |
634 write_lisp_string_to_temp_file (Lisp_Object string, char *filename_out) | 644 write_lisp_string_to_temp_file (Lisp_Object string, char *filename_out) |
635 { | 645 { |
885 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = ximage->height; | 895 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = ximage->height; |
886 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = ximage->depth; | 896 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = ximage->depth; |
887 IMAGE_INSTANCE_X_COLORMAP (ii) = cmap; | 897 IMAGE_INSTANCE_X_COLORMAP (ii) = cmap; |
888 IMAGE_INSTANCE_X_PIXELS (ii) = pixels; | 898 IMAGE_INSTANCE_X_PIXELS (ii) = pixels; |
889 IMAGE_INSTANCE_X_NPIXELS (ii) = npixels; | 899 IMAGE_INSTANCE_X_NPIXELS (ii) = npixels; |
900 } | |
901 | |
902 static void | |
903 x_init_image_instance_from_eimage (struct Lisp_Image_Instance *ii, | |
904 int width, int height, | |
905 unsigned char *eimage, | |
906 int dest_mask, | |
907 Lisp_Object instantiator, | |
908 Lisp_Object domain) | |
909 { | |
910 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | |
911 Colormap cmap = DEVICE_X_COLORMAP (XDEVICE(device)); | |
912 unsigned long *pixtbl; | |
913 int pixcount; | |
914 int npixels; | |
915 XImage* ximage; | |
916 | |
917 ximage = convert_EImage_to_XImage (device, width, height, eimage, | |
918 &pixtbl, &pixcount, &npixels); | |
919 if (!ximage) | |
920 signal_image_error("EImage to XImage conversion failed", instantiator); | |
921 | |
922 /* Now create the pixmap and set up the image instance */ | |
923 init_image_instance_from_x_image (ii, ximage, dest_mask, | |
924 cmap, pixtbl, npixels, | |
925 instantiator); | |
926 | |
927 if (ximage) | |
928 { | |
929 if (ximage->data) | |
930 { | |
931 xfree (ximage->data); | |
932 ximage->data = 0; | |
933 } | |
934 XDestroyImage (ximage); | |
935 } | |
890 } | 936 } |
891 | 937 |
892 | 938 |
893 /********************************************************************** | 939 /********************************************************************** |
894 * XBM * | 940 * XBM * |
1054 Likewise for `mask_file' and `mask_data'. | 1100 Likewise for `mask_file' and `mask_data'. |
1055 | 1101 |
1056 Note that if we cannot generate any regular inline data, we | 1102 Note that if we cannot generate any regular inline data, we |
1057 skip out. */ | 1103 skip out. */ |
1058 | 1104 |
1059 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data); | 1105 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
1106 console_type); | |
1060 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, | 1107 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, |
1061 Q_mask_data); | 1108 Q_mask_data, console_type); |
1062 | 1109 |
1063 if (CONSP (file)) /* failure locating filename */ | 1110 if (CONSP (file)) /* failure locating filename */ |
1064 signal_double_file_error ("Opening bitmap file", | 1111 signal_double_file_error ("Opening bitmap file", |
1065 "no such file or directory", | 1112 "no such file or directory", |
1066 Fcar (file)); | 1113 Fcar (file)); |
1412 known) or Qnil. | 1459 known) or Qnil. |
1413 | 1460 |
1414 Note that if we cannot generate any regular inline data, we | 1461 Note that if we cannot generate any regular inline data, we |
1415 skip out. */ | 1462 skip out. */ |
1416 | 1463 |
1417 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data); | 1464 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
1465 console_type); | |
1418 | 1466 |
1419 if (CONSP (file)) /* failure locating filename */ | 1467 if (CONSP (file)) /* failure locating filename */ |
1420 signal_double_file_error ("Opening pixmap file", | 1468 signal_double_file_error ("Opening pixmap file", |
1421 "no such file or directory", | 1469 "no such file or directory", |
1422 Fcar (file)); | 1470 Fcar (file)); |
3700 Likewise for `mask_file' and `mask_data'. | 3748 Likewise for `mask_file' and `mask_data'. |
3701 | 3749 |
3702 Note that if we cannot generate any regular inline data, we | 3750 Note that if we cannot generate any regular inline data, we |
3703 skip out. */ | 3751 skip out. */ |
3704 | 3752 |
3705 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data); | 3753 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
3754 console_type); | |
3706 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, | 3755 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, |
3707 Q_mask_data); | 3756 Q_mask_data, console_type); |
3708 | 3757 |
3709 if (CONSP (file)) /* failure locating filename */ | 3758 if (CONSP (file)) /* failure locating filename */ |
3710 signal_double_file_error ("Opening bitmap file", | 3759 signal_double_file_error ("Opening bitmap file", |
3711 "no such file or directory", | 3760 "no such file or directory", |
3712 Fcar (file)); | 3761 Fcar (file)); |
4522 CONSOLE_HAS_METHOD (x, print_image_instance); | 4571 CONSOLE_HAS_METHOD (x, print_image_instance); |
4523 CONSOLE_HAS_METHOD (x, finalize_image_instance); | 4572 CONSOLE_HAS_METHOD (x, finalize_image_instance); |
4524 CONSOLE_HAS_METHOD (x, image_instance_equal); | 4573 CONSOLE_HAS_METHOD (x, image_instance_equal); |
4525 CONSOLE_HAS_METHOD (x, image_instance_hash); | 4574 CONSOLE_HAS_METHOD (x, image_instance_hash); |
4526 CONSOLE_HAS_METHOD (x, colorize_image_instance); | 4575 CONSOLE_HAS_METHOD (x, colorize_image_instance); |
4576 CONSOLE_HAS_METHOD (x, init_image_instance_from_eimage); | |
4577 CONSOLE_HAS_METHOD (x, locate_pixmap_file); | |
4527 } | 4578 } |
4528 | 4579 |
4529 void | 4580 void |
4530 image_instantiator_format_create_glyphs_x (void) | 4581 image_instantiator_format_create_glyphs_x (void) |
4531 { | 4582 { |