Mercurial > hg > xemacs-beta
comparison src/glyphs-x.c @ 48:56c54cf7c5b6 r19-16b90
Import from CVS: tag r19-16b90
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:56:04 +0200 |
parents | 8d2a9b52c682 |
children | ee648375d8d6 |
comparison
equal
deleted
inserted
replaced
47:11c6df210d7f | 48:56c54cf7c5b6 |
---|---|
55 #include "insdel.h" | 55 #include "insdel.h" |
56 #include "opaque.h" | 56 #include "opaque.h" |
57 | 57 |
58 #include "sysfile.h" | 58 #include "sysfile.h" |
59 | 59 |
60 #ifdef HAVE_PNG | |
61 #include <png.h> | |
62 #else | |
60 #include <setjmp.h> | 63 #include <setjmp.h> |
64 #endif | |
61 | 65 |
62 #define LISP_DEVICE_TO_X_SCREEN(dev) \ | 66 #define LISP_DEVICE_TO_X_SCREEN(dev) \ |
63 XDefaultScreenOfDisplay (DEVICE_X_DISPLAY (XDEVICE (dev))) | 67 XDefaultScreenOfDisplay (DEVICE_X_DISPLAY (XDEVICE (dev))) |
64 | 68 |
65 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xbm); | 69 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xbm); |
108 | 112 |
109 static void cursor_font_instantiate (Lisp_Object image_instance, | 113 static void cursor_font_instantiate (Lisp_Object image_instance, |
110 Lisp_Object instantiator, | 114 Lisp_Object instantiator, |
111 Lisp_Object pointer_fg, | 115 Lisp_Object pointer_fg, |
112 Lisp_Object pointer_bg, | 116 Lisp_Object pointer_bg, |
113 int dest_mask); | 117 int dest_mask, |
118 Lisp_Object domain); | |
114 | 119 |
115 #include "bitmaps.h" | 120 #include "bitmaps.h" |
116 | 121 |
117 | 122 |
118 /************************************************************************/ | 123 /************************************************************************/ |
1032 /* Instantiate method for XBM's. */ | 1037 /* Instantiate method for XBM's. */ |
1033 | 1038 |
1034 static void | 1039 static void |
1035 xbm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 1040 xbm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
1036 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 1041 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
1037 int dest_mask) | 1042 int dest_mask, Lisp_Object domain) |
1038 { | 1043 { |
1039 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 1044 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
1040 CONST char *gcc_go_home; | 1045 CONST char *gcc_go_home; |
1041 | 1046 |
1042 assert (!NILP (data)); | 1047 assert (!NILP (data)); |
1266 /* The code in this routine is based on example.c from the JPEG library | 1271 /* The code in this routine is based on example.c from the JPEG library |
1267 source code and from gif_instantiate() */ | 1272 source code and from gif_instantiate() */ |
1268 static void | 1273 static void |
1269 jpeg_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 1274 jpeg_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
1270 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 1275 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
1271 int dest_mask) | 1276 int dest_mask, Lisp_Object domain) |
1272 { | 1277 { |
1273 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 1278 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
1274 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 1279 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
1275 Display *dpy; | 1280 Display *dpy; |
1276 Screen *scr; | 1281 Screen *scr; |
1743 #endif | 1748 #endif |
1744 | 1749 |
1745 static void | 1750 static void |
1746 gif_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 1751 gif_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
1747 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 1752 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
1748 int dest_mask) | 1753 int dest_mask, Lisp_Object domain) |
1749 { | 1754 { |
1750 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 1755 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
1751 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 1756 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
1752 Display *dpy; | 1757 Display *dpy; |
1753 Screen *scr; | 1758 Screen *scr; |
1917 #endif /* HAVE_GIF */ | 1922 #endif /* HAVE_GIF */ |
1918 | 1923 |
1919 | 1924 |
1920 #ifdef HAVE_PNG | 1925 #ifdef HAVE_PNG |
1921 | 1926 |
1922 #include <png.h> | |
1923 | |
1924 /********************************************************************** | 1927 /********************************************************************** |
1925 * PNG * | 1928 * PNG * |
1926 **********************************************************************/ | 1929 **********************************************************************/ |
1927 static void | 1930 static void |
1928 png_validate (Lisp_Object instantiator) | 1931 png_validate (Lisp_Object instantiator) |
2028 #endif | 2031 #endif |
2029 | 2032 |
2030 static void | 2033 static void |
2031 png_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 2034 png_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
2032 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 2035 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
2033 int dest_mask) | 2036 int dest_mask, Lisp_Object domain) |
2034 { | 2037 { |
2035 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 2038 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
2036 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 2039 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
2037 Display *dpy; | 2040 Display *dpy; |
2038 Screen *scr; | 2041 Screen *scr; |
2322 } | 2325 } |
2323 | 2326 |
2324 static void | 2327 static void |
2325 tiff_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 2328 tiff_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
2326 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 2329 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
2327 int dest_mask) | 2330 int dest_mask, Lisp_Object domain) |
2328 { | 2331 { |
2329 abort (); | 2332 abort (); |
2330 } | 2333 } |
2331 | 2334 |
2332 #endif /* HAVE_TIFF */ | 2335 #endif /* HAVE_TIFF */ |
2552 Upgrade to version 3.2g or better or compile with --with-xpm=no. | 2555 Upgrade to version 3.2g or better or compile with --with-xpm=no. |
2553 #endif /* !XPM_DOES_BUFFERS */ | 2556 #endif /* !XPM_DOES_BUFFERS */ |
2554 | 2557 |
2555 static XpmColorSymbol * | 2558 static XpmColorSymbol * |
2556 extract_xpm_color_names (XpmAttributes *xpmattrs, Lisp_Object device, | 2559 extract_xpm_color_names (XpmAttributes *xpmattrs, Lisp_Object device, |
2560 Lisp_Object domain, | |
2557 Lisp_Object color_symbol_alist) | 2561 Lisp_Object color_symbol_alist) |
2558 { | 2562 { |
2559 /* This function can GC */ | 2563 /* This function can GC */ |
2560 Screen *xs = LISP_DEVICE_TO_X_SCREEN (device); | 2564 Screen *xs = LISP_DEVICE_TO_X_SCREEN (device); |
2561 Display *dpy = DisplayOfScreen (xs); | 2565 Display *dpy = DisplayOfScreen (xs); |
2585 Fmake_color_instance | 2589 Fmake_color_instance |
2586 (value, device, encode_error_behavior_flag (ERROR_ME_NOT)); | 2590 (value, device, encode_error_behavior_flag (ERROR_ME_NOT)); |
2587 else | 2591 else |
2588 { | 2592 { |
2589 assert (COLOR_SPECIFIERP (value)); | 2593 assert (COLOR_SPECIFIERP (value)); |
2590 value = Fspecifier_instance (value, Qnil, Qnil, Qnil); | 2594 value = Fspecifier_instance (value, domain, Qnil, Qnil); |
2591 } | 2595 } |
2592 if (NILP (value)) | 2596 if (NILP (value)) |
2593 continue; | 2597 continue; |
2594 results = noseeum_cons (noseeum_cons (name, value), results); | 2598 results = noseeum_cons (noseeum_cons (name, value), results); |
2595 i++; | 2599 i++; |
2634 } | 2638 } |
2635 | 2639 |
2636 static void | 2640 static void |
2637 xpm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 2641 xpm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
2638 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 2642 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
2639 int dest_mask) | 2643 int dest_mask, Lisp_Object domain) |
2640 { | 2644 { |
2641 /* This function can GC */ | 2645 /* This function can GC */ |
2642 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 2646 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
2643 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 2647 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
2644 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 2648 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
2695 { | 2699 { |
2696 xpmattrs.closeness = 65535; | 2700 xpmattrs.closeness = 65535; |
2697 xpmattrs.valuemask |= XpmCloseness; | 2701 xpmattrs.valuemask |= XpmCloseness; |
2698 } | 2702 } |
2699 | 2703 |
2700 color_symbols = extract_xpm_color_names (&xpmattrs, device, | 2704 color_symbols = extract_xpm_color_names (&xpmattrs, device, domain, |
2701 color_symbol_alist); | 2705 color_symbol_alist); |
2702 | 2706 |
2703 result = XpmCreatePixmapFromBuffer (dpy, | 2707 result = XpmCreatePixmapFromBuffer (dpy, |
2704 RootWindowOfScreen (xs), | 2708 RootWindowOfScreen (xs), |
2705 (char *) XSTRING_DATA (data), | 2709 (char *) XSTRING_DATA (data), |
3046 #undef SYSV32 | 3050 #undef SYSV32 |
3047 | 3051 |
3048 static void | 3052 static void |
3049 xface_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 3053 xface_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
3050 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 3054 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
3051 int dest_mask) | 3055 int dest_mask, Lisp_Object domain) |
3052 { | 3056 { |
3053 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 3057 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
3054 int i, stattis; | 3058 int i, stattis; |
3055 char *p, *bits, *bp; | 3059 char *p, *bits, *bp; |
3056 CONST char * volatile emsg = 0; | 3060 CONST char * volatile emsg = 0; |
3211 } | 3215 } |
3212 | 3216 |
3213 static void | 3217 static void |
3214 autodetect_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 3218 autodetect_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
3215 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 3219 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
3216 int dest_mask) | 3220 int dest_mask, Lisp_Object domain) |
3217 { | 3221 { |
3218 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 3222 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
3219 struct gcpro gcpro1, gcpro2, gcpro3; | 3223 struct gcpro gcpro1, gcpro2, gcpro3; |
3220 Lisp_Object alist = Qnil; | 3224 Lisp_Object alist = Qnil; |
3221 Lisp_Object result = Qnil; | 3225 Lisp_Object result = Qnil; |
3239 result = alist_to_tagged_vector (Qstring, alist); | 3243 result = alist_to_tagged_vector (Qstring, alist); |
3240 free_alist (alist); | 3244 free_alist (alist); |
3241 | 3245 |
3242 if (is_cursor_font) | 3246 if (is_cursor_font) |
3243 cursor_font_instantiate (image_instance, result, pointer_fg, | 3247 cursor_font_instantiate (image_instance, result, pointer_fg, |
3244 pointer_bg, dest_mask); | 3248 pointer_bg, dest_mask, domain); |
3245 else | 3249 else |
3246 string_instantiate (image_instance, result, pointer_fg, | 3250 string_instantiate (image_instance, result, pointer_fg, |
3247 pointer_bg, dest_mask); | 3251 pointer_bg, dest_mask, domain); |
3248 | 3252 |
3249 UNGCPRO; | 3253 UNGCPRO; |
3250 } | 3254 } |
3251 | 3255 |
3252 | 3256 |
3308 } | 3312 } |
3309 | 3313 |
3310 static void | 3314 static void |
3311 font_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 3315 font_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
3312 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 3316 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
3313 int dest_mask) | 3317 int dest_mask, Lisp_Object domain) |
3314 { | 3318 { |
3315 /* This function can GC */ | 3319 /* This function can GC */ |
3316 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 3320 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
3317 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 3321 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
3318 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 3322 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
3406 } | 3410 } |
3407 | 3411 |
3408 static void | 3412 static void |
3409 cursor_font_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 3413 cursor_font_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
3410 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 3414 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
3411 int dest_mask) | 3415 int dest_mask, Lisp_Object domain) |
3412 { | 3416 { |
3413 /* This function can GC */ | 3417 /* This function can GC */ |
3414 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 3418 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
3415 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 3419 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
3416 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 3420 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |