#ifdef USE_X11
#include <math.h>
-
+#include "main/x11-gamma-builder.h"
/*
* This file defines some "XImage" manipulation functions for X11.
/*
* Hack -- Convert an RGB value to an X11 Pixel, or die.
*/
+#ifdef USE_XFT
+static XftColor create_pixel(Display *dpy, byte red, byte green, byte blue)
+#else
static unsigned long create_pixel(Display *dpy, byte red, byte green, byte blue)
+#endif
{
Colormap cmap = DefaultColormapOfScreen(DefaultScreenOfDisplay(dpy));
XColor xcolour;
xcolour.blue = blue * 255;
xcolour.flags = DoRed | DoGreen | DoBlue;
+#ifdef USE_XFT
+ XftColor color;
+ XRenderColor xcol;
+ xcol.red = xcolour.red;
+ xcol.green = xcolour.green;
+ xcol.blue = xcolour.blue;
+ if (!XftColorAllocValue(dpy, DefaultVisual(dpy, 0), cmap, &xcol, &color))
+ {
+ quit_fmt("Couldn't allocate bitmap color '#%02x%02x%02x'\n",
+ red, green, blue);
+ }
+
+ return color;
+#else
/* Attempt to Allocate the Parsed color */
if (!(XAllocColor(dpy, cmap, &xcolour)))
{
}
return (xcolour.pixel);
+#endif
}
+#ifndef USE_XFT
/*
* The Win32 "BITMAPFILEHEADER" type.
return Tmp;
}
+#endif /* !USE_XFT */
+
#endif /* USE_X11 */