XDrawPoint (display, (Window) win, gc, x + j, y + i);
}
+void
+mwin__draw_pixmap (MFrame *frame, MDrawWindow win, MRealizedFace *rface,
+ int reverse, int x, int y,
+ int width, int height, int row_bytes, unsigned char *pmp,
+ MDrawRegion region)
+{
+ Display *display = FRAME_DISPLAY (frame);
+ int i, j;
+ GC *gcs = rface->info;
+ GC gc = gcs[reverse ? MFACE_GC_INVERSE : MFACE_GC_NORMAL];
+ unsigned long valuemask = GCForeground | GCBackground;
+ XGCValues values;
+ XColor fore_color, back_color, color;
+
+ if (region)
+ gc = set_region (FRAME_DISPLAY (frame), rface, gc, region);
+
+ XGetGCValues (FRAME_DISPLAY (frame), gc, valuemask, &values);
+ fore_color.pixel = values.foreground;
+ back_color.pixel = values.background;
+ XQueryColor (FRAME_DISPLAY (frame), frame->device->cmap, &fore_color);
+ XQueryColor (FRAME_DISPLAY (frame), frame->device->cmap, &back_color);
+
+ for (i = 0; i < height; i++, pmp += row_bytes)
+ for (j = 0; j < width; j++)
+ if (pmp[j])
+ {
+ float ratio = (float) (pmp[j] >> 5) / 32;
+
+ color = fore_color;
+ color.red = fore_color.red * ratio + back_color.red * (1 - ratio);
+ color.green = fore_color.green * ratio + back_color.green * (1 - ratio);
+ color.blue = fore_color.blue * ratio + back_color.blue * (1 - ratio);
+ if (XAllocColor (FRAME_DISPLAY (frame), frame->device->cmap, &color)
+ && fore_color.pixel != color.pixel)
+ {
+ XSetForeground (FRAME_DISPLAY (frame), gc, color.pixel);
+ fore_color.pixel = color.pixel;
+ }
+ XDrawPoint (display, (Window) win, gc, x + j, y + i);
+ }
+ if (fore_color.pixel != values.foreground)
+ XSetForeground (FRAME_DISPLAY (frame), gc, values.foreground);
+}
+
MDrawRegion
mwin__region_from_rect (MDrawMetric *rect)