comparison os2/dw.c @ 962:e3425875a03a

Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 02 May 2011 17:04:58 +0000
parents a3e4cebf3c99
children ea356c38f7b6
comparison
equal deleted inserted replaced
961:25b24bb098fd 962:e3425875a03a
3572 break; 3572 break;
3573 case WM_BUTTON1DOWN: 3573 case WM_BUTTON1DOWN:
3574 case WM_BUTTON2DOWN: 3574 case WM_BUTTON2DOWN:
3575 case WM_BUTTON3DOWN: 3575 case WM_BUTTON3DOWN:
3576 if(res == -1) 3576 if(res == -1)
3577 WinSetFocus(HWND_DESKTOP, hwnd); 3577 WinSetFocus(HWND_DESKTOP, hwnd);
3578 else if(res) 3578 else if(res)
3579 return (MPARAM)TRUE; 3579 return (MPARAM)TRUE;
3580 } 3580 }
3581 return WinDefWindowProc(hwnd, msg, mp1, mp2); 3581 return WinDefWindowProc(hwnd, msg, mp1, mp2);
3582 } 3582 }
8432 bmih.cy = (SHORT)height; 8432 bmih.cy = (SHORT)height;
8433 bmih.cPlanes = (SHORT)cPlanes; 8433 bmih.cPlanes = (SHORT)cPlanes;
8434 bmih.cBitCount = (SHORT)depth; 8434 bmih.cBitCount = (SHORT)depth;
8435 8435
8436 pixmap->width = width; pixmap->height = height; 8436 pixmap->width = width; pixmap->height = height;
8437 pixmap->transcolor = DW_CLR_DEFAULT;
8437 8438
8438 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL); 8439 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL);
8439 8440
8440 GpiSetBitmap(pixmap->hps, pixmap->hbm); 8441 GpiSetBitmap(pixmap->hps, pixmap->hbm);
8441 8442
8486 return NULL; 8487 return NULL;
8487 } 8488 }
8488 8489
8489 /* Success fill in other values */ 8490 /* Success fill in other values */
8490 pixmap->handle = handle; 8491 pixmap->handle = handle;
8492 pixmap->transcolor = DW_CLR_DEFAULT;
8491 8493
8492 return pixmap; 8494 return pixmap;
8493 } 8495 }
8494 8496
8495 /* 8497 /*
8543 unlink( file ); 8545 unlink( file );
8544 } 8546 }
8545 8547
8546 /* Success fill in other values */ 8548 /* Success fill in other values */
8547 pixmap->handle = handle; 8549 pixmap->handle = handle;
8550 pixmap->transcolor = DW_CLR_DEFAULT;
8548 8551
8549 return pixmap; 8552 return pixmap;
8550 } 8553 }
8551 8554
8552 /* 8555 /*
8593 GpiQueryBitmapParameters(pixmap->hbm, &bmih); 8596 GpiQueryBitmapParameters(pixmap->hbm, &bmih);
8594 8597
8595 GpiSetBitmap(pixmap->hps, pixmap->hbm); 8598 GpiSetBitmap(pixmap->hps, pixmap->hbm);
8596 8599
8597 pixmap->width = bmih.cx; pixmap->height = bmih.cy; 8600 pixmap->width = bmih.cx; pixmap->height = bmih.cy;
8601 pixmap->transcolor = DW_CLR_DEFAULT;
8598 8602
8599 WinReleasePS(hps); 8603 WinReleasePS(hps);
8600 8604
8601 return pixmap; 8605 return pixmap;
8602 } 8606 }
8675 ptl[2].x = xsrc; 8679 ptl[2].x = xsrc;
8676 ptl[2].y = srcheight - (ysrc + height); 8680 ptl[2].y = srcheight - (ysrc + height);
8677 ptl[3].x = ptl[2].x + width; 8681 ptl[3].x = ptl[2].x + width;
8678 ptl[3].y = ptl[2].y + height; 8682 ptl[3].y = ptl[2].y + height;
8679 8683
8680 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE); 8684 /* Handle transparency if requested */
8685 if(srcp && srcp->transcolor != DW_CLR_DEFAULT)
8686 {
8687 IMAGEBUNDLE newIb, oldIb;
8688 /* Transparent color is put into the background color */
8689 GpiSetBackColor(hpsdest, srcp->transcolor);
8690 GpiQueryAttrs(hpsdest, PRIM_IMAGE, IBB_BACK_MIX_MODE, (PBUNDLE)&oldIb);
8691 newIb.usBackMixMode = BM_SRCTRANSPARENT;
8692 GpiSetAttrs(hpsdest, PRIM_IMAGE, IBB_BACK_MIX_MODE, 0, (PBUNDLE)&newIb);
8693 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE);
8694 GpiSetAttrs(hpsdest, PRIM_IMAGE, IBB_BACK_MIX_MODE, 0, (PBUNDLE)&oldIb);
8695 }
8696 else
8697 {
8698 /* Otherwise use the regular BitBlt call */
8699 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE);
8700 }
8681 8701
8682 if(!destp) 8702 if(!destp)
8683 WinReleasePS(hpsdest); 8703 WinReleasePS(hpsdest);
8684 if(!srcp) 8704 if(!srcp)
8685 WinReleasePS(hpssrc); 8705 WinReleasePS(hpssrc);