/*
- * Copyright (C) 1989-94 GROUPE BULL
+ * Copyright (C) 1989-95 GROUPE BULL
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* Developed by HeDu 3/94 (hedu@cul-ipn.uni-kiel.de) *
\*****************************************************************************/
-#include "xpm34.h"
+/* Moved here so that FOR_MSW gets defined if we are using wxWindows (GRG) */
+#include "xpm.h"
#ifdef FOR_MSW
-#include "xpm34p.h" /* for XpmMalloc */
+#include "xpmi.h" /* for XpmMalloc */
/*
* On DOS size_t is only 2 bytes, thus malloc(size_t s) can only malloc
/* I get only 1 plane but 8 bits per pixel,
so I think BITSPIXEL should be depth */
-int
+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
-hexCharToInt(char c)
+static int
+hexCharToInt(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
+/* GRG: 2nd arg is Colormap*, not Colormap */
+
+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)
{
XImage *img = (XImage *) XpmMalloc(sizeof(XImage));
if (img) {
- /* *img = CreateCompatibleBitmap(*d, width, height); */
-#if !defined(__VISAGECPP__) /* fixme for OS/2 */
- img->bitmap = CreateBitmap(width, height, 1 /* plane */ ,
- depth /* bits per pixel */ , NULL);
-#endif
+ /*JW: This is what it should be, but the picture comes out
+ just black!? It appears to be doing monochrome reduction,
+ but I've got no clue why. Using CreateBitmap() is supposed
+ to be slower, but otherwise ok
+ if ( depth == GetDeviceCaps(*d, BITSPIXEL) ) {
+ img->bitmap = CreateCompatibleBitmap(*d, width, height);
+ } else*/ {
+ img->bitmap = CreateBitmap(width, height, 1 /* plane */ ,
+ depth /* bits per pixel */ , NULL);
+ }
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);
}
}