X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e6ed776fb2d330b4b6d0105c3628ccf88fd3bb60..89fcec9514fd890de58da83118363570e2482bc9:/src/xpm/create.c diff --git a/src/xpm/create.c b/src/xpm/create.c index ebd6951303..a667eb8f75 100644 --- a/src/xpm/create.c +++ b/src/xpm/create.c @@ -153,9 +153,14 @@ FUNC(xpmstrcasecmp, int, (char *s1, char *s2)); * in case strcasecmp is not provided by the system here is one * which does the trick */ +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +int xpmstrcasecmp(register char* s1, register char* s2) +#else int xpmstrcasecmp(s1, s2) register char *s1, *s2; +#endif { register int c1, c2; @@ -175,9 +180,14 @@ xpmstrcasecmp(s1, s2) /* * return the default color key related to the given visual */ +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static int xpmVisualType(Visual* visual) +#else static int xpmVisualType(visual) Visual *visual; +#endif { #ifndef FOR_MSW # ifndef AMIGA @@ -211,21 +221,32 @@ typedef struct { long closeness; } CloseColor; -static int -closeness_cmp(a, b) - Const void *a, *b; +#ifndef FOR_MSW +static int closeness_cmp(Const void* a, Const void* b) { CloseColor *x = (CloseColor *) a, *y = (CloseColor *) b; /* cast to int as qsort requires */ return (int) (x->closeness - y->closeness); } +#endif /* default AllocColor function: * call XParseColor if colorname is given, return negative value if failure * call XAllocColor and return 0 if failure, positive otherwise */ +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static int +AllocColor( + Display* display +, Colormap colormap +, char* colorname +, XColor* xcolor +, void* closure +) +#else static int AllocColor(display, colormap, colorname, xcolor, closure) Display *display; @@ -233,12 +254,19 @@ AllocColor(display, colormap, colorname, xcolor, closure) char *colorname; XColor *xcolor; void *closure; /* not used */ +#endif { int status; if (colorname) +#ifdef __OS2__ + if (!XParseColor(display, &colormap, colorname, xcolor)) + return -1; + status = XAllocColor(display, &colormap, xcolor); +#else if (!XParseColor(display, colormap, colorname, xcolor)) return -1; status = XAllocColor(display, colormap, xcolor); +#endif return status != 0 ? 1 : 0; } @@ -304,17 +332,17 @@ SetCloseColor(display, colormap, visual, col, image_pixel, mask_pixel, * occurred, so we try the next closest color, and so on, until no more * colors are within closeness of the target. If we knew that the * colormap had changed, we could skip this sequence. - * + * * If _none_ of the colors within closeness of the target can be allocated, * then we can finally be pretty sure that the colormap has actually * changed. In this case we try to allocate the original color (again), * then try the closecolor stuff (again)... - * + * * In theory it would be possible for an infinite loop to occur if another * process kept changing the colormap every time we sorted it, so we set * a maximum on the number of iterations. After this many tries, we use * XGrabServer() to ensure that the colormap remains unchanged. - * + * * This approach gives particularly bad worst case performance - as many as * colormap reads and sorts may be needed, and as * many as * attempted allocations @@ -434,6 +462,29 @@ SetCloseColor(display, colormap, visual, col, image_pixel, mask_pixel, * return 0 if success, 1 otherwise. */ +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static int +SetColor( + Display* display +, Colormap colormap +, Visual* visual +, char* colorname +, unsigned int color_index +, Pixel* image_pixel +, Pixel* mask_pixel +, unsigned int* mask_pixel_index +, Pixel* alloc_pixels +, unsigned int* nalloc_pixels +, Pixel* used_pixels +, unsigned int* nused_pixels +, XpmAttributes* attributes +, XColor* cols +, int ncols +, XpmAllocColorFunc allocColor +, void* closure +) +#else static int SetColor(display, colormap, visual, colorname, color_index, image_pixel, mask_pixel, mask_pixel_index, @@ -455,6 +506,7 @@ SetColor(display, colormap, visual, colorname, color_index, int ncols; XpmAllocColorFunc allocColor; void *closure; +#endif { XColor xcolor; int status; @@ -480,8 +532,12 @@ SetColor(display, colormap, visual, colorname, color_index, *image_pixel = xcolor.pixel; #ifndef FOR_MSW *mask_pixel = 1; +#else +#ifdef __OS2__ + *mask_pixel = OS2RGB(0,0,0); #else *mask_pixel = RGB(0,0,0); +#endif #endif used_pixels[(*nused_pixels)++] = xcolor.pixel; } else { @@ -489,7 +545,11 @@ SetColor(display, colormap, visual, colorname, color_index, #ifndef FOR_MSW *mask_pixel = 0; #else - *mask_pixel = RGB(255,255,255); +#ifdef __OS2__ + *mask_pixel = OS2RGB(255,255,255); +#else + *mask_pixel = RGB(255,255,255); +#endif #endif /* store the color table index */ *mask_pixel_index = color_index; @@ -497,7 +557,23 @@ SetColor(display, colormap, visual, colorname, color_index, return (0); } - +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static int +CreateColors( + Display* display +, XpmAttributes* attributes +, XpmColor* colors +, unsigned int ncolors +, Pixel* image_pixels +, Pixel* mask_pixels +, unsigned int* mask_pixel_index +, Pixel* alloc_pixels +, unsigned int* nalloc_pixels +, Pixel* used_pixels +, unsigned int* nused_pixels +) +#else static int CreateColors(display, attributes, colors, ncolors, image_pixels, mask_pixels, mask_pixel_index, alloc_pixels, nalloc_pixels, @@ -513,6 +589,7 @@ CreateColors(display, attributes, colors, ncolors, image_pixels, mask_pixels, unsigned int *nalloc_pixels; Pixel *used_pixels; unsigned int *nused_pixels; +#endif { /* variables stored in the XpmAttributes structure */ Visual *visual; @@ -730,6 +807,17 @@ CreateColors(display, attributes, colors, ncolors, image_pixels, mask_pixels, /* default FreeColors function, simply call XFreeColors */ +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static int +FreeColors( + Display* display +, Colormap colormap +, Pixel* pixels +, int n +, void* closure +) +#else static int FreeColors(display, colormap, pixels, n, closure) Display *display; @@ -737,6 +825,7 @@ FreeColors(display, colormap, pixels, n, closure) Pixel *pixels; int n; void *closure; /* not used */ +#endif { return XFreeColors(display, colormap, pixels, n, 0); } @@ -750,6 +839,16 @@ FreeColors(display, colormap, pixels, n, closure) goto error; \ } +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +int XpmCreateImageFromXpmImage( + Display* display +, XpmImage* image +, XImage** image_return +, XImage** shapeimage_return +, XpmAttributes* attributes +) +#else int XpmCreateImageFromXpmImage(display, image, image_return, shapeimage_return, attributes) @@ -758,7 +857,13 @@ XpmCreateImageFromXpmImage(display, image, XImage **image_return; XImage **shapeimage_return; XpmAttributes *attributes; +#endif { +#ifdef __OS2__ + HAB hab = WinQueryAnchorBlock(HWND_DESKTOP); + HPS hps; + SIZEL sizl = {0, 0}; +#endif /* variables stored in the XpmAttributes structure */ Visual *visual; Colormap colormap; @@ -964,6 +1069,18 @@ error: /* * Create an XImage with its data */ +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static int CreateXImage( + Display* display +, Visual* visual +, unsigned int depth +, int format +, unsigned int width +, unsigned int height +, XImage** image_return +) +#else static int CreateXImage(display, visual, depth, format, width, height, image_return) Display *display; @@ -973,6 +1090,7 @@ CreateXImage(display, visual, depth, format, width, height, image_return) unsigned int width; unsigned int height; XImage **image_return; +#endif { int bitmap_pad; @@ -1057,10 +1175,16 @@ static unsigned char Const _reverse_byte[0x100] = { 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff }; +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static int +_XReverse_Bytes(register unsigned char* bpt, register int nb) +#else static int _XReverse_Bytes(bpt, nb) register unsigned char *bpt; register int nb; +#endif { do { *bpt = _reverse_byte[*bpt]; @@ -1070,10 +1194,15 @@ _XReverse_Bytes(bpt, nb) } +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +void xpm_xynormalizeimagebits(register unsigned char* bp, register XImage* img) +#else void xpm_xynormalizeimagebits(bp, img) register unsigned char *bp; register XImage *img; +#endif { register unsigned char c; @@ -1100,10 +1229,15 @@ xpm_xynormalizeimagebits(bp, img) _XReverse_Bytes(bp, img->bitmap_unit >> 3); } +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +void xpm_znormalizeimagebits(register unsigned char* bp, register XImage* img) +#else void xpm_znormalizeimagebits(bp, img) register unsigned char *bp; register XImage *img; +#endif { register unsigned char c; @@ -1145,6 +1279,15 @@ static unsigned char Const _lomask[0x09] = { static unsigned char Const _himask[0x09] = { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00}; +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static void _putbits( + register char* src +, int dstoffset +, register int numbits +, register char* dst +) +#else static void _putbits(src, dstoffset, numbits, dst) register char *src; /* address of source bit string */ @@ -1153,6 +1296,7 @@ _putbits(src, dstoffset, numbits, dst) register int numbits; /* number of bits to copy to * destination */ register char *dst; /* address of destination bit string */ +#endif { register unsigned char chlo, chhi; int hibits; @@ -1193,6 +1337,16 @@ _putbits(src, dstoffset, numbits, dst) * copy the temp back into the destination image data */ +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static void PutImagePixels( +, XImage* image +, unsigned int width +, unsigned int height +, unsigned int* pixelindex +, Pixel* pixels +) +#else static void PutImagePixels(image, width, height, pixelindex, pixels) XImage *image; @@ -1200,6 +1354,7 @@ PutImagePixels(image, width, height, pixelindex, pixels) unsigned int height; unsigned int *pixelindex; Pixel *pixels; +#endif { register char *src; register char *dst; @@ -1280,6 +1435,17 @@ static unsigned long byteorderpixel = MSBFirst << 24; 3.2e code - by default you get the speeded-up version. */ +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static void +PutImagePixels32( +, XImage* image +, unsigned int width +, unsigned int height +, unsigned int* pixelindex +, Pixel* pixels +) +#else static void PutImagePixels32(image, width, height, pixelindex, pixels) XImage *image; @@ -1287,6 +1453,7 @@ PutImagePixels32(image, width, height, pixelindex, pixels) unsigned int height; unsigned int *pixelindex; Pixel *pixels; +#endif { unsigned char *data; unsigned int *iptr; @@ -1390,6 +1557,16 @@ PutImagePixels32(image, width, height, pixelindex, pixels) * write pixels into a 16-bits Z image data structure */ +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static void PutImagePixels16( +, XImage* image +, unsigned int width +, unsigned int height +, unsigned int* pixelindex +, Pixel* pixels +) +#else static void PutImagePixels16(image, width, height, pixelindex, pixels) XImage *image; @@ -1397,6 +1574,7 @@ PutImagePixels16(image, width, height, pixelindex, pixels) unsigned int height; unsigned int *pixelindex; Pixel *pixels; +#endif { unsigned char *data; unsigned int *iptr; @@ -1471,6 +1649,16 @@ PutImagePixels16(image, width, height, pixelindex, pixels) * write pixels into a 8-bits Z image data structure */ +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static void PutImagePixels8( +, XImage* image +, unsigned int width +, unsigned int height +, unsigned int* pixelindex +, Pixel* pixels +) +#else static void PutImagePixels8(image, width, height, pixelindex, pixels) XImage *image; @@ -1478,6 +1666,7 @@ PutImagePixels8(image, width, height, pixelindex, pixels) unsigned int height; unsigned int *pixelindex; Pixel *pixels; +#endif { char *data; unsigned int *iptr; @@ -1518,6 +1707,16 @@ PutImagePixels8(image, width, height, pixelindex, pixels) * write pixels into a 1-bit depth image data structure and **offset null** */ +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static void PutImagePixels1( +, XImage* image +, unsigned int width +, unsigned int height +, unsigned int* pixelindex +, Pixel* pixels +) +#else static void PutImagePixels1(image, width, height, pixelindex, pixels) XImage *image; @@ -1525,6 +1724,7 @@ PutImagePixels1(image, width, height, pixelindex, pixels) unsigned int height; unsigned int *pixelindex; Pixel *pixels; +#endif { if (image->byte_order != image->bitmap_bit_order) PutImagePixels(image, width, height, pixelindex, pixels); @@ -1632,6 +1832,16 @@ PutImagePixels1(image, width, height, pixelindex, pixels) } } +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +int XpmCreatePixmapFromXpmImage( +, Display* display +, Drawable d +, XpmImage* image +, Pixmap* pixmap_return +, Pixmap* shapemask_return +, XpmAttributes* attributes +#else int XpmCreatePixmapFromXpmImage(display, d, image, pixmap_return, shapemask_return, attributes) @@ -1641,6 +1851,7 @@ XpmCreatePixmapFromXpmImage(display, d, image, Pixmap *pixmap_return; Pixmap *shapemask_return; XpmAttributes *attributes; +#endif { XImage *ximage, *shapeimage; int ErrorStatus; @@ -1687,7 +1898,7 @@ APutImagePixels ( unsigned char *array; XImage *tmp_img; BOOL success = FALSE; - + array = XpmMalloc ((((width+15)>>4)<<4)*sizeof (*array)); if (array != NULL) { @@ -1706,7 +1917,7 @@ APutImagePixels ( } XpmFree (array); } - + if (!success) { for (y = 0; y < height; ++y) @@ -1717,6 +1928,18 @@ APutImagePixels ( # endif/* AMIGA */ #else /* FOR_MSW part follows */ + +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static void MSWPutImagePixels( + Display* dc +, XImage* image +, unsigned int width +, unsigned int height +, unsigned int* pixelindex +, Pixel* pixels +) +#else static void MSWPutImagePixels(dc, image, width, height, pixelindex, pixels) Display *dc; @@ -1725,18 +1948,38 @@ MSWPutImagePixels(dc, image, width, height, pixelindex, pixels) unsigned int height; unsigned int *pixelindex; Pixel *pixels; +#endif { unsigned int *data = pixelindex; unsigned int x, y; HBITMAP obm; +#ifdef __OS2__ + POINTL point; + + obm = GpiSetBitmap(*dc, image->bitmap); +#else obm = SelectObject(*dc, image->bitmap); +#endif + for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { +#ifdef __OS2__ + point.x = x; + point.y = y; + GpiSetColor(*dc, (LONG)pixels[*(data++)]); + GpiSetPel(*dc, &point); +#else + SetPixel(*dc, x, y, pixels[*(data++)]); /* data is [x+y*width] */ +#endif } } +#ifdef __OS2__ + GpiSetBitmap(*dc, obm); +#else SelectObject(*dc, obm); +#endif } #endif /* FOR_MSW */ @@ -1870,7 +2113,7 @@ PutPixel16MSB(ximage, x, y, pixel) unsigned long pixel; { unsigned char *addr; - + addr = &((unsigned char *)ximage->data) [ZINDEX16(x, y, ximage)]; addr[0] = pixel >> 8; addr[1] = pixel; @@ -1885,7 +2128,7 @@ PutPixel16LSB(ximage, x, y, pixel) unsigned long pixel; { unsigned char *addr; - + addr = &((unsigned char *)ximage->data) [ZINDEX16(x, y, ximage)]; addr[1] = pixel >> 8; addr[0] = pixel; @@ -1936,6 +2179,18 @@ PutPixel1LSB(ximage, x, y, pixel) /* * This function parses an Xpm file or data and directly create an XImage */ +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +int xpmParseDataAndCreate( + Display* display +, xpmData* data +, XImage** image_return +, XImage** shapeimage_return +, XpmImage* image +, XpmInfo* info +, XpmAttributes* attributes +) +#else int xpmParseDataAndCreate(display, data, image_return, shapeimage_return, image, info, attributes) @@ -1946,6 +2201,7 @@ xpmParseDataAndCreate(display, data, image_return, shapeimage_return, XpmImage *image; XpmInfo *info; XpmAttributes *attributes; +#endif { /* variables stored in the XpmAttributes structure */ Visual *visual; @@ -2275,6 +2531,23 @@ error: return (ErrorStatus); } +#ifdef __OS2__ +/* Visual Age cannot deal with old, non-ansi, code */ +static int ParseAndPutPixels( + Display* dc +, xpmData* data +, unsigned int width +, unsigned int height +, unsigned int ncolors +, unsigned int cpp +, XpmColor* colorTable +, xpmHashTable* hashtable +, XImage* image +, Pixel* image_pixels +, XImage* shapeimage +, Pixel* shape_pixels +) +#else static int ParseAndPutPixels( #ifdef FOR_MSW @@ -2296,8 +2569,15 @@ ParseAndPutPixels( Pixel *image_pixels; XImage *shapeimage; Pixel *shape_pixels; +#endif { unsigned int a, x, y; +#ifdef __OS2__ + HAB hab = WinQueryAnchorBlock(HWND_DESKTOP); + DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL}; + SIZEL sizl = {0, 0}; + POINTL point; +#endif switch (cpp) { @@ -2310,14 +2590,25 @@ ParseAndPutPixels( HBITMAP obm, sobm; if ( shapeimage ) { +#ifdef __OS2__ + shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE); + *dc = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS); + sobm = GpiSetBitmap(*dc, shapeimage->bitmap); +#else shapedc = CreateCompatibleDC(*dc); sobm = SelectObject(shapedc, shapeimage->bitmap); +#endif } else { shapedc = NULL; } +#ifdef __OS2__ + obm = GpiSetBitmap(*dc, image->bitmap); +#else obm = SelectObject(*dc, image->bitmap); #endif +#endif + bzero((char *)colidx, 256 * sizeof(short)); for (a = 0; a < ncolors; a++) @@ -2334,10 +2625,24 @@ ParseAndPutPixels( if (shapeimage) XPutPixel(shapeimage, x, y, shape_pixels[colidx[c] - 1]); +#else +#ifdef __OS2__ + point.x = x; + point.y = y; + GpiSetColor(*dc, (LONG)image_pixels[colidx[c] - 1]); + GpiSetPel(*dc, &point); #else SetPixel(*dc, x, y, image_pixels[colidx[c] - 1]); +#endif if (shapedc) { +#ifdef __OS2__ + point.x = x; + point.y = y; + GpiSetColor(*dc, (LONG)shape_pixels[colidx[c] - 1]); + GpiSetPel(*dc, &point); +#else SetPixel(shapedc, x, y, shape_pixels[colidx[c] - 1]); +#endif } #endif } else @@ -2346,10 +2651,20 @@ ParseAndPutPixels( } #ifdef FOR_MSW if ( shapedc ) { +#ifdef __OS2__ + GpiSetBitmap(*dc, sobm); + GpiDestroyPS(*dc); + DevCloseDC(shapedc); +#else SelectObject(shapedc, sobm); - DeleteDC(shapedc); + DeleteDC(shapedc); +#endif } +#ifdef __OS2__ + GpiSetBitmap(*dc, obm); +#else SelectObject(*dc, obm); +#endif #endif } break; @@ -2357,7 +2672,6 @@ ParseAndPutPixels( case (2): /* Optimize for double character * colors */ { - /* free all allocated pointers at all exits */ #define FREE_CIDX {int f; for (f = 0; f < 256; f++) \ if (cidx[f]) XpmFree(cidx[f]);} @@ -2365,6 +2679,9 @@ if (cidx[f]) XpmFree(cidx[f]);} /* array of pointers malloced by need */ unsigned short *cidx[256]; int char1; +#ifdef __OS2__ + HDC shapedc; +#endif bzero((char *)cidx, 256 * sizeof(unsigned short *)); /* init */ for (a = 0; a < ncolors; a++) { @@ -2395,12 +2712,31 @@ if (cidx[f]) XpmFree(cidx[f]);} XPutPixel(shapeimage, x, y, shape_pixels[cidx[cc1][cc2] - 1]); #else - SelectObject(*dc, image->bitmap); - SetPixel(*dc, x, y, image_pixels[cidx[cc1][cc2] - 1]); +#ifdef __OS2__ + shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE); + *dc = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS); + + GpiSetBitmap(*dc, image->bitmap); + point.x = x; + point.y = y; + GpiSetColor(*dc, (LONG)image_pixels[cidx[cc1][cc2] - 1]); + GpiSetPel(*dc, &point); +#else + SelectObject(*dc, image->bitmap); + SetPixel(*dc, x, y, image_pixels[cidx[cc1][cc2] - 1]); +#endif if (shapeimage) { +#ifdef __OS2__ + GpiSetBitmap(*dc, shapeimage->bitmap); + point.x = x; + point.y = y; + GpiSetColor(*dc, (LONG)shape_pixels[cidx[cc1][cc2] - 1]); + GpiSetPel(*dc, &point); +#else SelectObject(*dc, shapeimage->bitmap); SetPixel(*dc, x, y, shape_pixels[cidx[cc1][cc2] - 1]); +#endif } #endif } else { @@ -2422,6 +2758,9 @@ if (cidx[f]) XpmFree(cidx[f]);} { char *s; char buf[BUFSIZ]; +#ifdef __OS2__ + HDC shapedc; +#endif buf[cpp] = '\0'; if (USE_HASHTABLE) { @@ -2441,14 +2780,34 @@ if (cidx[f]) XpmFree(cidx[f]);} if (shapeimage) XPutPixel(shapeimage, x, y, shape_pixels[HashColorIndex(slot)]); +#else +#ifdef __OS2__ + + shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE); + *dc = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS); + + GpiSetBitmap(*dc, image->bitmap); + point.x = x; + point.y = y; + GpiSetColor(*dc, (LONG)image_pixels[HashColorIndex(slot)]); + GpiSetPel(*dc, &point); #else SelectObject(*dc, image->bitmap); SetPixel(*dc, x, y, image_pixels[HashColorIndex(slot)]); +#endif if (shapeimage) { +#ifdef __OS2__ + GpiSetBitmap(*dc, shapeimage->bitmap); + point.x = x; + point.y = y; + GpiSetColor(*dc, (LONG)shape_pixels[HashColorIndex(slot)]); + GpiSetPel(*dc, &point); +#else SelectObject(*dc, shapeimage->bitmap); SetPixel(*dc, x, y, shape_pixels[HashColorIndex(slot)]); +#endif } #endif } @@ -2468,12 +2827,32 @@ if (cidx[f]) XpmFree(cidx[f]);} XPutPixel(image, x, y, image_pixels[a]); if (shapeimage) XPutPixel(shapeimage, x, y, shape_pixels[a]); +#else +#ifdef __OS2__ + + shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE); + *dc = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS); + + GpiSetBitmap(*dc, image->bitmap); + point.x = x; + point.y = y; + GpiSetColor(*dc, (LONG)image_pixels[a]); + GpiSetPel(*dc, &point); #else SelectObject(*dc, image->bitmap); SetPixel(*dc, x, y, image_pixels[a]); +#endif if (shapeimage) { +#ifdef __OS2__ + GpiSetBitmap(*dc, image->bitmap); + point.x = x; + point.y = y; + GpiSetColor(*dc, (LONG)shape_pixels[a]); + GpiSetPel(*dc, &point); +#else SelectObject(*dc, shapeimage->bitmap); SetPixel(*dc, x, y, shape_pixels[a]); +#endif } #endif }