comparison src/glyphs-x.c @ 371:cc15677e0335 r21-2b1

Import from CVS: tag r21-2b1
author cvs
date Mon, 13 Aug 2007 11:03:08 +0200
parents 4711e16a8e49
children 6240c7796c7a
comparison
equal deleted inserted replaced
370:bd866891f083 371:cc15677e0335
37 Pointer/icon overhaul, more restructuring by Ben Wing for 19.14 37 Pointer/icon overhaul, more restructuring by Ben Wing for 19.14
38 GIF support changed to external GIFlib 3.1 by Jareth Hein for 21.0 38 GIF support changed to external GIFlib 3.1 by Jareth Hein for 21.0
39 Many changes for color work and optimizations by Jareth Hein for 21.0 39 Many changes for color work and optimizations by Jareth Hein for 21.0
40 Switch of GIF/JPEG/PNG to new EImage intermediate code by Jareth Hein for 21.0 40 Switch of GIF/JPEG/PNG to new EImage intermediate code by Jareth Hein for 21.0
41 TIFF code by Jareth Hein for 21.0 41 TIFF code by Jareth Hein for 21.0
42 GIF/JPEG/PNG/TIFF code moved to new glyph-eimage.c for 21.0
43 42
44 TODO: 43 TODO:
45 Support the GrayScale, StaticColor and StaticGray visual classes.
46 Convert images.el to C and stick it in here? 44 Convert images.el to C and stick it in here?
47 */ 45 */
48 46
49 #include <config.h> 47 #include <config.h>
50 #include "lisp.h" 48 #include "lisp.h"
132 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); 130 dpy = DEVICE_X_DISPLAY (XDEVICE (device));
133 cmap = DEVICE_X_COLORMAP (XDEVICE(device)); 131 cmap = DEVICE_X_COLORMAP (XDEVICE(device));
134 vis = DEVICE_X_VISUAL (XDEVICE(device)); 132 vis = DEVICE_X_VISUAL (XDEVICE(device));
135 depth = DEVICE_X_DEPTH(XDEVICE(device)); 133 depth = DEVICE_X_DEPTH(XDEVICE(device));
136 134
137 if (vis->class == GrayScale || vis->class == StaticColor ||
138 vis->class == StaticGray)
139 {
140 /* #### Implement me!!! */
141 return NULL;
142 }
143
144 if (vis->class == PseudoColor) 135 if (vis->class == PseudoColor)
145 { 136 {
146 /* Quantize the image and get a histogram while we're at it. 137 /* Quantize the image and get a histogram while we're at it.
147 Do this first to save memory */ 138 Do this first to save memory */
148 qtable = build_EImage_quantable(pic, width, height, 256); 139 qtable = build_EImage_quantable(pic, width, height, 256);
150 } 141 }
151 142
152 bitmap_pad = ((depth > 16) ? 32 : 143 bitmap_pad = ((depth > 16) ? 32 :
153 (depth > 8) ? 16 : 144 (depth > 8) ? 16 :
154 8); 145 8);
146 byte_cnt = bitmap_pad >> 3;
155 147
156 outimg = XCreateImage (dpy, vis, 148 outimg = XCreateImage (dpy, vis,
157 depth, ZPixmap, 0, 0, width, height, 149 depth, ZPixmap, 0, 0, width, height,
158 bitmap_pad, 0); 150 bitmap_pad, 0);
159 if (!outimg) return NULL; 151 if (!outimg) return NULL;
160
161 byte_cnt = outimg->bits_per_pixel >> 3;
162 152
163 data = (unsigned char *) xmalloc (outimg->bytes_per_line * height); 153 data = (unsigned char *) xmalloc (outimg->bytes_per_line * height);
164 if (!data) 154 if (!data)
165 { 155 {
166 XDestroyImage (outimg); 156 XDestroyImage (outimg);