OS/2 updates for XPM
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9213 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
151
src/xpm/create.c
151
src/xpm/create.c
@@ -141,21 +141,9 @@ LFUNC(APutImagePixels, void, (XImage *ximage, unsigned int width,
|
|||||||
# endif/* AMIGA */
|
# endif/* AMIGA */
|
||||||
#else /* FOR_MSW */
|
#else /* FOR_MSW */
|
||||||
/* FOR_MSW pixel routine */
|
/* FOR_MSW pixel routine */
|
||||||
#ifdef __OS2__
|
|
||||||
LFUNC(MSWPutImagePixels, void, (
|
|
||||||
HPS hps
|
|
||||||
, Display* dc
|
|
||||||
, XImage* image
|
|
||||||
, unsigned int width
|
|
||||||
, unsigned int height
|
|
||||||
, unsigned int* pixelindex
|
|
||||||
, Pixel* pixels
|
|
||||||
));
|
|
||||||
#else
|
|
||||||
LFUNC(MSWPutImagePixels, void, (Display *dc, XImage *image,
|
LFUNC(MSWPutImagePixels, void, (Display *dc, XImage *image,
|
||||||
unsigned int width, unsigned int height,
|
unsigned int width, unsigned int height,
|
||||||
unsigned int *pixelindex, Pixel *pixels));
|
unsigned int *pixelindex, Pixel *pixels));
|
||||||
#endif
|
|
||||||
#endif /* FOR_MSW */
|
#endif /* FOR_MSW */
|
||||||
|
|
||||||
#ifdef NEED_STRCASECMP
|
#ifdef NEED_STRCASECMP
|
||||||
@@ -1008,14 +996,8 @@ XpmCreateImageFromXpmImage(display, image,
|
|||||||
image->data, image_pixels);
|
image->data, image_pixels);
|
||||||
# endif
|
# endif
|
||||||
#else /* FOR_MSW */
|
#else /* FOR_MSW */
|
||||||
#ifdef __OS2__
|
|
||||||
hps = GpiCreatePS(hab, *display, &sizl, GPIA_ASSOC|PU_PELS);
|
|
||||||
MSWPutImagePixels(hps, display, ximage, image->width, image->height,
|
|
||||||
image->data, image_pixels);
|
|
||||||
#else
|
|
||||||
MSWPutImagePixels(display, ximage, image->width, image->height,
|
MSWPutImagePixels(display, ximage, image->width, image->height,
|
||||||
image->data, image_pixels);
|
image->data, image_pixels);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* create the shape mask image */
|
/* create the shape mask image */
|
||||||
@@ -1034,14 +1016,8 @@ XpmCreateImageFromXpmImage(display, image,
|
|||||||
image->data, mask_pixels);
|
image->data, mask_pixels);
|
||||||
# endif
|
# endif
|
||||||
#else /* FOR_MSW */
|
#else /* FOR_MSW */
|
||||||
#ifdef __OS2__
|
|
||||||
hps = GpiCreatePS(hab, *display, &sizl, GPIA_ASSOC|PU_PELS);
|
|
||||||
MSWPutImagePixels(hps, display, shapeimage, image->width, image->height,
|
|
||||||
image->data, mask_pixels);
|
|
||||||
#else
|
|
||||||
MSWPutImagePixels(display, shapeimage, image->width, image->height,
|
MSWPutImagePixels(display, shapeimage, image->width, image->height,
|
||||||
image->data, mask_pixels);
|
image->data, mask_pixels);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1961,8 +1937,7 @@ APutImagePixels (
|
|||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
/* Visual Age cannot deal with old, non-ansi, code */
|
/* Visual Age cannot deal with old, non-ansi, code */
|
||||||
static void MSWPutImagePixels(
|
static void MSWPutImagePixels(
|
||||||
HPS hps
|
Display* dc
|
||||||
, Display* dc
|
|
||||||
, XImage* image
|
, XImage* image
|
||||||
, unsigned int width
|
, unsigned int width
|
||||||
, unsigned int height
|
, unsigned int height
|
||||||
@@ -1987,7 +1962,7 @@ MSWPutImagePixels(dc, image, width, height, pixelindex, pixels)
|
|||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
POINTL point;
|
POINTL point;
|
||||||
|
|
||||||
obm = GpiSetBitmap(hps, image->bitmap);
|
obm = GpiSetBitmap(*dc, image->bitmap);
|
||||||
#else
|
#else
|
||||||
obm = SelectObject(*dc, image->bitmap);
|
obm = SelectObject(*dc, image->bitmap);
|
||||||
#endif
|
#endif
|
||||||
@@ -1997,8 +1972,8 @@ MSWPutImagePixels(dc, image, width, height, pixelindex, pixels)
|
|||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
point.x = x;
|
point.x = x;
|
||||||
point.y = y;
|
point.y = y;
|
||||||
GpiSetColor(hps, (LONG)pixels[*(data++)]);
|
GpiSetColor(*dc, (LONG)pixels[*(data++)]);
|
||||||
GpiSetPel(hps, &point);
|
GpiSetPel(*dc, &point);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
SetPixel(*dc, x, y, pixels[*(data++)]); /* data is [x+y*width] */
|
SetPixel(*dc, x, y, pixels[*(data++)]); /* data is [x+y*width] */
|
||||||
@@ -2006,7 +1981,7 @@ MSWPutImagePixels(dc, image, width, height, pixelindex, pixels)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
GpiSetBitmap(hps, obm);
|
GpiSetBitmap(*dc, obm);
|
||||||
#else
|
#else
|
||||||
SelectObject(*dc, obm);
|
SelectObject(*dc, obm);
|
||||||
#endif
|
#endif
|
||||||
@@ -2604,7 +2579,6 @@ ParseAndPutPixels(
|
|||||||
unsigned int a, x, y;
|
unsigned int a, x, y;
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
HAB hab;
|
HAB hab;
|
||||||
HPS hps;
|
|
||||||
DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||||
SIZEL sizl = {0, 0};
|
SIZEL sizl = {0, 0};
|
||||||
POINTL point;
|
POINTL point;
|
||||||
@@ -2623,8 +2597,8 @@ ParseAndPutPixels(
|
|||||||
if ( shapeimage ) {
|
if ( shapeimage ) {
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
|
shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
|
||||||
hps = GpiCreatePS(hab, *dc, &sizl, GPIA_ASSOC | PU_PELS);
|
*dc = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS);
|
||||||
sobm = GpiSetBitmap(hps, shapeimage->bitmap);
|
sobm = GpiSetBitmap(*dc, shapeimage->bitmap);
|
||||||
#else
|
#else
|
||||||
shapedc = CreateCompatibleDC(*dc);
|
shapedc = CreateCompatibleDC(*dc);
|
||||||
sobm = SelectObject(shapedc, shapeimage->bitmap);
|
sobm = SelectObject(shapedc, shapeimage->bitmap);
|
||||||
@@ -2633,7 +2607,7 @@ ParseAndPutPixels(
|
|||||||
shapedc = NULL;
|
shapedc = NULL;
|
||||||
}
|
}
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
obm = GpiSetBitmap(hps, image->bitmap);
|
obm = GpiSetBitmap(*dc, image->bitmap);
|
||||||
#else
|
#else
|
||||||
obm = SelectObject(*dc, image->bitmap);
|
obm = SelectObject(*dc, image->bitmap);
|
||||||
#endif
|
#endif
|
||||||
@@ -2658,19 +2632,19 @@ ParseAndPutPixels(
|
|||||||
shape_pixels[colidx[c] - 1]);
|
shape_pixels[colidx[c] - 1]);
|
||||||
#else
|
#else
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
point.x = x;
|
point.x = x;
|
||||||
point.y = y;
|
point.y = y;
|
||||||
GpiSetColor(hps, (LONG)image_pixels[colidx[c] - 1]);
|
GpiSetColor(*dc, (LONG)image_pixels[colidx[c] - 1]);
|
||||||
GpiSetPel(hps, &point);
|
GpiSetPel(*dc, &point);
|
||||||
#else
|
#else
|
||||||
SetPixel(*dc, x, y, image_pixels[colidx[c] - 1]);
|
SetPixel(*dc, x, y, image_pixels[colidx[c] - 1]);
|
||||||
#endif
|
#endif
|
||||||
if (shapedc) {
|
if (shapedc) {
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
point.x = x;
|
point.x = x;
|
||||||
point.y = y;
|
point.y = y;
|
||||||
GpiSetColor(hps, (LONG)shape_pixels[colidx[c] - 1]);
|
GpiSetColor(*dc, (LONG)shape_pixels[colidx[c] - 1]);
|
||||||
GpiSetPel(hps, &point);
|
GpiSetPel(*dc, &point);
|
||||||
#else
|
#else
|
||||||
SetPixel(shapedc, x, y, shape_pixels[colidx[c] - 1]);
|
SetPixel(shapedc, x, y, shape_pixels[colidx[c] - 1]);
|
||||||
#endif
|
#endif
|
||||||
@@ -2683,15 +2657,16 @@ ParseAndPutPixels(
|
|||||||
#ifdef FOR_MSW
|
#ifdef FOR_MSW
|
||||||
if ( shapedc ) {
|
if ( shapedc ) {
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
GpiSetBitmap(hps, sobm);
|
GpiSetBitmap(*dc, sobm);
|
||||||
DevCloseDC(shapedc);
|
GpiDestroyPS(*dc);
|
||||||
|
DevCloseDC(shapedc);
|
||||||
#else
|
#else
|
||||||
SelectObject(shapedc, sobm);
|
SelectObject(shapedc, sobm);
|
||||||
DeleteDC(shapedc);
|
DeleteDC(shapedc);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
GpiSetBitmap(hps, obm);
|
GpiSetBitmap(*dc, obm);
|
||||||
#else
|
#else
|
||||||
SelectObject(*dc, obm);
|
SelectObject(*dc, obm);
|
||||||
#endif
|
#endif
|
||||||
@@ -2709,6 +2684,9 @@ if (cidx[f]) XpmFree(cidx[f]);}
|
|||||||
/* array of pointers malloced by need */
|
/* array of pointers malloced by need */
|
||||||
unsigned short *cidx[256];
|
unsigned short *cidx[256];
|
||||||
int char1;
|
int char1;
|
||||||
|
#ifdef __OS2__
|
||||||
|
HDC shapedc;
|
||||||
|
#endif
|
||||||
|
|
||||||
bzero((char *)cidx, 256 * sizeof(unsigned short *)); /* init */
|
bzero((char *)cidx, 256 * sizeof(unsigned short *)); /* init */
|
||||||
for (a = 0; a < ncolors; a++) {
|
for (a = 0; a < ncolors; a++) {
|
||||||
@@ -2740,25 +2718,25 @@ if (cidx[f]) XpmFree(cidx[f]);}
|
|||||||
shape_pixels[cidx[cc1][cc2] - 1]);
|
shape_pixels[cidx[cc1][cc2] - 1]);
|
||||||
#else
|
#else
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
*dc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
|
shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
|
||||||
hps = GpiCreatePS(hab, *dc, &sizl, GPIA_ASSOC | PU_PELS);
|
*dc = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS);
|
||||||
|
|
||||||
GpiSetBitmap(hps, image->bitmap);
|
GpiSetBitmap(*dc, image->bitmap);
|
||||||
point.x = x;
|
point.x = x;
|
||||||
point.y = y;
|
point.y = y;
|
||||||
GpiSetColor(hps, (LONG)image_pixels[cidx[cc1][cc2] - 1]);
|
GpiSetColor(*dc, (LONG)image_pixels[cidx[cc1][cc2] - 1]);
|
||||||
GpiSetPel(hps, &point);
|
GpiSetPel(*dc, &point);
|
||||||
#else
|
#else
|
||||||
SelectObject(*dc, image->bitmap);
|
SelectObject(*dc, image->bitmap);
|
||||||
SetPixel(*dc, x, y, image_pixels[cidx[cc1][cc2] - 1]);
|
SetPixel(*dc, x, y, image_pixels[cidx[cc1][cc2] - 1]);
|
||||||
#endif
|
#endif
|
||||||
if (shapeimage) {
|
if (shapeimage) {
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
GpiSetBitmap(hps, shapeimage->bitmap);
|
GpiSetBitmap(*dc, shapeimage->bitmap);
|
||||||
point.x = x;
|
point.x = x;
|
||||||
point.y = y;
|
point.y = y;
|
||||||
GpiSetColor(hps, (LONG)shape_pixels[cidx[cc1][cc2] - 1]);
|
GpiSetColor(*dc, (LONG)shape_pixels[cidx[cc1][cc2] - 1]);
|
||||||
GpiSetPel(hps, &point);
|
GpiSetPel(*dc, &point);
|
||||||
#else
|
#else
|
||||||
SelectObject(*dc, shapeimage->bitmap);
|
SelectObject(*dc, shapeimage->bitmap);
|
||||||
SetPixel(*dc, x, y,
|
SetPixel(*dc, x, y,
|
||||||
@@ -2785,6 +2763,9 @@ if (cidx[f]) XpmFree(cidx[f]);}
|
|||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
|
#ifdef __OS2__
|
||||||
|
HDC shapedc;
|
||||||
|
#endif
|
||||||
|
|
||||||
buf[cpp] = '\0';
|
buf[cpp] = '\0';
|
||||||
if (USE_HASHTABLE) {
|
if (USE_HASHTABLE) {
|
||||||
@@ -2806,14 +2787,15 @@ if (cidx[f]) XpmFree(cidx[f]);}
|
|||||||
shape_pixels[HashColorIndex(slot)]);
|
shape_pixels[HashColorIndex(slot)]);
|
||||||
#else
|
#else
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
*dc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
|
|
||||||
hps = GpiCreatePS(hab, *dc, &sizl, GPIA_ASSOC | PU_PELS);
|
|
||||||
|
|
||||||
GpiSetBitmap(hps, image->bitmap);
|
shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
|
||||||
point.x = x;
|
*dc = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS);
|
||||||
point.y = y;
|
|
||||||
GpiSetColor(hps, (LONG)image_pixels[HashColorIndex(slot)]);
|
GpiSetBitmap(*dc, image->bitmap);
|
||||||
GpiSetPel(hps, &point);
|
point.x = x;
|
||||||
|
point.y = y;
|
||||||
|
GpiSetColor(*dc, (LONG)image_pixels[HashColorIndex(slot)]);
|
||||||
|
GpiSetPel(*dc, &point);
|
||||||
#else
|
#else
|
||||||
SelectObject(*dc, image->bitmap);
|
SelectObject(*dc, image->bitmap);
|
||||||
SetPixel(*dc, x, y,
|
SetPixel(*dc, x, y,
|
||||||
@@ -2821,11 +2803,11 @@ if (cidx[f]) XpmFree(cidx[f]);}
|
|||||||
#endif
|
#endif
|
||||||
if (shapeimage) {
|
if (shapeimage) {
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
GpiSetBitmap(hps, shapeimage->bitmap);
|
GpiSetBitmap(*dc, shapeimage->bitmap);
|
||||||
point.x = x;
|
point.x = x;
|
||||||
point.y = y;
|
point.y = y;
|
||||||
GpiSetColor(hps, (LONG)shape_pixels[HashColorIndex(slot)]);
|
GpiSetColor(*dc, (LONG)shape_pixels[HashColorIndex(slot)]);
|
||||||
GpiSetPel(hps, &point);
|
GpiSetPel(*dc, &point);
|
||||||
#else
|
#else
|
||||||
SelectObject(*dc, shapeimage->bitmap);
|
SelectObject(*dc, shapeimage->bitmap);
|
||||||
SetPixel(*dc, x, y,
|
SetPixel(*dc, x, y,
|
||||||
@@ -2852,25 +2834,26 @@ if (cidx[f]) XpmFree(cidx[f]);}
|
|||||||
XPutPixel(shapeimage, x, y, shape_pixels[a]);
|
XPutPixel(shapeimage, x, y, shape_pixels[a]);
|
||||||
#else
|
#else
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
*dc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
|
|
||||||
hps = GpiCreatePS(hab, *dc, &sizl, GPIA_ASSOC | PU_PELS);
|
|
||||||
|
|
||||||
GpiSetBitmap(hps, image->bitmap);
|
shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
|
||||||
point.x = x;
|
*dc = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS);
|
||||||
point.y = y;
|
|
||||||
GpiSetColor(hps, (LONG)image_pixels[a]);
|
GpiSetBitmap(*dc, image->bitmap);
|
||||||
GpiSetPel(hps, &point);
|
point.x = x;
|
||||||
|
point.y = y;
|
||||||
|
GpiSetColor(*dc, (LONG)image_pixels[a]);
|
||||||
|
GpiSetPel(*dc, &point);
|
||||||
#else
|
#else
|
||||||
SelectObject(*dc, image->bitmap);
|
SelectObject(*dc, image->bitmap);
|
||||||
SetPixel(*dc, x, y, image_pixels[a]);
|
SetPixel(*dc, x, y, image_pixels[a]);
|
||||||
#endif
|
#endif
|
||||||
if (shapeimage) {
|
if (shapeimage) {
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
GpiSetBitmap(hps, image->bitmap);
|
GpiSetBitmap(*dc, image->bitmap);
|
||||||
point.x = x;
|
point.x = x;
|
||||||
point.y = y;
|
point.y = y;
|
||||||
GpiSetColor(hps, (LONG)shape_pixels[a]);
|
GpiSetColor(*dc, (LONG)shape_pixels[a]);
|
||||||
GpiSetPel(hps, &point);
|
GpiSetPel(*dc, &point);
|
||||||
#else
|
#else
|
||||||
SelectObject(*dc, shapeimage->bitmap);
|
SelectObject(*dc, shapeimage->bitmap);
|
||||||
SetPixel(*dc, x, y, shape_pixels[a]);
|
SetPixel(*dc, x, y, shape_pixels[a]);
|
||||||
|
@@ -273,11 +273,8 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
|
|||||||
# endif /* AMIGA */
|
# endif /* AMIGA */
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef __OS2__
|
|
||||||
ErrorStatus = MSWGetImagePixels(display, shapeimage, width, height,
|
ErrorStatus = MSWGetImagePixels(display, shapeimage, width, height,
|
||||||
&pmap, storeMaskPixel);
|
&pmap, storeMaskPixel);
|
||||||
/* calling convention all messed up OS/2 -- figure out later */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ndef for FOR_MSW */
|
#endif /* ndef for FOR_MSW */
|
||||||
|
|
||||||
@@ -318,10 +315,8 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
|
|||||||
# endif /* AMIGA */
|
# endif /* AMIGA */
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef __VISAGECPP30__
|
|
||||||
ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap,
|
ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap,
|
||||||
storePixel);
|
storePixel);
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -601,7 +596,7 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
|
|||||||
#else
|
#else
|
||||||
sprintf(buf, "#%02x%02x%02x",
|
sprintf(buf, "#%02x%02x%02x",
|
||||||
xcolor->red, xcolor->green, xcolor->blue);
|
xcolor->red, xcolor->green, xcolor->blue);
|
||||||
#endif
|
#endif
|
||||||
color->c_color = (char *) xpmstrdup(buf);
|
color->c_color = (char *) xpmstrdup(buf);
|
||||||
}
|
}
|
||||||
if (!color->c_color) {
|
if (!color->c_color) {
|
||||||
@@ -1026,7 +1021,7 @@ MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
|
|||||||
Pixel pixel;
|
Pixel pixel;
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
HAB hab;
|
HAB hab;
|
||||||
HPS hps;
|
HDC shapedc;
|
||||||
DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||||
SIZEL sizl = {0, 0};
|
SIZEL sizl = {0, 0};
|
||||||
POINTL point;
|
POINTL point;
|
||||||
@@ -1035,8 +1030,9 @@ MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
|
|||||||
iptr = pmap->pixelindex;
|
iptr = pmap->pixelindex;
|
||||||
|
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
hps = GpiCreatePS(hab, *display, &sizl, GPIA_ASSOC | PU_PELS);
|
shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
|
||||||
GpiSetBitmap(hps, image->bitmap);
|
*display = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS);
|
||||||
|
GpiSetBitmap(*display, image->bitmap);
|
||||||
#else
|
#else
|
||||||
SelectObject(*display, image->bitmap);
|
SelectObject(*display, image->bitmap);
|
||||||
#endif
|
#endif
|
||||||
@@ -1046,7 +1042,7 @@ MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
|
|||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
point.x = x;
|
point.x = x;
|
||||||
point.y = y;
|
point.y = y;
|
||||||
pixel = GpiQueryPel(hps, &point);
|
pixel = GpiQueryPel(*display, &point);
|
||||||
#else
|
#else
|
||||||
pixel = GetPixel(*display, x, y);
|
pixel = GetPixel(*display, x, y);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -137,6 +137,7 @@ XDefaultDepth(Display *display, Screen *screen)
|
|||||||
DevQueryCaps(hdcScreen, CAPS_COLOR_PLANES, 1L, &lPlanes);
|
DevQueryCaps(hdcScreen, CAPS_COLOR_PLANES, 1L, &lPlanes);
|
||||||
DevQueryCaps(hdcScreen, CAPS_COLOR_BITCOUNT, 1L, &lBitsPerPixel);
|
DevQueryCaps(hdcScreen, CAPS_COLOR_BITCOUNT, 1L, &lBitsPerPixel);
|
||||||
b = (int)lBitsPerPixel;
|
b = (int)lBitsPerPixel;
|
||||||
|
WinReleasePS(hpsScreen);
|
||||||
#else
|
#else
|
||||||
b = GetDeviceCaps(*display, BITSPIXEL);
|
b = GetDeviceCaps(*display, BITSPIXEL);
|
||||||
d = GetDeviceCaps(*display, PLANES);
|
d = GetDeviceCaps(*display, PLANES);
|
||||||
@@ -294,7 +295,8 @@ XCreateImage(Display *d, Visual *v,
|
|||||||
img->bitmap = CreateCompatibleBitmap(*d, width, height);
|
img->bitmap = CreateCompatibleBitmap(*d, width, height);
|
||||||
} else*/ {
|
} else*/ {
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
img->bitmap = GpiCreateBitmap(hps, &bmih, 0L, NULL, NULL);
|
img->bitmap = GpiCreateBitmap(hps, &bmih, 0L, NULL, NULL);
|
||||||
|
WinReleasePS(hps);
|
||||||
#else
|
#else
|
||||||
img->bitmap = CreateBitmap(width, height, 1 /* plane */ ,
|
img->bitmap = CreateBitmap(width, height, 1 /* plane */ ,
|
||||||
depth /* bits per pixel */ , NULL);
|
depth /* bits per pixel */ , NULL);
|
||||||
|
@@ -44,18 +44,29 @@
|
|||||||
#else
|
#else
|
||||||
#define INCL_PM
|
#define INCL_PM
|
||||||
#define INCL_GPI
|
#define INCL_GPI
|
||||||
|
#define INCL_DEV
|
||||||
#include<os2.h>
|
#include<os2.h>
|
||||||
typedef unsigned long COLORREF;
|
typedef unsigned long COLORREF;
|
||||||
|
/*
|
||||||
// RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def
|
// RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def
|
||||||
//#define OS2RGB(r,g,b) ((ULONG ((BYTE) (r) | ((UINT) (g) << 8)) | (((ULONG)(BYTE)(b)) << 16)))
|
// #define OS2RGB(r,g,b) ((ULONG ((BYTE) (r) | ((UINT) (g) << 8)) | (((ULONG)(BYTE)(b)) << 16)))
|
||||||
#define OS2RGB(r,g,b) ((unsigned long)r<<16|(unsigned long)g<<8|(unsigned long)b)
|
*/
|
||||||
|
#ifndef OS2RGB
|
||||||
#define GetBValue(rgb) ((BYTE)((rgb) >> 16))
|
# define OS2RGB(r,g,b) ((unsigned long)r<<16|(unsigned long)g<<8|(unsigned long)b)
|
||||||
#define GetGValue(rgb) ((BYTE)(((WORD)(rgb)) >> 8))
|
|
||||||
#define GetRValue(rgb) ((BYTE)(rgb))
|
|
||||||
typedef UINT WORD;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GetBValue
|
||||||
|
# define GetBValue(rgb) ((BYTE)((rgb) >> 16))
|
||||||
|
#endif
|
||||||
|
#ifndef GetGValue
|
||||||
|
# define GetGValue(rgb) ((BYTE)(((UINT)(rgb)) >> 8))
|
||||||
|
#endif
|
||||||
|
#ifndef GetRValue
|
||||||
|
# define GetRValue(rgb) ((BYTE)(rgb))
|
||||||
|
#endif
|
||||||
|
typedef UINT WORD;
|
||||||
|
#endif /* else __OS2__ */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* minimal portability layer between ansi and KR C
|
* minimal portability layer between ansi and KR C
|
||||||
@@ -80,7 +91,12 @@ FUNC(boundCheckingRealloc, void *, (void *p, long s));
|
|||||||
/* define MSW types for X window types,
|
/* define MSW types for X window types,
|
||||||
I don't know much about MSW, but the following defines do the job */
|
I don't know much about MSW, but the following defines do the job */
|
||||||
|
|
||||||
|
#if !defined(__OS2__)
|
||||||
typedef HDC Display; /* this should be similar */
|
typedef HDC Display; /* this should be similar */
|
||||||
|
#else
|
||||||
|
typedef HPS Display;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void *Screen; /* not used */
|
typedef void *Screen; /* not used */
|
||||||
typedef void *Visual; /* not used yet, is for GRAY, COLOR,
|
typedef void *Visual; /* not used yet, is for GRAY, COLOR,
|
||||||
* MONO */
|
* MONO */
|
||||||
|
Reference in New Issue
Block a user