Changeset 348
- Timestamp:
- Nov 24, 2009, 3:28:53 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/image/qpixmap_pm.cpp
r342 r348 393 393 } 394 394 395 QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h ) 396 { 397 // @todo implement 398 return QPixmap(); 395 QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h) 396 { 397 QPixmap pm; 398 399 if (w == 0 || h == 0) 400 return pm; 401 402 RECTL rcl; 403 if (!WinQueryWindowRect(winId, &rcl)) 404 return pm; 405 406 if (w < 0) 407 w = rcl.xRight; 408 if (h < 0) 409 h = rcl.yTop; 410 411 // flip y coordinate 412 y = rcl.yTop - (y + h); 413 414 HPS hps = qt_alloc_mem_ps(w, h); 415 if (hps == NULLHANDLE) 416 return pm; 417 418 HBITMAP hbm = NULLHANDLE; 419 420 // bitmap header + 2 palette entries (for the mask) 421 BITMAPINFOHEADER2 bmh; 422 bmh.cbFix = sizeof(BITMAPINFOHEADER2); 423 424 // create the uninitialized bitmap to hold window pixels 425 bmh.cx = w; 426 bmh.cy = h; 427 bmh.cPlanes = 1; 428 bmh.cBitCount = 32; 429 hbm = GpiCreateBitmap(hps, &bmh, 0, 0, 0); 430 431 if (hbm != NULLHANDLE) { 432 GpiSetBitmap(hps, hbm); 433 HPS hpsWin = WinGetPS(winId); 434 if (hpsWin != NULLHANDLE) { 435 POINTL pnts[] = { {0, 0}, {w, h}, {x, y} }; 436 if (GpiBitBlt(hps, hpsWin, 3, pnts, 437 ROP_SRCCOPY, BBO_IGNORE) != GPI_ERROR) { 438 GpiSetBitmap(hps, NULLHANDLE); 439 pm = fromPmHBITMAP(hbm); 440 } 441 WinReleasePS(hpsWin); 442 } 443 GpiDeleteBitmap(hbm); 444 } 445 446 qt_free_mem_ps(hps); 447 448 return pm; 399 449 } 400 450
Note:
See TracChangeset
for help on using the changeset viewer.