Changeset 295 for trunk/src/comctl32/imagelist.c
- Timestamp:
- Jul 12, 1999, 5:58:51 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/imagelist.c
r164 r295 1 /* $Id: imagelist.c,v 1. 4 1999-06-23 19:45:00 achimhaExp $ */1 /* $Id: imagelist.c,v 1.5 1999-07-12 15:58:47 cbratschi Exp $ */ 2 2 /* 3 3 * ImageList implementation … … 21 21 * - ImageList_Draw, ImageList_DrawEx and ImageList_GetIcon use 22 22 * ImageList_DrawIndirect. Since ImageList_DrawIndirect is still 23 * partially imlemented, the functions mentioned above will be 23 * partially imlemented, the functions mentioned above will be 24 24 * limited in functionality too. 25 25 */ 26 27 /* CB: todo 28 - ImageList_Read 29 - ImageList_Write 30 */ 26 31 27 32 /* This must be defined because the HIMAGELIST type is just a pointer … … 32 37 #define __WINE_IMAGELIST_C 33 38 34 #include "imagelist.h" 39 #include "imagelist.h" 35 40 #include "commctrl.h" 36 41 #include "comctl32.h" … … 57 62 58 63 /************************************************************************* 59 * IMAGELIST_InternalExpandBitmaps [Internal] 64 * IMAGELIST_InternalExpandBitmaps [Internal] 60 65 * 61 66 * Expands the bitmaps of an image list by the given number of images. … … 101 106 102 107 if (himl->hbmMask) { 103 hbmNewBitmap = 108 hbmNewBitmap = 104 109 CreateBitmap (nNewWidth, himl->cy, 1, 1, NULL); 105 110 … … 138 143 139 144 INT WINAPI 140 ImageList_Add (HIMAGELIST himl, 145 ImageList_Add (HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask) 141 146 { 142 147 HDC hdcSrc, hdcDst; … … 146 151 147 152 if (!himl || !hbmImage) 148 153 return -1; 149 154 150 155 GetObjectA (hbmImage, sizeof(BITMAP), (LPVOID)&bmp); … … 164 169 BitBlt (hdcDst, himl->cCurImage * himl->cx, 0, 165 170 bmp.bmWidth, himl->cy, hdcSrc, 0, 0, SRCCOPY); 166 171 167 172 if (himl->hbmMask) { 168 173 if (hbmMask) { 169 174 /* copy mask bitmap */ 170 175 SelectObject (hdcDst, himl->hbmMask); 171 176 SelectObject (hdcSrc, hbmMask); 172 177 BitBlt (hdcDst, nStartX, 0, bmp.bmWidth, himl->cy, 173 178 hdcSrc, 0, 0, SRCCOPY); 174 179 } 175 180 else { 176 181 /* copy monochrome image to the mask bitmap */ 177 182 SelectObject (hdcDst, himl->hbmMask); 178 183 SelectObject (hdcSrc, hbmImage); 179 180 181 182 184 SetBkColor (hdcSrc, GetNearestColor (hdcSrc, 185 GetPixel (hdcSrc, 0, 0))); 186 BitBlt (hdcDst, nStartX, 0, bmp.bmWidth, himl->cy, 187 hdcSrc, nStartX, 0, SRCCOPY); 183 188 } 184 189 } … … 216 221 217 222 /************************************************************************* 218 * ImageList_AddMasked [COMCTL32.41] 223 * ImageList_AddMasked [COMCTL32.41] 219 224 * 220 225 * Adds an image or images to an image list and creates a mask from the … … 239 244 240 245 if (himl == NULL) 241 246 return -1; 242 247 243 248 if (!GetObjectA (hBitmap, sizeof(BITMAP), &bmp)) 244 249 return -1; 245 250 246 251 nImageCount = bmp.bmWidth / himl->cx; … … 261 266 262 267 if (himl->hbmMask) { 263 264 265 266 268 COLORREF bkColor = (clrMask != CLR_DEFAULT) ? clrMask : 269 GetNearestColor (hdcBitmap, GetPixel (hdcBitmap, 0, 0)); 270 271 /* create mask from image */ 267 272 hdcMask = CreateCompatibleDC (0); 268 273 SelectObject (hdcMask, himl->hbmMask); 269 274 270 271 272 273 275 /* create monochrome image to the mask bitmap */ 276 SetBkColor (hdcBitmap, bkColor); 277 BitBlt (hdcMask, nIndex * himl->cx, 0, bmp.bmWidth, himl->cy, 278 hdcBitmap, 0, 0, SRCCOPY); 274 279 275 280 DeleteDC (hdcMask); … … 278 283 DeleteDC (hdcImage); 279 284 DeleteDC (hdcBitmap); 280 285 281 286 return nIndex; 282 287 } … … 284 289 285 290 /************************************************************************* 286 * ImageList_BeginDrag [COMCTL32.42] 291 * ImageList_BeginDrag [COMCTL32.42] 287 292 * 288 293 * Creates a temporary image list that contains one image. It will be used … … 302 307 BOOL WINAPI 303 308 ImageList_BeginDrag (HIMAGELIST himlTrack, INT iTrack, 304 309 INT dxHotspot, INT dyHotspot) 305 310 { 306 311 HDC hdcSrc, hdcDst; … … 309 314 310 315 if (himlTrack == NULL) 311 316 return FALSE; 312 317 313 318 if (himlInternalDrag) … … 315 320 316 321 himlInternalDrag = 317 318 322 ImageList_Create (himlTrack->cx, himlTrack->cy, 323 himlTrack->flags, 1, 1); 319 324 if (himlInternalDrag == NULL) { 320 325 // ERR(imagelist, "Error creating drag image list!\n"); … … 350 355 351 356 /************************************************************************* 352 * ImageList_Copy [COMCTL32.43] 353 * 354 * Copies an image of the source image list to an image of the 357 * ImageList_Copy [COMCTL32.43] 358 * 359 * Copies an image of the source image list to an image of the 355 360 * destination image list. Images can be copied or swapped. 356 361 * … … 373 378 374 379 BOOL WINAPI 375 ImageList_Copy (HIMAGELIST himlDst, INT iDst, 376 377 { 378 HDC hdcSrc, hdcDst; 380 ImageList_Copy (HIMAGELIST himlDst, INT iDst, HIMAGELIST himlSrc, 381 INT iSrc, INT uFlags) 382 { 383 HDC hdcSrc, hdcDst; 379 384 380 385 // TRACE(imagelist, "iDst=%d iSrc=%d\n", iDst, iSrc); 381 386 382 387 if ((himlSrc == NULL) || (himlDst == NULL)) 383 388 return FALSE; 384 389 if ((iDst < 0) || (iDst >= himlDst->cCurImage)) 385 390 return FALSE; 386 391 if ((iSrc < 0) || (iSrc >= himlSrc->cCurImage)) 387 392 return FALSE; 388 393 389 394 hdcSrc = CreateCompatibleDC (0); … … 401 406 himlSrc->uBitsPixel, NULL); 402 407 hbmTempMask = CreateBitmap (himlSrc->cx, himlSrc->cy, 1, 403 408 1, NULL); 404 409 405 410 /* copy (and stretch) destination to temporary bitmaps.(save) */ … … 494 499 HIMAGELIST WINAPI 495 500 ImageList_Create (INT cx, INT cy, UINT flags, 496 501 INT cInitial, INT cGrow) 497 502 { 498 503 HIMAGELIST himl; … … 500 505 INT nCount; 501 506 HBITMAP hbmTemp; 502 static WORD aBitBlend25[] = 507 static WORD aBitBlend25[] = 503 508 {0xAA, 0x00, 0x55, 0x00, 0xAA, 0x00, 0x55, 0x00}; 504 509 … … 542 547 if (himl->flags & ILC_MASK) { 543 548 himl->hbmMask = CreateBitmap (himl->cx * himl->cMaxImage, himl->cy, 544 549 1, 1, NULL); 545 550 if (himl->hbmMask == 0) { 546 551 // ERR(imagelist, "Error creating mask bitmap!\n"); … … 567 572 568 573 /************************************************************************* 569 * ImageList_Destroy [COMCTL32.45] 574 * ImageList_Destroy [COMCTL32.45] 570 575 * 571 576 * Destroys an image list. … … 581 586 BOOL WINAPI 582 587 ImageList_Destroy (HIMAGELIST himl) 583 { 588 { 584 589 if (!himl) 585 590 return FALSE; 586 591 587 592 /* delete image bitmaps */ … … 596 601 if (himl->hbrBlend50) 597 602 DeleteObject (himl->hbrBlend50); 598 603 599 604 COMCTL32_Free (himl); 600 605 … … 604 609 605 610 /************************************************************************* 606 * ImageList_DragEnter [COMCTL32.46] 611 * ImageList_DragEnter [COMCTL32.46] 607 612 * 608 613 * Locks window update and displays the drag image at the given position. … … 626 631 { 627 632 if (himlInternalDrag == NULL) 628 633 return FALSE; 629 634 630 635 if (hwndLock) 631 636 hwndInternalDrag = hwndLock; 632 637 else 633 638 hwndInternalDrag = GetDesktopWindow (); 634 639 635 640 xInternalPos = x; … … 638 643 hdcBackBuffer = CreateCompatibleDC (0); 639 644 hbmBackBuffer = CreateCompatibleBitmap (hdcBackBuffer, 640 645 himlInternalDrag->cx, himlInternalDrag->cy); 641 646 642 647 ImageList_DragShowNolock (TRUE); … … 647 652 648 653 /************************************************************************* 649 * ImageList_DragLeave [COMCTL32.47] 654 * ImageList_DragLeave [COMCTL32.47] 650 655 * 651 656 * Unlocks window update and hides the drag image. … … 663 668 { 664 669 if (hwndLock) 665 670 hwndInternalDrag = hwndLock; 666 671 else 667 672 hwndInternalDrag = GetDesktopWindow (); 668 673 669 674 ImageList_DragShowNolock (FALSE); … … 677 682 678 683 /************************************************************************* 679 * ImageList_DragMove [COMCTL32.48] 684 * ImageList_DragMove [COMCTL32.48] 680 685 * 681 686 * Moves the drag image. … … 709 714 710 715 /************************************************************************* 711 * ImageList_DragShowNolock [COMCTL32.49] 716 * ImageList_DragShowNolock [COMCTL32.49] 712 717 * 713 718 * Shows or hides the drag image. … … 733 738 734 739 hdcDrag = GetDCEx (hwndInternalDrag, 0, 735 740 DCX_WINDOW | DCX_CACHE | DCX_LOCKWINDOWUPDATE); 736 741 737 742 if (bShow) { 738 739 740 741 742 743 /* show drag image */ 744 745 /* save background */ 746 747 /* draw drag image */ 743 748 744 749 } 745 750 else { 746 747 748 751 /* hide drag image */ 752 753 /* restore background */ 749 754 750 755 } … … 780 785 BOOL WINAPI 781 786 ImageList_Draw (HIMAGELIST himl, INT i, HDC hdc, 782 787 INT x, INT y, UINT fStyle) 783 788 { 784 789 IMAGELISTDRAWPARAMS imldp; … … 833 838 BOOL WINAPI 834 839 ImageList_DrawEx (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, 835 836 840 INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, 841 UINT fStyle) 837 842 { 838 843 IMAGELISTDRAWPARAMS imldp; … … 858 863 859 864 /************************************************************************* 860 * ImageList_DrawIndirect [COMCTL32.52] 865 * ImageList_DrawIndirect [COMCTL32.52] 861 866 * 862 867 * Draws an image using ... … … 888 893 889 894 if (pimldp == NULL) 890 895 return FALSE; 891 896 if (pimldp->cbSize < sizeof(IMAGELISTDRAWPARAMS)) 892 897 return FALSE; 893 898 if (pimldp->himl == NULL) 894 899 return FALSE; 895 900 if ((pimldp->i < 0) || (pimldp->i > pimldp->himl->cCurImage)) 896 901 return FALSE; 897 902 898 903 himlLocal = pimldp->himl; … … 914 919 bMaskTrans = TRUE; 915 920 } 916 921 917 922 /* ILD_IMAGE state (changes) */ 918 923 if (pimldp->fStyle & ILD_IMAGE) … … 922 927 bImageTrans = FALSE; 923 928 } 924 929 925 930 /* ILD_MASK state (changes) */ 926 931 if ((pimldp->fStyle & ILD_MASK) && (himlLocal->hbmMask)) … … 947 952 if (bMask) 948 953 { 949 950 951 952 953 954 955 954 /* draw the mask */ 955 SelectObject (hdcImageList, himlLocal->hbmMask); 956 SetBkColor (hdcImageList, RGB(255, 255, 255)); 957 SetTextColor (hdcImageList, RGB(0, 0, 0)); 958 BitBlt (pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, 959 hdcImageList, himlLocal->cx * pimldp->i, 0, 960 bMaskTrans ? SRCAND : SRCCOPY); 956 961 } 957 962 958 963 if (bImage) 959 964 { 960 961 965 /* draw the image */ 966 SelectObject (hdcImageList, himlLocal->hbmImage); 962 967 963 968 if (!bImageTrans) … … 993 998 SelectObject (hdcImageList, himlLocal->hbmMask); 994 999 BitBlt (hdcTempImage, 0, 0, himlLocal->cx, 995 himlLocal->cy, hdcImageList, 1000 himlLocal->cy, hdcImageList, 996 1001 pimldp->i * himlLocal->cx, 0, SRCPAINT); 997 1002 998 1003 BitBlt (pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, 999 1004 hdcTempImage, 0, 0, SRCAND); 1000 1005 1001 1006 /* fill */ … … 1011 1016 SelectObject (hdcImageList, himlLocal->hbmMask); 1012 1017 BitBlt (hdcTempImage, 0, 0, himlLocal->cx, 1013 himlLocal->cy, hdcImageList, 1018 himlLocal->cy, hdcImageList, 1014 1019 pimldp->i * himlLocal->cx, 0, SRCPAINT); 1015 1020 … … 1020 1025 DeleteDC (hdcTempImage); 1021 1026 } 1022 } 1027 } 1023 1028 1024 1029 /* Draw overlay image */ 1025 1030 if (pimldp->fStyle & 0x0700) { 1026 1027 1028 1029 1030 if (pimldp->himl->hbmMask) { 1031 nOvlIdx = (pimldp->fStyle & 0x0700) >> 8; 1032 if ((nOvlIdx >= 1) && (nOvlIdx <= MAX_OVERLAYIMAGE)) { 1033 nOvlIdx = pimldp->himl->nOvlIdx[nOvlIdx - 1]; 1034 if ((nOvlIdx >= 0) && (nOvlIdx <= pimldp->himl->cCurImage)) { 1035 if (pimldp->himl->hbmMask) { 1031 1036 SelectObject (hdcImageList, pimldp->himl->hbmMask); 1032 1037 BitBlt (pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, 1033 1038 hdcImageList, pimldp->himl->cx * nOvlIdx, 0, 1034 1035 } 1039 SRCAND); 1040 } 1036 1041 SelectObject (hdcImageList, pimldp->himl->hbmImage); 1037 1042 BitBlt (pimldp->hdcDst, pimldp->x, pimldp->y, … … 1043 1048 1044 1049 DeleteDC (hdcImageList); 1045 1050 1046 1051 return TRUE; 1047 1052 } … … 1151 1156 { 1152 1157 if (himl == NULL) 1153 1158 return CLR_NONE; 1154 1159 1155 1160 return himl->clrBk; … … 1187 1192 1188 1193 /************************************************************************* 1189 * ImageList_GetIcon [COMCTL32.57] 1194 * ImageList_GetIcon [COMCTL32.57] 1190 1195 * 1191 1196 * Creates an icon from a masked image of an image list. … … 1209 1214 1210 1215 if ((himl == NULL) || (i < 0) || (i >= himl->cCurImage)) 1211 1216 return 0; 1212 1217 1213 1218 hdcSrc = CreateCompatibleDC(0); … … 1222 1227 SelectObject (hdcDst, ii.hbmMask); 1223 1228 if (himl->hbmMask) { 1224 1225 1226 1229 SelectObject (hdcSrc, himl->hbmMask); 1230 BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, 1231 hdcSrc, i * himl->cx, 0, SRCCOPY); 1227 1232 } 1228 1233 else 1229 1234 PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS); 1230 1235 1231 1236 /* draw image*/ … … 1233 1238 SelectObject (hdcSrc, himl->hbmImage); 1234 1239 BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, 1235 1236 1237 hIcon = CreateIconIndirect (&ii); 1240 hdcSrc, i * himl->cx, 0, SRCCOPY); 1241 1242 hIcon = CreateIconIndirect (&ii); 1238 1243 1239 1244 DeleteDC (hdcSrc); … … 1268 1273 { 1269 1274 if (himl == NULL) 1270 1275 return FALSE; 1271 1276 if ((himl->cx <= 0) || (himl->cy <= 0)) 1272 1277 return FALSE; 1273 1278 1274 1279 if (cx) 1275 1280 *cx = himl->cx; 1276 1281 if (cy) 1277 1282 *cy = himl->cy; 1278 1283 1279 1284 return TRUE; … … 1298 1303 { 1299 1304 if (himl == NULL) 1300 1305 return 0; 1301 1306 1302 1307 return himl->cCurImage; … … 1323 1328 { 1324 1329 if ((himl == NULL) || (pImageInfo == NULL)) 1325 1330 return FALSE; 1326 1331 if ((i < 0) || (i >= himl->cCurImage)) 1327 1332 return FALSE; 1328 1333 1329 1334 pImageInfo->hbmImage = himl->hbmImage; 1330 1335 pImageInfo->hbmMask = himl->hbmMask; 1331 1336 1332 1337 pImageInfo->rcImage.top = 0; 1333 1338 pImageInfo->rcImage.bottom = himl->cy; 1334 1339 pImageInfo->rcImage.left = i * himl->cx; 1335 1340 pImageInfo->rcImage.right = (i+1) * himl->cx; 1336 1341 1337 1342 return TRUE; 1338 1343 } … … 1340 1345 1341 1346 /************************************************************************* 1342 * ImageList_GetImageRect [COMCTL32.61] 1347 * ImageList_GetImageRect [COMCTL32.61] 1343 1348 * 1344 1349 * Retrieves the rectangle of the specified image in an image list. … … 1361 1366 { 1362 1367 if ((himl == NULL) || (lpRect == NULL)) 1363 1368 return FALSE; 1364 1369 if ((i < 0) || (i >= himl->cCurImage)) 1365 1370 return FALSE; 1366 1371 1367 1372 lpRect->left = i * himl->cx; … … 1397 1402 1398 1403 HIMAGELIST WINAPI 1399 ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, 1400 COLORREF clrMask, UINT uType,UINT uFlags)1404 ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow, 1405 COLORREF clrMask, UINT uType, UINT uFlags) 1401 1406 { 1402 1407 HIMAGELIST himl = NULL; … … 1413 1418 BITMAP bmp; 1414 1419 GetObjectA (handle, sizeof(BITMAP), &bmp); 1420 1421 /* To match windows behavior, if cx is set to zero and 1422 the flag DI_DEFAULTSIZE is specified, cx becomes the 1423 system metric value for icons. If the flag is not specified 1424 the function sets the size to the height of the bitmap */ 1425 if (cx == 0) 1426 { 1427 if (uFlags & DI_DEFAULTSIZE) 1428 cx = GetSystemMetrics (SM_CXICON); 1429 else 1430 cx = bmp.bmHeight; 1431 } 1432 1415 1433 nImageCount = bmp.bmWidth / cx; 1416 1434 … … 1425 1443 GetIconInfo (handle, &ii); 1426 1444 GetObjectA (ii.hbmColor, sizeof(BITMAP), (LPVOID)&bmp); 1427 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 1445 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 1428 1446 ILC_MASK | ILC_COLOR, 1, cGrow); 1429 1447 ImageList_Add (himl, ii.hbmColor, ii.hbmMask); … … 1433 1451 1434 1452 DeleteObject (handle); 1435 1453 1436 1454 return himl; 1437 1455 } … … 1462 1480 HIMAGELIST WINAPI 1463 1481 ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow, 1464 COLORREF clrMask, UINT uType,UINT uFlags)1482 COLORREF clrMask, UINT uType, UINT uFlags) 1465 1483 { 1466 1484 HIMAGELIST himl = NULL; … … 1489 1507 GetIconInfo (handle, &ii); 1490 1508 GetObjectA (ii.hbmMask, sizeof(BITMAP), (LPVOID)&bmp); 1491 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 1509 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 1492 1510 ILC_MASK | ILC_COLOR, 1, cGrow); 1493 1511 ImageList_Add (himl, ii.hbmColor, ii.hbmMask); … … 1497 1515 1498 1516 DeleteObject (handle); 1499 1517 1500 1518 return himl; 1501 1519 } … … 1503 1521 1504 1522 /************************************************************************* 1505 * ImageList_Merge [COMCTL32.65] 1523 * ImageList_Merge [COMCTL32.65] 1506 1524 * 1507 1525 * Creates a new image list that contains a merged image from the specified … … 1523 1541 HIMAGELIST WINAPI 1524 1542 ImageList_Merge (HIMAGELIST himl1, INT i1, HIMAGELIST himl2, INT i2, 1525 1543 INT dx, INT dy) 1526 1544 { 1527 1545 HIMAGELIST himlDst = NULL; … … 1532 1550 1533 1551 if ((himl1 == NULL) || (himl2 == NULL)) 1534 1552 return NULL; 1535 1553 1536 1554 /* check indices */ … … 1584 1602 nX1 = i1 * himl1->cx; 1585 1603 nX2 = i2 * himl2->cx; 1586 1604 1587 1605 /* copy image */ 1588 1606 SelectObject (hdcSrcImage, himl1->hbmImage); 1589 1607 SelectObject (hdcDstImage, himlDst->hbmImage); 1590 BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 1608 BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 1591 1609 hdcSrcImage, 0, 0, BLACKNESS); 1592 BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 1610 BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 1593 1611 hdcSrcImage, nX1, 0, SRCCOPY); 1594 1612 1595 1613 SelectObject (hdcSrcImage, himl2->hbmMask); 1596 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1614 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1597 1615 hdcSrcImage, nX2, 0, SRCAND); 1598 1616 1599 1617 SelectObject (hdcSrcImage, himl2->hbmImage); 1600 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1618 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1601 1619 hdcSrcImage, nX2, 0, SRCPAINT); 1602 1620 … … 1604 1622 SelectObject (hdcSrcImage, himl1->hbmMask); 1605 1623 SelectObject (hdcDstImage, himlDst->hbmMask); 1606 BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 1624 BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 1607 1625 hdcSrcImage, 0, 0, WHITENESS); 1608 BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 1626 BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 1609 1627 hdcSrcImage, nX1, 0, SRCCOPY); 1610 1628 1611 1629 SelectObject (hdcSrcImage, himl2->hbmMask); 1612 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1630 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1613 1631 hdcSrcImage, nX2, 0, SRCAND); 1614 1632 … … 1616 1634 DeleteDC (hdcDstImage); 1617 1635 } 1618 1636 1619 1637 return himlDst; 1620 1638 } … … 1711 1729 // TRACE(imagelist, " - Max. number of images: %d / %d (Old/New)\n", 1712 1730 // himl->cMaxImage, himl->cCurImage + himl->cGrow - 1); 1713 1731 1714 1732 hbmNewImage = 1715 1733 CreateBitmap (cxNew, himl->cy, 1, himl->uBitsPixel, NULL); … … 1726 1744 if (i > 0) { 1727 1745 // TRACE (imagelist, "Pre image copy: Copy %d images\n", i); 1728 1746 1729 1747 SelectObject (hdcSrc, himl->hbmImage); 1730 1748 SelectObject (hdcDst, hbmNewImage); … … 1777 1795 1778 1796 /************************************************************************* 1779 * ImageList_Replace [COMCTL32.68] 1797 * ImageList_Replace [COMCTL32.68] 1780 1798 * 1781 1799 * Replaces an image in an image list with a new image. … … 1794 1812 BOOL WINAPI 1795 1813 ImageList_Replace (HIMAGELIST himl, INT i, HBITMAP hbmImage, 1796 1814 HBITMAP hbmMask) 1797 1815 { 1798 1816 HDC hdcImageList, hdcImage; … … 1803 1821 return FALSE; 1804 1822 } 1805 1823 1806 1824 if ((i >= himl->cCurImage) || (i < 0)) { 1807 1825 // ERR (imagelist, "Invalid image index!\n"); … … 1864 1882 1865 1883 if (himl == NULL) 1866 1884 return -1; 1867 1885 if ((i >= himl->cCurImage) || (i < -1)) 1868 1886 return -1; 1869 1887 1870 1888 GetIconInfo (hIcon, &ii); 1871 1889 // if (ii.hbmMask == 0) 1872 // 1890 // ERR (imagelist, "no mask!\n"); 1873 1891 // if (ii.hbmColor == 0) 1874 // 1892 // ERR (imagelist, "no color!\n"); 1875 1893 GetObjectA (ii.hbmMask, sizeof(BITMAP), (LPVOID)&bmp); 1876 1894 … … 1888 1906 // TRACE (imagelist, "hdcImageList=0x%x!\n", hdcImageList); 1889 1907 // if (hdcImageList == 0) 1890 // 1908 // ERR (imagelist, "invalid hdcImageList!\n"); 1891 1909 1892 1910 hdcImage = CreateCompatibleDC (0); 1893 1911 // TRACE (imagelist, "hdcImage=0x%x!\n", hdcImage); 1894 1912 // if (hdcImage == 0) 1895 // 1913 // ERR (imagelist, "invalid hdcImage!\n"); 1896 1914 1897 1915 hbmOldDst = SelectObject (hdcImageList, himl->hbmImage); … … 1913 1931 1914 1932 if (hdcImageList) 1915 1933 DeleteDC (hdcImageList); 1916 1934 if (hdcImage) 1917 1935 DeleteDC (hdcImage); 1918 1936 if (ii.hbmColor) 1919 1937 DeleteObject (ii.hbmColor); 1920 1938 if (ii.hbmMask) 1921 1939 DeleteObject (ii.hbmMask); 1922 1940 1923 1941 return nIndex; … … 1926 1944 1927 1945 /************************************************************************* 1928 * ImageList_SetBkColor [COMCTL32.70] 1946 * ImageList_SetBkColor [COMCTL32.70] 1929 1947 * 1930 1948 * Sets the background color of an image list. … … 1945 1963 1946 1964 if (himl == NULL) 1947 1965 return CLR_NONE; 1948 1966 1949 1967 clrOldBk = himl->clrBk; … … 1974 1992 BOOL WINAPI 1975 1993 ImageList_SetDragCursorImage (HIMAGELIST himlDrag, INT iDrag, 1976 1994 INT dxHotspot, INT dyHotspot) 1977 1995 { 1978 1996 HIMAGELIST himlTemp; … … 1981 1999 1982 2000 if (himlInternalDrag == NULL) 1983 2001 return FALSE; 1984 2002 1985 2003 // TRACE (imagelist, " dxH=%d dyH=%d nX=%d nY=%d\n", 1986 // 2004 // dxHotspot, dyHotspot, nInternalDragHotspotX, nInternalDragHotspotY); 1987 2005 1988 2006 himlTemp = ImageList_Merge (himlInternalDrag, 0, himlDrag, iDrag, 1989 2007 dxHotspot, dyHotspot); 1990 2008 1991 2009 ImageList_Destroy (himlInternalDrag); … … 2000 2018 2001 2019 /************************************************************************* 2002 * ImageList_SetFilter [COMCTL32.76] 2020 * ImageList_SetFilter [COMCTL32.76] 2003 2021 * 2004 2022 * Sets a filter (or does something completely different)!!??? … … 2022 2040 { 2023 2041 // FIXME (imagelist, "(%p 0x%x 0x%lx):empty stub!\n", 2024 // 2042 // himl, i, dwFilter); 2025 2043 2026 2044 return FALSE; … … 2049 2067 2050 2068 if (!himl) 2051 2069 return FALSE; 2052 2070 2053 2071 /* remove all images*/ … … 2099 2117 2100 2118 if (!himl) 2101 2119 return FALSE; 2102 2120 if (himl->cCurImage >= iImageCount) 2103 2121 return FALSE; 2104 2122 if (himl->cMaxImage > iImageCount) 2105 2123 return TRUE; 2106 2124 2107 2125 nNewCount = iImageCount + himl->cGrow; … … 2118 2136 SelectObject (hdcBitmap, hbmNewBitmap); 2119 2137 2120 2138 /* copy images */ 2121 2139 BitBlt (hdcBitmap, 0, 0, nCopyCount * himl->cx, himl->cy, 2122 2140 hdcImageList, 0, 0, SRCCOPY); 2123 2141 2124 2125 2126 2127 PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, 2128 2129 2130 2131 2142 /* delete 'empty' image space */ 2143 SetBkColor (hdcBitmap, RGB(255, 255, 255)); 2144 SetTextColor (hdcBitmap, RGB(0, 0, 0)); 2145 PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, 2146 (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS); 2147 2148 DeleteObject (himl->hbmImage); 2149 himl->hbmImage = hbmNewBitmap; 2132 2150 } 2133 2151 // else 2134 // 2152 // ERR (imagelist, "Could not create new image bitmap !\n"); 2135 2153 2136 2154 if (himl->hbmMask) … … 2143 2161 SelectObject (hdcBitmap, hbmNewBitmap); 2144 2162 2145 2163 /* copy images */ 2146 2164 BitBlt (hdcBitmap, 0, 0, nCopyCount * himl->cx, himl->cy, 2147 2165 hdcImageList, 0, 0, SRCCOPY); 2148 2166 2149 2150 2151 2152 PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, 2153 2167 /* delete 'empty' image space */ 2168 SetBkColor (hdcBitmap, RGB(255, 255, 255)); 2169 SetTextColor (hdcBitmap, RGB(0, 0, 0)); 2170 PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, 2171 (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS); 2154 2172 2155 2173 DeleteObject (himl->hbmMask); … … 2191 2209 { 2192 2210 if (!himl) 2193 2211 return FALSE; 2194 2212 if ((iOverlay < 1) || (iOverlay > MAX_OVERLAYIMAGE)) 2195 2213 return FALSE; 2196 2214 if ((iImage < 0) || (iImage > himl->cCurImage)) 2197 2198 2215 return FALSE; 2216 2199 2217 himl->nOvlIdx[iOverlay - 1] = iImage; 2200 2218 return TRUE; … … 2227 2245 //{ 2228 2246 // if (!himl) 2229 // 2247 // return FALSE; 2230 2248 // 2231 2249 // FIXME (imagelist, "empty stub!\n");
Note:
See TracChangeset
for help on using the changeset viewer.