#include "xpm.h"
#include "xpmi.h" /* for XpmMalloc */
-
+#include "rgbtab.h"
#ifdef FOR_MSW
/*
*r = hexCharToInt(hex[1]);
*g = hexCharToInt(hex[2]);
*b = hexCharToInt(hex[3]);
- #ifdef macintosh
+ #if defined(macintosh) || defined(__APPLE__)
*r <<= 12 ;
*g <<= 12 ;
*b <<= 12 ;
*r = hexCharToInt(hex[1]) * 16 + hexCharToInt(hex[2]);
*g = hexCharToInt(hex[3]) * 16 + hexCharToInt(hex[4]);
*b = hexCharToInt(hex[5]) * 16 + hexCharToInt(hex[6]);
- #ifdef macintosh
+ #if defined(macintosh) || defined(__APPLE__)
*r <<= 8 ;
*g <<= 8 ;
*b <<= 8 ;
} else if (len == 12 + 1)
{
/* it's like c #32329999CCCC */
- #ifdef macintosh
+ #if defined(macintosh) || defined(__APPLE__)
*r = hexCharToInt(hex[1]) * 0x1000 + hexCharToInt(hex[2]) *0x0100 + hexCharToInt(hex[3]) *0x0010 + hexCharToInt(hex[4]) ;
*g = hexCharToInt(hex[5]) * 0x1000 + hexCharToInt(hex[6]) *0x0100 + hexCharToInt(hex[7]) *0x0010 + hexCharToInt(hex[8]);
*b =hexCharToInt(hex[9]) * 0x1000 + hexCharToInt(hex[10]) *0x0100 + hexCharToInt(hex[11]) *0x0010 + hexCharToInt(hex[12]);
color->red = (BYTE) r;
color->green = (BYTE) g;
color->blue = (BYTE) b;
- #elif macintosh
+ #elif defined(macintosh) || defined(__APPLE__)
color->pixel.red = r ;
color->pixel.green = g ;
color->pixel.blue = b ;
}
int
XFreeColors(Display *d, Colormap cmap,
- unsigned long pixels[], int npixels, unsigned long planes)
+ Pixel *pixels, int npixels, unsigned long planes)
{
/* no colormap yet */
return (0); /* correct ??? */
img->bitmap = CreateBitmap(width, height, 1 /* plane */ ,
depth /* bits per pixel */ , NULL);
}
- #elif macintosh
+ #elif defined(macintosh) || defined(__APPLE__)
Rect rect ;
rect.left= rect.top = 0 ;
rect.bottom = height ;
NewGWorld( &img->gworldptr , depth , &rect , NULL , NULL , 0 ) ;
+ LockPixels( GetGWorldPixMap( img->gworldptr ) ) ;
if (img->gworldptr == NULL)
{
XDestroyImage (img);
if (img) {
#if FOR_MSW
DeleteObject(img->bitmap); /* check return ??? */
- #elif macintosh
+ #elif defined(macintosh) || defined(__APPLE__)
if ( img->gworldptr )
+ {
+ UnlockPixels( GetGWorldPixMap( img->gworldptr ) ) ;
DisposeGWorld( img->gworldptr ) ;
+ }
#endif
XImageFree(img);
}