diff options
| author | Gerd Moellmann | 2001-04-03 15:31:08 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-04-03 15:31:08 +0000 |
| commit | ad18ffb15b8e9290c4ef52c2d0436be10cc89911 (patch) | |
| tree | e3af2dd73a7626559f4f09cb689e567da15d2d92 /src | |
| parent | 24d451c54138183d78966e7e77f6c2f3e57b2751 (diff) | |
| download | emacs-ad18ffb15b8e9290c4ef52c2d0436be10cc89911.tar.gz emacs-ad18ffb15b8e9290c4ef52c2d0436be10cc89911.zip | |
(postprocess_image): New function.
(lookup_image): Call it for all image types except PostScript.
(x_kill_gs_process): Call postprocess_image.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/xfns.c | 153 |
2 files changed, 92 insertions, 65 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6555aca1264..28515da69a9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2001-04-03 Gerd Moellmann <gerd@gnu.org> | 1 | 2001-04-03 Gerd Moellmann <gerd@gnu.org> |
| 2 | 2 | ||
| 3 | * xfns.c (postprocess_image): New function. | ||
| 4 | (lookup_image): Call it for all image types except PostScript. | ||
| 5 | (x_kill_gs_process): Call postprocess_image. | ||
| 6 | |||
| 3 | * xterm.c (x_use_underline_position_properties): New variable. | 7 | * xterm.c (x_use_underline_position_properties): New variable. |
| 4 | (x_draw_glyph_string): Use it. | 8 | (x_draw_glyph_string): Use it. |
| 5 | (syms_of_xterm): DEFVAR_BOOL it. | 9 | (syms_of_xterm): DEFVAR_BOOL it. |
diff --git a/src/xfns.c b/src/xfns.c index ddd158ed98a..37663e35e09 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -5788,6 +5788,7 @@ x_alloc_image_color (f, img, color_name, dflt) | |||
| 5788 | ***********************************************************************/ | 5788 | ***********************************************************************/ |
| 5789 | 5789 | ||
| 5790 | static void cache_image P_ ((struct frame *f, struct image *img)); | 5790 | static void cache_image P_ ((struct frame *f, struct image *img)); |
| 5791 | static void postprocess_image P_ ((struct frame *, struct image *)); | ||
| 5791 | 5792 | ||
| 5792 | 5793 | ||
| 5793 | /* Return a new, initialized image cache that is allocated from the | 5794 | /* Return a new, initialized image cache that is allocated from the |
| @@ -5919,6 +5920,81 @@ FRAME t means clear the image caches of all frames.") | |||
| 5919 | } | 5920 | } |
| 5920 | 5921 | ||
| 5921 | 5922 | ||
| 5923 | /* Compute masks and transform image IMG on frame F, as specified | ||
| 5924 | by the image's specification, */ | ||
| 5925 | |||
| 5926 | static void | ||
| 5927 | postprocess_image (f, img) | ||
| 5928 | struct frame *f; | ||
| 5929 | struct image *img; | ||
| 5930 | { | ||
| 5931 | /* Manipulation of the image's mask. */ | ||
| 5932 | if (img->pixmap) | ||
| 5933 | { | ||
| 5934 | Lisp_Object conversion, spec; | ||
| 5935 | Lisp_Object mask; | ||
| 5936 | |||
| 5937 | spec = img->spec; | ||
| 5938 | |||
| 5939 | /* `:heuristic-mask t' | ||
| 5940 | `:mask heuristic' | ||
| 5941 | means build a mask heuristically. | ||
| 5942 | `:heuristic-mask (R G B)' | ||
| 5943 | `:mask (heuristic (R G B))' | ||
| 5944 | means build a mask from color (R G B) in the | ||
| 5945 | image. | ||
| 5946 | `:mask nil' | ||
| 5947 | means remove a mask, if any. */ | ||
| 5948 | |||
| 5949 | mask = image_spec_value (spec, QCheuristic_mask, NULL); | ||
| 5950 | if (!NILP (mask)) | ||
| 5951 | x_build_heuristic_mask (f, img, mask); | ||
| 5952 | else | ||
| 5953 | { | ||
| 5954 | int found_p; | ||
| 5955 | |||
| 5956 | mask = image_spec_value (spec, QCmask, &found_p); | ||
| 5957 | |||
| 5958 | if (EQ (mask, Qheuristic)) | ||
| 5959 | x_build_heuristic_mask (f, img, Qt); | ||
| 5960 | else if (CONSP (mask) | ||
| 5961 | && EQ (XCAR (mask), Qheuristic)) | ||
| 5962 | { | ||
| 5963 | if (CONSP (XCDR (mask))) | ||
| 5964 | x_build_heuristic_mask (f, img, XCAR (XCDR (mask))); | ||
| 5965 | else | ||
| 5966 | x_build_heuristic_mask (f, img, XCDR (mask)); | ||
| 5967 | } | ||
| 5968 | else if (NILP (mask) && found_p && img->mask) | ||
| 5969 | { | ||
| 5970 | XFreePixmap (FRAME_X_DISPLAY (f), img->mask); | ||
| 5971 | img->mask = None; | ||
| 5972 | } | ||
| 5973 | } | ||
| 5974 | |||
| 5975 | |||
| 5976 | /* Should we apply an image transformation algorithm? */ | ||
| 5977 | conversion = image_spec_value (spec, QCconversion, NULL); | ||
| 5978 | if (EQ (conversion, Qdisabled)) | ||
| 5979 | x_disable_image (f, img); | ||
| 5980 | else if (EQ (conversion, Qlaplace)) | ||
| 5981 | x_laplace (f, img); | ||
| 5982 | else if (EQ (conversion, Qemboss)) | ||
| 5983 | x_emboss (f, img); | ||
| 5984 | else if (CONSP (conversion) | ||
| 5985 | && EQ (XCAR (conversion), Qedge_detection)) | ||
| 5986 | { | ||
| 5987 | Lisp_Object tem; | ||
| 5988 | tem = XCDR (conversion); | ||
| 5989 | if (CONSP (tem)) | ||
| 5990 | x_edge_detection (f, img, | ||
| 5991 | Fplist_get (tem, QCmatrix), | ||
| 5992 | Fplist_get (tem, QCcolor_adjustment)); | ||
| 5993 | } | ||
| 5994 | } | ||
| 5995 | } | ||
| 5996 | |||
| 5997 | |||
| 5922 | /* Return the id of image with Lisp specification SPEC on frame F. | 5998 | /* Return the id of image with Lisp specification SPEC on frame F. |
| 5923 | SPEC must be a valid Lisp image specification (see valid_image_p). */ | 5999 | SPEC must be a valid Lisp image specification (see valid_image_p). */ |
| 5924 | 6000 | ||
| @@ -5952,6 +6028,8 @@ lookup_image (f, spec) | |||
| 5952 | /* If not found, create a new image and cache it. */ | 6028 | /* If not found, create a new image and cache it. */ |
| 5953 | if (img == NULL) | 6029 | if (img == NULL) |
| 5954 | { | 6030 | { |
| 6031 | extern Lisp_Object Qpostscript; | ||
| 6032 | |||
| 5955 | BLOCK_INPUT; | 6033 | BLOCK_INPUT; |
| 5956 | img = make_image (spec, hash); | 6034 | img = make_image (spec, hash); |
| 5957 | cache_image (f, img); | 6035 | cache_image (f, img); |
| @@ -6003,71 +6081,10 @@ lookup_image (f, spec) | |||
| 6003 | img->vmargin += abs (img->relief); | 6081 | img->vmargin += abs (img->relief); |
| 6004 | } | 6082 | } |
| 6005 | 6083 | ||
| 6006 | /* Manipulation of the image's mask. */ | 6084 | /* Do image transformations and compute masks, unless we |
| 6007 | if (img->pixmap) | 6085 | don't have the image yet. */ |
| 6008 | { | 6086 | if (!EQ (*img->type->type, Qpostscript)) |
| 6009 | /* `:heuristic-mask t' | 6087 | postprocess_image (f, img); |
| 6010 | `:mask heuristic' | ||
| 6011 | means build a mask heuristically. | ||
| 6012 | `:heuristic-mask (R G B)' | ||
| 6013 | `:mask (heuristic (R G B))' | ||
| 6014 | means build a mask from color (R G B) in the | ||
| 6015 | image. | ||
| 6016 | `:mask nil' | ||
| 6017 | means remove a mask, if any. */ | ||
| 6018 | |||
| 6019 | Lisp_Object mask; | ||
| 6020 | |||
| 6021 | mask = image_spec_value (spec, QCheuristic_mask, NULL); | ||
| 6022 | if (!NILP (mask)) | ||
| 6023 | x_build_heuristic_mask (f, img, mask); | ||
| 6024 | else | ||
| 6025 | { | ||
| 6026 | int found_p; | ||
| 6027 | |||
| 6028 | mask = image_spec_value (spec, QCmask, &found_p); | ||
| 6029 | |||
| 6030 | if (EQ (mask, Qheuristic)) | ||
| 6031 | x_build_heuristic_mask (f, img, Qt); | ||
| 6032 | else if (CONSP (mask) | ||
| 6033 | && EQ (XCAR (mask), Qheuristic)) | ||
| 6034 | { | ||
| 6035 | if (CONSP (XCDR (mask))) | ||
| 6036 | x_build_heuristic_mask (f, img, XCAR (XCDR (mask))); | ||
| 6037 | else | ||
| 6038 | x_build_heuristic_mask (f, img, XCDR (mask)); | ||
| 6039 | } | ||
| 6040 | else if (NILP (mask) && found_p && img->mask) | ||
| 6041 | { | ||
| 6042 | XFreePixmap (FRAME_X_DISPLAY (f), img->mask); | ||
| 6043 | img->mask = None; | ||
| 6044 | } | ||
| 6045 | } | ||
| 6046 | } | ||
| 6047 | |||
| 6048 | /* Should we apply an image transformation algorithm? */ | ||
| 6049 | if (img->pixmap) | ||
| 6050 | { | ||
| 6051 | Lisp_Object conversion; | ||
| 6052 | |||
| 6053 | conversion = image_spec_value (spec, QCconversion, NULL); | ||
| 6054 | if (EQ (conversion, Qdisabled)) | ||
| 6055 | x_disable_image (f, img); | ||
| 6056 | else if (EQ (conversion, Qlaplace)) | ||
| 6057 | x_laplace (f, img); | ||
| 6058 | else if (EQ (conversion, Qemboss)) | ||
| 6059 | x_emboss (f, img); | ||
| 6060 | else if (CONSP (conversion) | ||
| 6061 | && EQ (XCAR (conversion), Qedge_detection)) | ||
| 6062 | { | ||
| 6063 | Lisp_Object tem; | ||
| 6064 | tem = XCDR (conversion); | ||
| 6065 | if (CONSP (tem)) | ||
| 6066 | x_edge_detection (f, img, | ||
| 6067 | Fplist_get (tem, QCmatrix), | ||
| 6068 | Fplist_get (tem, QCcolor_adjustment)); | ||
| 6069 | } | ||
| 6070 | } | ||
| 6071 | } | 6088 | } |
| 6072 | 6089 | ||
| 6073 | UNBLOCK_INPUT; | 6090 | UNBLOCK_INPUT; |
| @@ -10092,6 +10109,12 @@ x_kill_gs_process (pixmap, f) | |||
| 10092 | 10109 | ||
| 10093 | UNBLOCK_INPUT; | 10110 | UNBLOCK_INPUT; |
| 10094 | } | 10111 | } |
| 10112 | |||
| 10113 | /* Now that we have the pixmap, compute mask and transform the | ||
| 10114 | image if requested. */ | ||
| 10115 | BLOCK_INPUT; | ||
| 10116 | postprocess_image (f, img); | ||
| 10117 | UNBLOCK_INPUT; | ||
| 10095 | } | 10118 | } |
| 10096 | 10119 | ||
| 10097 | 10120 | ||