}
/* I get only 1 plane but 8 bits per pixel,
- so I think BITSPIXEL should be depth */
-int
+ so I think BITSPIXEL should be depth
+
+ TRS: I assume that all "displays" have the same number of
+ planes later in the code, which is based on the assumption
+ that the display variable is ignored below. :)
+ */
+int
XDefaultDepth(Display *display, Screen *screen)
{
int d, b;
+#if !defined(__VISAGECPP__) /* fisme for OS/2 */
b = GetDeviceCaps(*display, BITSPIXEL);
d = GetDeviceCaps(*display, PLANES);
+#endif
return (b);
}
/* convert hex color names,
wrong digits (not a-f,A-F,0-9) are treated as zero */
-static int
+static int
hexCharToInt(char c)
{
int r;
return (r);
}
-static int
+static int
rgbFromHex(char *hex, int *r, int *g, int *b)
{
int len;
}
/* Color related functions */
-int
+int
XParseColor(Display *d, Colormap *cmap, char *name, XColor *color)
{
int r, g, b; /* only 8 bit values used */
}
if (okay) {
+#if !defined(__VISAGECPP__) /* fixme for OS/2 */
color->pixel = RGB(r, g, b);
+#endif
color->red = (BYTE) r;
color->green = (BYTE) g;
color->blue = (BYTE) b;
}
-int
+int
XAllocColor(Display *d, Colormap *cmap, XColor *color)
{
/* colormap not used yet so color->pixel is the real COLORREF (RBG) and not an
index in some colormap as in X */
return (1);
}
-void
+void
XQueryColors(Display *display, Colormap *colormap,
XColor *xcolors, int ncolors)
{
XColor *xc = xcolors;
int i;
+#if !defined(__VISAGECPP__) /* fixme for OS/2 */
for (i = 0; i < ncolors; i++, xc++) {
xc->red = GetRValue(xc->pixel);
xc->green = GetGValue(xc->pixel);
xc->blue = GetBValue(xc->pixel);
}
+#endif
return;
}
-int
+int
XFreeColors(Display *d, Colormap cmap,
unsigned long pixels[], int npixels, unsigned long planes)
{
if (img) {
/* *img = CreateCompatibleBitmap(*d, width, height); */
- img->bitmap = CreateBitmap(width, height, 1 /* plane */ ,
+
+#if !defined(__VISAGECPP__) /* fixme for OS/2 */
+ /* create the bitmap with the same number of planes as the default display
+ * (otherwise it wouldn't work for 16 color mode) */
+ img->bitmap = CreateBitmap(width, height,
+ GetDeviceCaps(*d, PLANES),
depth /* bits per pixel */ , NULL);
+#endif
img->width = width;
img->height = height;
img->depth = depth;
}
-void
+void
XImageFree(XImage *img)
{
if (img) {
XpmFree(img);
}
}
-void
+void
XDestroyImage(XImage *img)
{
if (img) {
+#if !defined(__VISAGECPP__) /* fixme for OS/2 */
DeleteObject(img->bitmap); /* check return ??? */
+#endif
XImageFree(img);
}
}