diff options
| author | Gerd Moellmann | 2000-10-16 19:57:04 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-10-16 19:57:04 +0000 |
| commit | be0b1fac0ae5eb99c8782fe3d22af9db1478f5f9 (patch) | |
| tree | b71a113d0d93f322badeb0f1ef29be5e9a2122b4 /src | |
| parent | dbf1fcc12018b71e349f3410561c1df89e1c6e54 (diff) | |
| download | emacs-be0b1fac0ae5eb99c8782fe3d22af9db1478f5f9.tar.gz emacs-be0b1fac0ae5eb99c8782fe3d22af9db1478f5f9.zip | |
(pbm_format): Add :foreground and :background keywords.
(PBM_FOREGROUND, PBM_BACKGROUND): New enumerators.
(xbm_load): Recoghnize foreground and background color
specifications.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/xfns.c b/src/xfns.c index 4c53ccb85ae..0bc3c3935e2 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -7907,6 +7907,8 @@ enum pbm_keyword_index | |||
| 7907 | PBM_ALGORITHM, | 7907 | PBM_ALGORITHM, |
| 7908 | PBM_HEURISTIC_MASK, | 7908 | PBM_HEURISTIC_MASK, |
| 7909 | PBM_MASK, | 7909 | PBM_MASK, |
| 7910 | PBM_FOREGROUND, | ||
| 7911 | PBM_BACKGROUND, | ||
| 7910 | PBM_LAST | 7912 | PBM_LAST |
| 7911 | }; | 7913 | }; |
| 7912 | 7914 | ||
| @@ -7923,7 +7925,9 @@ static struct image_keyword pbm_format[PBM_LAST] = | |||
| 7923 | {":relief", IMAGE_INTEGER_VALUE, 0}, | 7925 | {":relief", IMAGE_INTEGER_VALUE, 0}, |
| 7924 | {":algorithm", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, | 7926 | {":algorithm", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
| 7925 | {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, | 7927 | {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
| 7926 | {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0} | 7928 | {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
| 7929 | {":foreground", IMAGE_STRING_VALUE, 0}, | ||
| 7930 | {":background", IMAGE_STRING_VALUE, 0} | ||
| 7927 | }; | 7931 | }; |
| 7928 | 7932 | ||
| 7929 | /* Structure describing the image type `pbm'. */ | 7933 | /* Structure describing the image type `pbm'. */ |
| @@ -8112,6 +8116,19 @@ pbm_load (f, img) | |||
| 8112 | if (type == PBM_MONO) | 8116 | if (type == PBM_MONO) |
| 8113 | { | 8117 | { |
| 8114 | int c = 0, g; | 8118 | int c = 0, g; |
| 8119 | struct image_keyword fmt[PBM_LAST]; | ||
| 8120 | unsigned long fg = FRAME_FOREGROUND_PIXEL (f); | ||
| 8121 | unsigned long bg = FRAME_BACKGROUND_PIXEL (f); | ||
| 8122 | |||
| 8123 | /* Parse the image specification. */ | ||
| 8124 | bcopy (pbm_format, fmt, sizeof fmt); | ||
| 8125 | parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm); | ||
| 8126 | |||
| 8127 | /* Get foreground and background colors, maybe allocate colors. */ | ||
| 8128 | if (fmt[PBM_FOREGROUND].count) | ||
| 8129 | fg = x_alloc_image_color (f, img, fmt[PBM_FOREGROUND].value, fg); | ||
| 8130 | if (fmt[PBM_BACKGROUND].count) | ||
| 8131 | bg = x_alloc_image_color (f, img, fmt[PBM_BACKGROUND].value, bg); | ||
| 8115 | 8132 | ||
| 8116 | for (y = 0; y < height; ++y) | 8133 | for (y = 0; y < height; ++y) |
| 8117 | for (x = 0; x < width; ++x) | 8134 | for (x = 0; x < width; ++x) |
| @@ -8126,9 +8143,7 @@ pbm_load (f, img) | |||
| 8126 | else | 8143 | else |
| 8127 | g = pbm_scan_number (&p, end); | 8144 | g = pbm_scan_number (&p, end); |
| 8128 | 8145 | ||
| 8129 | XPutPixel (ximg, x, y, (g | 8146 | XPutPixel (ximg, x, y, g ? fg : bg); |
| 8130 | ? FRAME_FOREGROUND_PIXEL (f) | ||
| 8131 | : FRAME_BACKGROUND_PIXEL (f))); | ||
| 8132 | } | 8147 | } |
| 8133 | } | 8148 | } |
| 8134 | else | 8149 | else |