2 * ImageList implementation
4 * Copyright 1998 Eric Kohl
7 * - Improve the documentation.
8 * - Improve error checking in some functions.
9 * - Fix ILD_TRANSPARENT error in ImageList_DrawIndirect.
10 * - Fix offsets in ImageList_DrawIndirect.
11 * - Fix ImageList_GetIcon (might be a result of the
12 * ILD_TRANSPARENT error in ImageList_DrawIndirect).
13 * - Fix drag functions.
14 * - Fix all other stubs.
15 * - Add ImageList_SetFilter (undocumented).
16 * BTW does anybody know anything about this function???
17 * - It removes 12 Bytes from the stack (3 Parameters).
18 * - First parameter SHOULD be a HIMAGELIST.
19 * - Second parameter COULD be an index?????
20 * - Third parameter.... ?????????????????????
23 * - Test ImageList_GetImageRect (undocumented).
24 * - Test all the other functions.
27 * - ImageList_Draw, ImageList_DrawEx and ImageList_GetIcon use
28 * ImageList_DrawIndirect. Since ImageList_DrawIndirect is still
29 * partially imlemented, the functions mentioned above will be
30 * limited in functionality too.
33 /* This must be defined because the HIMAGELIST type is just a pointer
34 * to the _IMAGELIST data structure. But M$ does not want us to know
35 * anything about its contents. Applications just see a pointer to
36 * an empty structure. It's just to keep compatibility.
38 #define __WINE_IMAGELIST_C
40 /* This must be defined until "GetIconInfo" is implemented completely.
41 * To do that the Cursor and Icon code in objects/cursoricon.c must
44 #define __GET_ICON_INFO_HACK__
47 #include "imagelist.h"
51 #ifdef __GET_ICON_INFO_HACK__
56 #define _MAX(a,b) (((a)>(b))?(a):(b))
57 #define _MIN(a,b) (((a)>(b))?(b):(a))
59 #define MAX_OVERLAYIMAGE 15
63 * internal ImageList data used for dragging
65 static HIMAGELIST himlInternalDrag = NULL;
66 static INT32 nInternalDragHotspotX = 0;
67 static INT32 nInternalDragHotspotY = 0;
68 static HCURSOR32 hcurInternal = 0;
71 /*************************************************************************
72 * IMAGELIST_InternalGrowBitmaps [Internal]
74 * Grows the bitmaps of the given image list by the given number of
75 * images. Can NOT be used to reduce the number of images.
78 static void IMAGELIST_InternalGrowBitmaps (
79 HIMAGELIST himl, /* image list handle */
80 INT32 nImageCount) /* number of images to grow by */
82 HDC32 hdcImageList, hdcBitmap;
83 HBITMAP32 hbmNewBitmap;
84 INT32 nNewWidth, nNewCount;
86 TRACE(imagelist, "Create grown bitmaps!\n");
88 nNewCount = himl->cCurImage + nImageCount + himl->cGrow;
89 nNewWidth = nNewCount * himl->cx;
91 hdcImageList = CreateCompatibleDC32 (0);
92 hdcBitmap = CreateCompatibleDC32 (0);
95 CreateBitmap32 (nNewWidth, himl->cy, 1, himl->uBitsPixel, NULL);
96 if (hbmNewBitmap == 0)
97 ERR (imagelist, "Error creating new image bitmap!\n");
99 SelectObject32 (hdcImageList, himl->hbmImage);
100 SelectObject32 (hdcBitmap, hbmNewBitmap);
101 BitBlt32 (hdcBitmap, 0, 0, himl->cCurImage * himl->cx, himl->cy,
102 hdcImageList, 0, 0, SRCCOPY);
104 DeleteObject32 (himl->hbmImage);
105 himl->hbmImage = hbmNewBitmap;
109 CreateBitmap32 (nNewWidth, himl->cy, 1, 1, NULL);
111 if (hbmNewBitmap == 0)
112 ERR (imagelist, "Error creating new mask bitmap!");
114 SelectObject32 (hdcImageList, himl->hbmMask);
115 SelectObject32 (hdcBitmap, hbmNewBitmap);
116 BitBlt32 (hdcBitmap, 0, 0, himl->cCurImage * himl->cx, himl->cy,
117 hdcImageList, 0, 0, SRCCOPY);
118 DeleteObject32 (himl->hbmMask);
119 himl->hbmMask = hbmNewBitmap;
122 himl->cMaxImage = nNewCount;
124 DeleteDC32 (hdcImageList);
125 DeleteDC32 (hdcBitmap);
129 /*************************************************************************
130 * ImageList_Add [COMCTL32.39]
132 * Add an image (and a mask) to an image list.
135 * Index of the first image that was added.
136 * -1 if an error occurred.
139 INT32 WINAPI ImageList_Add (
140 HIMAGELIST himl, /* imagelist handle */
141 HBITMAP32 hbmImage, /* image bitmap */
142 HBITMAP32 hbmMask) /* mask bitmap */
144 HDC32 hdcImageList, hdcImage, hdcMask;
145 INT32 nFirstIndex, nImageCount;
146 INT32 nStartX, nRunX, nRunY;
149 if (himl == NULL) return (-1);
151 hdcMask = 0; /* to keep compiler happy ;-) */
153 GetObject32A (hbmImage, sizeof(BITMAP32), (LPVOID)&bmp);
154 nImageCount = bmp.bmWidth / himl->cx;
156 if (himl->cCurImage + nImageCount >= himl->cMaxImage)
157 IMAGELIST_InternalGrowBitmaps (himl, nImageCount);
159 hdcImageList = CreateCompatibleDC32 (0);
160 hdcImage = CreateCompatibleDC32 (0);
162 SelectObject32 (hdcImageList, himl->hbmImage);
163 SelectObject32 (hdcImage, hbmImage);
165 BitBlt32 (hdcImageList, himl->cCurImage * himl->cx, 0,
166 bmp.bmWidth, himl->cy, hdcImage, 0, 0, SRCCOPY);
172 SelectObject32 (hdcImageList, himl->hbmMask);
173 SelectObject32 (hdcImage, hbmMask);
174 BitBlt32 (hdcImageList, himl->cCurImage * himl->cx, 0,
175 bmp.bmWidth, himl->cy, hdcImage, 0, 0, SRCCOPY);
177 /* fix transparent areas of the image bitmap*/
178 SelectObject32 (hdcMask, himl->hbmMask);
179 SelectObject32 (hdcImage, himl->hbmImage);
180 nStartX = himl->cCurImage * himl->cx;
181 for (nRunY = 0; nRunY < himl->cy; nRunY++)
183 for (nRunX = 0; nRunX < bmp.bmWidth; nRunX++)
185 if (GetPixel32 (hdcMask, nStartX + nRunX, nRunY) ==
187 SetPixel32 (hdcImage, nStartX + nRunX, nRunY,
194 /* create mask from the imagelist's background color */
195 hdcMask = CreateCompatibleDC32 (0);
196 SelectObject32 (hdcMask, himl->hbmMask);
197 nStartX = himl->cCurImage * himl->cx;
198 for (nRunY = 0; nRunY < himl->cy; nRunY++)
200 for (nRunX = 0; nRunX < bmp.bmWidth; nRunX++)
202 if (GetPixel32 (hdcImageList, nStartX + nRunX, nRunY) ==
205 SetPixel32 (hdcImageList, nStartX + nRunX, nRunY,
207 SetPixel32 (hdcMask, nStartX + nRunX, nRunY,
211 SetPixel32 (hdcMask, nStartX + nRunX, nRunY,
215 DeleteDC32 (hdcMask);
219 DeleteDC32 (hdcImageList);
220 DeleteDC32 (hdcImage);
222 nFirstIndex = himl->cCurImage;
223 himl->cCurImage += nImageCount;
225 return (nFirstIndex);
229 /*************************************************************************
230 * ImageList_AddMasked [COMCTL32.41]
232 * Adds an image to an imagelist and creates a mask from the given
236 * Index of the first image that was added.
237 * -1 if an error occurred.
240 INT32 WINAPI ImageList_AddMasked (
241 HIMAGELIST himl, /* image list handle */
242 HBITMAP32 hbmImage, /* bitmap handle */
243 COLORREF clrMask) /* backround color of the image */
245 HDC32 hdcImageList, hdcImage, hdcMask;
246 INT32 nIndex, nImageCount;
248 INT32 nStartX, nRunX, nRunY;
250 if (himl == NULL) return (-1);
252 GetObject32A (hbmImage, sizeof(BITMAP32), &bmp);
253 nImageCount = bmp.bmWidth / himl->cx;
255 if (himl->cCurImage + nImageCount >= himl->cMaxImage)
256 IMAGELIST_InternalGrowBitmaps (himl, nImageCount);
258 nIndex = himl->cCurImage;
259 himl->cCurImage += nImageCount;
261 hdcImageList = CreateCompatibleDC32 (0);
262 hdcImage = CreateCompatibleDC32 (0);
264 SelectObject32 (hdcImageList, himl->hbmImage);
265 SelectObject32 (hdcImage, hbmImage);
266 BitBlt32 (hdcImageList, nIndex * himl->cx, 0, bmp.bmWidth, himl->cy,
267 hdcImage, 0, 0, SRCCOPY);
272 hdcMask = CreateCompatibleDC32 (0);
273 SelectObject32 (hdcMask, himl->hbmMask);
274 nStartX = nIndex * himl->cx;
275 for (nRunY = 0; nRunY < himl->cy; nRunY++)
277 for (nRunX = 0; nRunX < bmp.bmWidth; nRunX++)
279 if (GetPixel32 (hdcImageList, nStartX + nRunX, nRunY) ==
282 SetPixel32 (hdcImageList, nStartX + nRunX, nRunY,
284 SetPixel32 (hdcMask, nStartX + nRunX, nRunY,
288 SetPixel32 (hdcMask, nStartX + nRunX, nRunY, RGB(0, 0, 0));
291 DeleteDC32 (hdcMask);
294 DeleteDC32 (hdcImageList);
295 DeleteDC32 (hdcImage);
301 /*************************************************************************
302 * ImageList_BeginDrag [COMCTL32.42]
304 * Creates a temporary imagelist with an image in it, which will be used
311 BOOL32 WINAPI ImageList_BeginDrag (
312 HIMAGELIST himlTrack, /* Handle of the source imagelist */
313 INT32 iTrack, /* Index of the image in the source imagelist */
314 INT32 dxHotspot, /* Position of the hot spot of the */
315 INT32 dyHotspot) /* drag image */
317 HDC32 hdcSrc, hdcDst;
319 FIXME(imagelist, "ImageList_BeginDrag: partially implemented!\n");
321 if (himlTrack == NULL) return (FALSE);
322 if (himlInternalDrag)
323 ImageList_EndDrag ();
325 himlInternalDrag = ImageList_Create (himlTrack->cx, himlTrack->cy,
326 himlTrack->flags, 1, 1);
327 if (himlInternalDrag == NULL)
329 ERR(imagelist, "Error creating drag image list!\n");
333 nInternalDragHotspotX = dxHotspot;
334 nInternalDragHotspotY = dyHotspot;
336 hdcSrc = CreateCompatibleDC32 (0);
337 hdcDst = CreateCompatibleDC32 (0);
340 SelectObject32 (hdcSrc, himlTrack->hbmImage);
341 SelectObject32 (hdcDst, himlInternalDrag->hbmImage);
342 StretchBlt32 (hdcDst, 0, 0, himlInternalDrag->cx, himlInternalDrag->cy, hdcSrc,
343 iTrack * himlTrack->cx, 0, himlTrack->cx, himlTrack->cy, SRCCOPY);
346 SelectObject32 (hdcSrc, himlTrack->hbmMask);
347 SelectObject32 (hdcDst, himlInternalDrag->hbmMask);
348 StretchBlt32 (hdcDst, 0, 0, himlInternalDrag->cx, himlInternalDrag->cy, hdcSrc,
349 iTrack * himlTrack->cx, 0, himlTrack->cx, himlTrack->cy, SRCCOPY);
354 himlInternalDrag->cCurImage = 1;
360 /*************************************************************************
361 * ImageList_Copy [COMCTL32.43]
363 * Copies an image of the source imagelist to an image of the
364 * destination imagelist. Images can be copied or swapped.
365 * Copying from one imagelist to another is allowed, in contrary to
366 * M$'s original implementation. They just allow copying or swapping
367 * within one imagelist (himlDst and himlSrc must be the same).
373 BOOL32 WINAPI ImageList_Copy (
374 HIMAGELIST himlDst, /* Handle of the destination imagelist */
375 INT32 iDst, /* Index of the destination image */
376 HIMAGELIST himlSrc, /* Handel od the source imagelist */
377 INT32 iSrc, /* Index of the source image */
378 INT32 uFlags) /* Flags used for the copy operation */
380 HDC32 hdcSrc, hdcDst;
382 TRACE(imagelist, "iDst=%d iSrc=%d\n", iDst, iSrc);
384 if ((himlSrc == NULL) || (himlDst == NULL)) return (FALSE);
385 if ((iDst < 0) || (iDst >= himlDst->cCurImage)) return (FALSE);
386 if ((iSrc < 0) || (iSrc >= himlSrc->cCurImage)) return (FALSE);
388 hdcSrc = CreateCompatibleDC32 (0);
389 if (himlDst == himlSrc)
392 hdcDst = CreateCompatibleDC32 (0);
394 if (uFlags & ILCF_SWAP)
397 HBITMAP32 hbmTempImage, hbmTempMask;
399 /* create temporary bitmaps */
400 hbmTempImage = CreateBitmap32 (himlSrc->cx, himlSrc->cy, 1,
401 himlSrc->uBitsPixel, NULL);
402 hbmTempMask = CreateBitmap32 (himlSrc->cx, himlSrc->cy, 1, 1, NULL);
404 /* copy (and stretch) destination to temporary bitmaps.(save) */
406 SelectObject32 (hdcSrc, himlDst->hbmImage);
407 SelectObject32 (hdcDst, hbmTempImage);
408 StretchBlt32 (hdcDst, 0, 0, himlSrc->cx, himlSrc->cy,
409 hdcSrc, iDst * himlDst->cx, 0, himlDst->cx, himlDst->cy,
412 SelectObject32 (hdcSrc, himlDst->hbmMask);
413 SelectObject32 (hdcDst, hbmTempMask);
414 StretchBlt32 (hdcDst, 0, 0, himlSrc->cx, himlSrc->cy,
415 hdcSrc, iDst * himlDst->cx, 0, himlDst->cx, himlDst->cy,
418 /* copy (and stretch) source to destination */
420 SelectObject32 (hdcSrc, himlSrc->hbmImage);
421 SelectObject32 (hdcDst, himlDst->hbmImage);
422 StretchBlt32 (hdcDst, iDst * himlDst->cx, 0, himlDst->cx, himlDst->cy,
423 hdcSrc, iSrc * himlSrc->cx, 0, himlSrc->cx, himlSrc->cy,
426 SelectObject32 (hdcSrc, himlSrc->hbmMask);
427 SelectObject32 (hdcDst, himlDst->hbmMask);
428 StretchBlt32 (hdcDst, iDst * himlDst->cx, 0, himlDst->cx, himlDst->cy,
429 hdcSrc, iSrc * himlSrc->cx, 0, himlSrc->cx, himlSrc->cy,
432 /* copy (without stretching) temporary bitmaps to source (restore) */
434 SelectObject32 (hdcSrc, hbmTempImage);
435 SelectObject32 (hdcDst, himlSrc->hbmImage);
436 BitBlt32 (hdcDst, iSrc * himlSrc->cx, 0, himlSrc->cx, himlSrc->cy,
437 hdcSrc, 0, 0, SRCCOPY);
439 SelectObject32 (hdcSrc, hbmTempMask);
440 SelectObject32 (hdcDst, himlSrc->hbmMask);
441 BitBlt32 (hdcDst, iSrc * himlSrc->cx, 0, himlSrc->cx, himlSrc->cy,
442 hdcSrc, 0, 0, SRCCOPY);
444 /* delete temporary bitmaps */
445 DeleteObject32 (hbmTempMask);
446 DeleteObject32 (hbmTempImage);
451 SelectObject32 (hdcSrc, himlSrc->hbmImage);
452 if (himlSrc == himlDst)
455 SelectObject32 (hdcDst, himlDst->hbmImage);
456 StretchBlt32 (hdcDst, iDst * himlDst->cx, 0, himlDst->cx, himlDst->cy,
457 hdcSrc, iSrc * himlSrc->cx, 0, himlSrc->cx, himlSrc->cy,
461 SelectObject32 (hdcSrc, himlSrc->hbmMask);
462 if (himlSrc == himlDst)
465 SelectObject32 (hdcDst, himlDst->hbmMask);
466 StretchBlt32 (hdcDst, iDst * himlDst->cx, 0, himlDst->cx, himlDst->cy,
467 hdcSrc, iSrc * himlSrc->cx, 0, himlSrc->cx, himlSrc->cy,
472 if (himlSrc != himlDst)
479 /*************************************************************************
480 * ImageList_Create [COMCTL32.44]
482 * Creates an imagelist of the given image size and number of images.
485 * Handle of the created image list.
486 * 0 if an error occurred.
489 HIMAGELIST WINAPI ImageList_Create (
490 INT32 cx, /* Width of an image */
491 INT32 cy, /* Height of an image */
492 UINT32 flags, /* Flags for imagelist creation */
493 INT32 cInitial, /* Initial number of images in the imaglist */
494 INT32 cGrow) /* Number of images that is added to the */
495 /* imagelist when it grows */
501 WORD aBitBlend25[16] =
502 {0x7777, 0xDDDD, 0x7777, 0xDDDD, 0x7777, 0xDDDD, 0x7777, 0xDDDD,
503 0x7777, 0xDDDD, 0x7777, 0xDDDD, 0x7777, 0xDDDD, 0x7777, 0xDDDD};
504 WORD aBitBlend50[16] =
505 {0x5555, 0xAAAA, 0x5555, 0xAAAA, 0x5555, 0xAAAA, 0x5555, 0xAAAA,
506 0x5555, 0xAAAA, 0x5555, 0xAAAA, 0x5555, 0xAAAA, 0x5555, 0xAAAA};
508 himl = (HIMAGELIST)LocalAlloc32 (LMEM_FIXED | LMEM_ZEROINIT,
509 sizeof(struct _IMAGELIST));
515 himl->cMaxImage = cInitial + cGrow;
516 himl->cInitial = cInitial;
519 himl->clrBk = CLR_NONE;
521 /* initialize overlay mask indices */
522 for (nCount = 0; nCount <= MAX_OVERLAYIMAGE; nCount++)
523 himl->nOvlIdx[nCount] = -1;
525 hdc = CreateCompatibleDC32 (0);
526 himl->uBitsPixel = (UINT32)GetDeviceCaps32 (hdc, BITSPIXEL);
529 TRACE(imagelist, "Image: %d Bits per Pixel\n", himl->uBitsPixel);
532 CreateBitmap32 (himl->cx * himl->cMaxImage, himl->cy,
533 1, himl->uBitsPixel, NULL);
534 if (himl->hbmImage == 0)
536 ERR(imagelist, "Error creating image bitmap!\n");
540 if (himl->flags & ILC_MASK)
543 CreateBitmap32 (himl->cx * himl->cMaxImage, himl->cy, 1, 1, NULL);
544 if (himl->hbmMask == 0)
546 ERR(imagelist, "Error creating mask bitmap!\n");
548 DeleteObject32 (himl->hbmImage);
555 /* create blending brushes */
556 hbmTemp = CreateBitmap32 (16, 16, 1, 1, &aBitBlend25);
557 himl->hbrBlend25 = CreatePatternBrush32 (hbmTemp);
558 DeleteObject32 (hbmTemp);
560 hbmTemp = CreateBitmap32 (16, 16, 1, 1, &aBitBlend50);
561 himl->hbrBlend50 = CreatePatternBrush32 (hbmTemp);
562 DeleteObject32 (hbmTemp);
568 /*************************************************************************
569 * ImageList_Destroy [COMCTL32.45]
571 * Destroy the given imagelist.
574 * TRUE if the image list was destroyed.
575 * FALSE if an error occurred.
578 BOOL32 WINAPI ImageList_Destroy (
579 HIMAGELIST himl) /* Handle of the imagelist */
581 if (himl == NULL) return (FALSE);
584 DeleteObject32 (himl->hbmImage);
586 DeleteObject32 (himl->hbmMask);
588 LocalFree32 ((HLOCAL32)himl);
593 /*************************************************************************
594 * ImageList_DragEnter [COMCTL32.46]
597 * This is still an empty stub.
600 BOOL32 WINAPI ImageList_DragEnter (
605 FIXME (imagelist, "empty stub!\n");
607 hcurInternal = GetCursor32 ();
616 /*************************************************************************
617 * ImageList_DragLeave [COMCTL32.47]
620 BOOL32 WINAPI ImageList_DragLeave (
623 FIXME (imagelist, "empty stub!\n");
626 SetCursor32 (hcurInternal);
629 ShowCursor32 (FALSE);
635 /*************************************************************************
636 * ImageList_DragMove [COMCTL32.48]
639 BOOL32 WINAPI ImageList_DragMove (
643 FIXME (imagelist, "empty stub!\n");
646 // SetCursor32 (hcurInternal);
647 // ImageList_Draw (himlInternalDrag, 0, x, y, 0);
654 /*************************************************************************
655 * ImageList_DragShowNolock [COMCTL32.49]
659 ImageList_DragShowNolock (BOOL32 bShow)
661 FIXME (imagelist, "empty stub!\n");
667 /*************************************************************************
668 * ImageList_Draw [COMCTL32.50]
671 BOOL32 WINAPI ImageList_Draw (
679 IMAGELISTDRAWPARAMS imldp;
681 imldp.cbSize = sizeof(IMAGELISTDRAWPARAMS);
691 imldp.rgbBk = CLR_DEFAULT;
692 imldp.rgbFg = CLR_DEFAULT;
693 imldp.fStyle = fStyle;
696 return (ImageList_DrawIndirect (&imldp));
700 /*************************************************************************
701 * ImageList_DrawEx [COMCTL32.51]
704 BOOL32 WINAPI ImageList_DrawEx (
716 IMAGELISTDRAWPARAMS imldp;
718 imldp.cbSize = sizeof(IMAGELISTDRAWPARAMS);
730 imldp.fStyle = fStyle;
733 return (ImageList_DrawIndirect (&imldp));
737 /*************************************************************************
738 * ImageList_DrawIndirect [COMCTL32.52]
741 BOOL32 WINAPI ImageList_DrawIndirect (
742 IMAGELISTDRAWPARAMS *pimldp)
744 HIMAGELIST himlLocal;
745 HDC32 hdcImageList, hdcTempImage;
746 HBITMAP32 hbmTempImage;
747 HBRUSH32 hBrush, hOldBrush;
750 BOOL32 bImage; /* draw image ? */
751 BOOL32 bImageTrans; /* draw image transparent ? */
752 BOOL32 bMask; /* draw mask ? */
753 BOOL32 bMaskTrans; /* draw mask transparent ? */
757 if (pimldp == NULL) return (FALSE);
758 if (pimldp->cbSize < sizeof(IMAGELISTDRAWPARAMS)) return (FALSE);
760 himlLocal = pimldp->himl;
762 /* ILD_NORMAL state */
769 if ((himlLocal->clrBk == CLR_NONE) && (himlLocal->hbmMask))
776 /* ILD_IMAGE state (changes) */
777 if (pimldp->fStyle & ILD_IMAGE)
784 /* ILD_MASK state (changes) */
785 if ((pimldp->fStyle & ILD_MASK) && (himlLocal->hbmMask))
791 if ((pimldp->fStyle & ILD_TRANSPARENT) && (himlLocal->hbmMask))
796 if ((himlLocal->clrBk == CLR_NONE) && (himlLocal->hbmMask))
799 if (pimldp->fStyle & ILD_BLEND50)
801 else if (pimldp->fStyle & ILD_BLEND25)
804 hdcImageList = CreateCompatibleDC32 (0);
809 SelectObject32 (hdcImageList, himlLocal->hbmMask);
811 BitBlt32 (pimldp->hdcDst, pimldp->x, pimldp->y,
812 himlLocal->cx, himlLocal->cy, hdcImageList,
813 himlLocal->cx * pimldp->i, 0,
814 bMaskTrans ? SRCAND : SRCCOPY);
820 SelectObject32 (hdcImageList, himlLocal->hbmImage);
824 hBrush = CreateSolidBrush32 (himlLocal->clrBk);
825 hOldBrush = SelectObject32 (pimldp->hdcDst, hBrush);
826 PatBlt32 (pimldp->hdcDst, pimldp->x, pimldp->y,
827 himlLocal->cx, himlLocal->cy, PATCOPY);
828 DeleteObject32 (SelectObject32 (pimldp->hdcDst, hOldBrush));
831 BitBlt32 (pimldp->hdcDst, pimldp->x, pimldp->y, himlLocal->cx,
832 himlLocal->cy, hdcImageList, himlLocal->cx * pimldp->i, 0,
835 if (bBlend25 || bBlend50)
837 if (pimldp->rgbFg == CLR_DEFAULT)
838 clrBlend = GetSysColor32 (COLOR_HIGHLIGHT);
840 clrBlend = pimldp->rgbFg;
842 hdcTempImage = CreateCompatibleDC32 (0);
843 hbmTempImage = CreateBitmap32 (himlLocal->cx, himlLocal->cy,
844 1, himlLocal->uBitsPixel, NULL);
845 SelectObject32 (hdcTempImage, hbmTempImage);
849 SelectObject32 (hdcTempImage,
850 bBlend50 ? himlLocal->hbrBlend50 : himlLocal->hbrBlend25);
851 PatBlt32 (hdcTempImage, 0, 0, himlLocal->cx, himlLocal->cy, PATCOPY);
853 SelectObject32 (hdcImageList, himlLocal->hbmMask);
854 BitBlt32 (hdcTempImage, 0, 0, himlLocal->cx,
855 himlLocal->cy, hdcImageList,
856 pimldp->i * himlLocal->cx, 0, SRCPAINT);
858 BitBlt32 (pimldp->hdcDst, pimldp->x, pimldp->y, himlLocal->cx,
859 himlLocal->cy, hdcTempImage, 0, 0, SRCAND);
862 hBrush = CreateSolidBrush32 (clrBlend);
863 SelectObject32 (hdcTempImage, hBrush);
864 PatBlt32 (hdcTempImage, 0, 0, himlLocal->cx, himlLocal->cy, PATCOPY);
865 DeleteObject32 (hBrush);
867 SelectObject32 (hdcTempImage,
868 bBlend50 ? himlLocal->hbrBlend50 : himlLocal->hbrBlend25);
869 PatBlt32 (hdcTempImage, 0, 0, himlLocal->cx, himlLocal->cy, 0x0A0329);
871 SelectObject32 (hdcImageList, himlLocal->hbmMask);
872 BitBlt32 (hdcTempImage, 0, 0, himlLocal->cx,
873 himlLocal->cy, hdcImageList,
874 pimldp->i * himlLocal->cx, 0, SRCPAINT);
876 BitBlt32 (pimldp->hdcDst, pimldp->x, pimldp->y, himlLocal->cx,
877 himlLocal->cy, hdcTempImage, 0, 0, SRCPAINT);
879 DeleteObject32 (hbmTempImage);
880 DeleteDC32 (hdcTempImage);
884 /* Draw overlay image */
885 if (pimldp->fStyle & 0x0700)
887 nOvlIdx = (pimldp->fStyle & 0x0700) >> 8;
888 if ((nOvlIdx >= 1) && (nOvlIdx <= MAX_OVERLAYIMAGE))
890 nOvlIdx = pimldp->himl->nOvlIdx[nOvlIdx - 1];
891 if ((nOvlIdx >= 0) && (nOvlIdx <= pimldp->himl->cCurImage))
893 if (pimldp->himl->hbmMask)
895 SelectObject32 (hdcImageList, pimldp->himl->hbmMask);
896 BitBlt32 (pimldp->hdcDst, pimldp->x, pimldp->y,
897 pimldp->himl->cx, pimldp->himl->cy, hdcImageList,
898 pimldp->himl->cx * nOvlIdx, 0, SRCAND);
900 SelectObject32 (hdcImageList, pimldp->himl->hbmImage);
901 BitBlt32 (pimldp->hdcDst, pimldp->x, pimldp->y,
902 pimldp->himl->cx, pimldp->himl->cy, hdcImageList,
903 pimldp->himl->cx * nOvlIdx, 0, SRCPAINT);
908 DeleteDC32 (hdcImageList);
914 /*************************************************************************
915 * ImageList_Duplicate [COMCTL32.53]
917 * Duplicates an image list.
920 * Handle of duplicate image list, 0 if an error occurred.
923 HIMAGELIST WINAPI ImageList_Duplicate (
927 HDC32 hdcSrc, hdcDst;
929 if (himlSrc == NULL) {
930 ERR (imagelist, "Invalid image list handle!\n");
934 himlDst = ImageList_Create (himlSrc->cx, himlSrc->cy, himlSrc->flags,
935 himlSrc->cInitial, himlSrc->cGrow);
939 hdcSrc = CreateCompatibleDC32 (0);
940 hdcDst = CreateCompatibleDC32 (0);
941 SelectObject32 (hdcSrc, himlSrc->hbmImage);
942 SelectObject32 (hdcDst, himlDst->hbmImage);
943 BitBlt32 (hdcDst, 0, 0, himlSrc->cCurImage * himlSrc->cx, himlSrc->cy,
944 hdcSrc, 0, 0, SRCCOPY);
946 if (himlDst->hbmMask)
948 SelectObject32 (hdcSrc, himlSrc->hbmMask);
949 SelectObject32 (hdcDst, himlDst->hbmMask);
950 BitBlt32 (hdcDst, 0, 0, himlSrc->cCurImage * himlSrc->cx,
951 himlSrc->cy, hdcSrc, 0, 0, SRCCOPY);
962 /*************************************************************************
963 * ImageList_EndDrag [COMCTL32.54]
965 * Finishes a drag operation.
971 BOOL32 WINAPI ImageList_EndDrag (VOID)
973 FIXME (imagelist, "partially implemented!\n");
975 if (himlInternalDrag)
978 ImageList_Destroy (himlInternalDrag);
979 himlInternalDrag = NULL;
981 nInternalDragHotspotX = 0;
982 nInternalDragHotspotY = 0;
990 /*************************************************************************
991 * ImageList_GetBkColor [COMCTL32.55]
993 * Returns the background color of an image list.
999 COLORREF WINAPI ImageList_GetBkColor (
1002 return (himl->clrBk);
1006 /*************************************************************************
1007 * ImageList_GetDragImage [COMCTL32.56]
1009 * Returns the handle to the internal drag image list.
1015 HIMAGELIST WINAPI ImageList_GetDragImage (
1017 POINT32 *pptHotspot)
1019 FIXME (imagelist, "partially imlemented!\n");
1021 if (himlInternalDrag)
1022 return (himlInternalDrag);
1028 /*************************************************************************
1029 * ImageList_GetIcon [COMCTL32.57]
1032 HICON32 WINAPI ImageList_GetIcon (
1040 INT32 nWidth, nHeight;
1042 nWidth = GetSystemMetrics32 (SM_CXICON);
1043 nHeight = GetSystemMetrics32 (SM_CYICON);
1048 ii.hbmMask = CreateBitmap32 (nWidth, nHeight, 1, 1, NULL);
1049 ii.hbmColor = CreateBitmap32 (nWidth, nHeight, 1, 1, NULL);
1051 hdc = CreateCompatibleDC32(0);
1054 SelectObject32 (hdc, ii.hbmColor);
1055 PatBlt32 (hdc, 0, 0, nWidth, nHeight, BLACKNESS);
1056 ImageList_Draw (himl, i, hdc, 0, 0, fStyle | ILD_TRANSPARENT);
1059 SelectObject32 (hdc, ii.hbmMask);
1060 PatBlt32 (hdc, 0, 0, nWidth, nHeight, WHITENESS);
1061 ImageList_Draw (himl, i, hdc, 0, 0, fStyle | ILD_MASK);
1063 hIcon = CreateIconIndirect (&ii);
1066 DeleteObject32 (ii.hbmMask);
1067 DeleteObject32 (ii.hbmColor);
1073 /*************************************************************************
1074 * ImageList_GetIconSize [COMCTL32.58]
1077 BOOL32 WINAPI ImageList_GetIconSize (
1083 if (himl == NULL) return (FALSE);
1094 /*************************************************************************
1095 * ImageList_GetIconCount [COMCTL32.59]
1098 INT32 WINAPI ImageList_GetImageCount (
1101 return (himl->cCurImage);
1105 /*************************************************************************
1106 * ImageList_GetImageInfo [COMCTL32.60]
1109 BOOL32 WINAPI ImageList_GetImageInfo (
1112 IMAGEINFO *pImageInfo)
1114 if ((himl == NULL) || (pImageInfo == NULL)) return (FALSE);
1116 pImageInfo->hbmImage = himl->hbmImage;
1117 pImageInfo->hbmMask = himl->hbmMask;
1119 pImageInfo->rcImage.top = 0;
1120 pImageInfo->rcImage.bottom = himl->cy;
1121 pImageInfo->rcImage.left = i * himl->cx;
1122 pImageInfo->rcImage.right = (i+1) * himl->cx;
1128 /*************************************************************************
1129 * ImageList_GetImageRect [COMCTL32.61]
1132 * I don't know if it really returns a BOOL32 or something else!!!??
1135 BOOL32 WINAPI ImageList_GetImageRect (
1140 if (himl == NULL) return (FALSE);
1141 if ((i < 0) || (i >= himl->cCurImage)) return (FALSE);
1142 if (lpRect == NULL) return (FALSE);
1144 lpRect->left = i * himl->cx;
1146 lpRect->right = lpRect->left + himl->cx;
1147 lpRect->bottom = himl->cy;
1153 /*************************************************************************
1154 * ImageList_LoadImage32A [COMCTL32.63]
1157 HIMAGELIST WINAPI ImageList_LoadImage32A (
1166 HIMAGELIST himl = NULL;
1170 handle = LoadImage32A (hi, lpbmp, uType, 0, 0, uFlags);
1171 if (!handle) return (NULL);
1173 if (uType == IMAGE_BITMAP) {
1175 GetObject32A (handle, sizeof(BITMAP32), &bmp);
1176 nImageCount = bmp.bmWidth / cx;
1178 himl = ImageList_Create (cx, bmp.bmHeight, ILC_MASK | ILC_COLOR,
1179 nImageCount, cGrow);
1180 ImageList_AddMasked (himl, (HBITMAP32)handle, clrMask);
1182 else if ((uType == IMAGE_ICON) || (uType == IMAGE_CURSOR)) {
1183 #ifdef __GET_ICON_INFO_HACK__
1186 CURSORICONINFO *ptr;
1188 if (!(ptr = (CURSORICONINFO *)GlobalLock16(handle))) return (NULL);
1189 hbmMask = CreateBitmap32 (ptr->nWidth, ptr->nHeight, 1, 1,
1191 hbmImage = CreateBitmap32 (ptr->nWidth, ptr->nHeight, ptr->bPlanes,
1193 (char *)(ptr + 1) + ptr->nHeight *
1194 BITMAP_WIDTH_BYTES(ptr->nWidth, 1));
1195 himl = ImageList_Create (ptr->nWidth, ptr->nHeight,
1196 ILC_MASK | ILC_COLOR, 1, cGrow);
1197 ImageList_Add (himl, hbmImage, hbmMask);
1198 DeleteObject32 (hbmImage);
1199 DeleteObject32 (hbmMask);
1200 GlobalUnlock16 (handle);
1205 GetIconInfo (hIcon, &ii);
1206 GetObject32A (ii->hbmMask, sizeof(BITMAP32), (LPVOID)&bmp);
1207 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight,
1208 ILC_MASK | ILC_COLOR, 1, cGrow);
1209 ImageList_Add (himl, ii->hbmColor, ii->hbmMask);
1213 DeleteObject32 (handle);
1219 /*************************************************************************
1220 * ImageList_LoadImage32W [COMCTL32.64]
1223 HIMAGELIST WINAPI ImageList_LoadImage32W (
1232 HIMAGELIST himl = NULL;
1236 handle = LoadImage32W (hi, lpbmp, uType, 0, 0, uFlags);
1238 ERR (imagelist, "Error loading image!\n");
1242 if (uType == IMAGE_BITMAP) {
1244 GetObject32A (handle, sizeof(BITMAP32), &bmp);
1245 nImageCount = bmp.bmWidth / cx;
1247 himl = ImageList_Create (cx, bmp.bmHeight, ILC_MASK | ILC_COLOR,
1248 nImageCount, cGrow);
1249 ImageList_AddMasked (himl, (HBITMAP32)handle, clrMask);
1251 else if ((uType == IMAGE_ICON) || (uType == IMAGE_CURSOR)) {
1252 #ifdef __GET_ICON_INFO_HACK__
1255 CURSORICONINFO *ptr;
1257 if (!(ptr = (CURSORICONINFO *)GlobalLock16(handle))) return (NULL);
1258 hbmMask = CreateBitmap32 (ptr->nWidth, ptr->nHeight, 1, 1,
1260 hbmImage = CreateBitmap32 (ptr->nWidth, ptr->nHeight, ptr->bPlanes,
1262 (char *)(ptr + 1) + ptr->nHeight *
1263 BITMAP_WIDTH_BYTES(ptr->nWidth, 1));
1264 himl = ImageList_Create (ptr->nWidth, ptr->nHeight,
1265 ILC_MASK | ILC_COLOR, 1, cGrow);
1266 ImageList_Add (himl, hbmImage, hbmMask);
1267 DeleteObject32 (hbmImage);
1268 DeleteObject32 (hbmMask);
1269 GlobalUnlock16 (handle);
1274 GetIconInfo (hIcon, &ii);
1275 GetObject32A (ii->hbmMask, sizeof(BITMAP32), (LPVOID)&bmp);
1276 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight,
1277 ILC_MASK | ILC_COLOR, 1, cGrow);
1278 ImageList_Add (himl, ii->hbmColor, ii->hbmMask);
1282 DeleteObject32 (handle);
1288 /*************************************************************************
1289 * ImageList_Merge [COMCTL32.65]
1292 HIMAGELIST WINAPI ImageList_Merge (
1300 HIMAGELIST himlDst = NULL;
1301 HDC32 hdcSrcImage, hdcDstImage;
1303 INT32 xOff1, yOff1, xOff2, yOff2;
1306 if ((himl1 == NULL) || (himl2 == NULL)) return (NULL);
1309 if ((i1 < 0) || (i1 >= himl1->cCurImage)) {
1310 ERR (imagelist, "Index 1 out of range! %d\n", i1);
1314 if ((i2 < 0) || (i2 >= himl2->cCurImage)) {
1315 ERR (imagelist, "Index 2 out of range! %d\n", i2);
1320 cxDst = _MAX (himl1->cx, xOffs + himl2->cx);
1324 else if (xOffs < 0) {
1325 cxDst = _MAX (himl2->cx, himl1->cx - xOffs);
1336 cyDst = _MAX (himl1->cy, yOffs + himl2->cy);
1340 else if (yOffs < 0) {
1341 cyDst = _MAX (himl2->cy, himl1->cy - yOffs);
1351 himlDst = ImageList_Create (cxDst, cyDst, ILC_MASK | ILC_COLOR, 1, 1);
1354 hdcSrcImage = CreateCompatibleDC32 (0);
1355 hdcDstImage = CreateCompatibleDC32 (0);
1356 nX1 = i1 * himl1->cx;
1357 nX2 = i2 * himl2->cx;
1360 SelectObject32 (hdcSrcImage, himl1->hbmImage);
1361 SelectObject32 (hdcDstImage, himlDst->hbmImage);
1362 BitBlt32 (hdcDstImage, 0, 0, cxDst, cyDst,
1363 hdcSrcImage, 0, 0, BLACKNESS);
1364 BitBlt32 (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy,
1365 hdcSrcImage, nX1, 0, SRCCOPY);
1367 SelectObject32 (hdcSrcImage, himl2->hbmMask);
1368 BitBlt32 (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy,
1369 hdcSrcImage, nX2, 0, SRCAND);
1371 SelectObject32 (hdcSrcImage, himl2->hbmImage);
1372 BitBlt32 (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy,
1373 hdcSrcImage, nX2, 0, SRCPAINT);
1376 SelectObject32 (hdcSrcImage, himl1->hbmMask);
1377 SelectObject32 (hdcDstImage, himlDst->hbmMask);
1378 BitBlt32 (hdcDstImage, 0, 0, cxDst, cyDst,
1379 hdcSrcImage, 0, 0, WHITENESS);
1380 BitBlt32 (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy,
1381 hdcSrcImage, nX1, 0, SRCCOPY);
1383 SelectObject32 (hdcSrcImage, himl2->hbmMask);
1384 BitBlt32 (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy,
1385 hdcSrcImage, nX2, 0, SRCAND);
1387 DeleteDC32 (hdcSrcImage);
1388 DeleteDC32 (hdcDstImage);
1396 #if __IStream_INTERFACE_DEFINED__
1397 HIMAGELIST WINAPI ImageList_Read (
1400 FIXME (imagelist, "empty stub!\n");
1405 #endif /* __IStream_INTERFACE_DEFINED__ */
1409 BOOL32 WINAPI ImageList_Remove (
1413 HBITMAP32 hbmNewImage, hbmNewMask;
1414 HDC32 hdcSrc, hdcDst;
1415 INT32 cxNew, nCount;
1417 if ((i < -1) || (i >= himl->cCurImage)) {
1418 ERR (imagelist, "Index out of range! %d\n", i);
1422 if (himl->cCurImage == 0) {
1423 ERR (imagelist, "List is already empty!\n");
1429 TRACE (imagelist, "Remove all!\n");
1431 himl->cMaxImage = himl->cInitial + himl->cGrow;
1432 himl->cCurImage = 0;
1433 for (nCount = 0; nCount <= MAX_OVERLAYIMAGE; nCount++)
1434 himl->nOvlIdx[nCount] = -1;
1436 DeleteObject32 (himl->hbmImage);
1438 CreateBitmap32 (himl->cMaxImage * himl->cx, himl->cy,
1439 1, himl->uBitsPixel, NULL);
1441 if (himl->hbmMask) {
1442 DeleteObject32 (himl->hbmMask);
1444 CreateBitmap32 (himl->cMaxImage * himl->cx, himl->cy,
1449 /* delete one image */
1450 TRACE (imagelist, "Remove single image! %d\n", i);
1452 /* create new bitmap(s) */
1453 cxNew = (himl->cCurImage + himl->cGrow - 1) * himl->cx;
1455 TRACE(imagelist, " - Number of images: %d / %d (Old/New)\n",
1456 himl->cCurImage, himl->cCurImage - 1);
1457 TRACE(imagelist, " - Max. number of images: %d / %d (Old/New)\n",
1458 himl->cMaxImage, himl->cCurImage + himl->cGrow - 1);
1461 CreateBitmap32 (cxNew, himl->cy, 1, himl->uBitsPixel, NULL);
1464 hbmNewMask = CreateBitmap32 (cxNew, himl->cy, 1, 1, NULL);
1466 hbmNewMask = 0; /* Just to keep compiler happy! */
1468 hdcSrc = CreateCompatibleDC32 (0);
1469 hdcDst = CreateCompatibleDC32 (0);
1471 /* copy all images and masks prior to the "removed" image */
1473 TRACE (imagelist, "Pre image copy: Copy %d images\n", i);
1475 SelectObject32 (hdcSrc, himl->hbmImage);
1476 SelectObject32 (hdcDst, hbmNewImage);
1477 BitBlt32 (hdcDst, 0, 0, i * himl->cx, himl->cy,
1478 hdcSrc, 0, 0, SRCCOPY);
1480 if (himl->hbmMask) {
1481 SelectObject32 (hdcSrc, himl->hbmMask);
1482 SelectObject32 (hdcDst, hbmNewMask);
1483 BitBlt32 (hdcDst, 0, 0, i * himl->cx, himl->cy,
1484 hdcSrc, 0, 0, SRCCOPY);
1488 /* copy all images and masks behind the removed image */
1489 if (i < himl->cCurImage - 1) {
1490 TRACE (imagelist, "Post image copy!\n");
1491 SelectObject32 (hdcSrc, himl->hbmImage);
1492 SelectObject32 (hdcDst, hbmNewImage);
1493 BitBlt32 (hdcDst, i * himl->cx, 0, (himl->cCurImage - i - 1) * himl->cx,
1494 himl->cy, hdcSrc, (i + 1) * himl->cx, 0, SRCCOPY);
1496 if (himl->hbmMask) {
1497 SelectObject32 (hdcSrc, himl->hbmMask);
1498 SelectObject32 (hdcDst, hbmNewMask);
1499 BitBlt32 (hdcDst, i * himl->cx, 0,
1500 (himl->cCurImage - i - 1) * himl->cx,
1501 himl->cy, hdcSrc, (i + 1) * himl->cx, 0, SRCCOPY);
1505 DeleteDC32 (hdcSrc);
1506 DeleteDC32 (hdcDst);
1508 /* delete old images and insert new ones */
1509 DeleteObject32 (himl->hbmImage);
1510 himl->hbmImage = hbmNewImage;
1511 if (himl->hbmMask) {
1512 DeleteObject32 (himl->hbmMask);
1513 himl->hbmMask = hbmNewMask;
1517 himl->cMaxImage = himl->cCurImage + himl->cGrow;
1524 BOOL32 WINAPI ImageList_Replace (
1530 HDC32 hdcImageList, hdcImage;
1534 ERR (imagelist, "Invalid image list handle!\n");
1538 if ((i >= himl->cCurImage) || (i < 0)) {
1539 ERR (imagelist, "Invalid image index!\n");
1543 hdcImageList = CreateCompatibleDC32 (0);
1544 hdcImage = CreateCompatibleDC32 (0);
1545 GetObject32A (hbmImage, sizeof(BITMAP32), (LPVOID)&bmp);
1548 SelectObject32 (hdcImageList, himl->hbmImage);
1549 SelectObject32 (hdcImage, hbmImage);
1551 StretchBlt32 (hdcImageList, i * himl->cx, 0, himl->cx, himl->cy,
1552 hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
1557 SelectObject32 (hdcImageList, himl->hbmMask);
1558 SelectObject32 (hdcImage, hbmMask);
1560 StretchBlt32 (hdcImageList, i * himl->cx, 0, himl->cx, himl->cy,
1561 hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
1564 DeleteDC32 (hdcImage);
1565 DeleteDC32 (hdcImageList);
1571 INT32 WINAPI ImageList_ReplaceIcon (
1576 HDC32 hdcImageList, hdcImage;
1578 #ifdef __GET_ICON_INFO_HACK__
1581 CURSORICONINFO *ptr;
1587 if (himl == NULL) return (-1);
1588 if ((i >= himl->cCurImage) || (i < -1)) return (-1);
1590 #ifdef __GET_ICON_INFO_HACK__
1591 if (!(ptr = (CURSORICONINFO *)GlobalLock16(hIcon))) return (-1);
1592 hbmMask = CreateBitmap32 (ptr->nWidth, ptr->nHeight, 1, 1,
1594 hbmImage = CreateBitmap32 (ptr->nWidth, ptr->nHeight, ptr->bPlanes,
1596 (char *)(ptr + 1) + ptr->nHeight *
1597 BITMAP_WIDTH_BYTES(ptr->nWidth, 1));
1599 GetIconInfo (hIcon, &ii);
1600 GetObject32A (ii->hbmMask, sizeof(BITMAP32), (LPVOID)&bmp);
1604 if (himl->cCurImage + 1 >= himl->cMaxImage)
1605 IMAGELIST_InternalGrowBitmaps (himl, 1);
1607 nIndex = himl->cCurImage;
1613 hdcImageList = CreateCompatibleDC32 (0);
1614 hdcImage = CreateCompatibleDC32 (0);
1616 #ifdef __GET_ICON_INFO_HACK__
1617 SelectObject32 (hdcImageList, himl->hbmImage);
1618 SelectObject32 (hdcImage, hbmImage);
1619 StretchBlt32 (hdcImageList, nIndex * himl->cx, 0, himl->cx, himl->cy,
1620 hdcImage, 0, 0, ptr->nWidth, ptr->nHeight, SRCCOPY);
1622 SelectObject32 (hdcImage, ii->hbmColor);
1623 StretchBlt32 (hdcImageList, nIndex * himl->cx, 0, himl->cx, himl->cy,
1624 hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
1627 if (himl->hbmMask) {
1628 #ifdef __GET_ICON_INFO_HACK__
1629 SelectObject32 (hdcImageList, himl->hbmMask);
1630 SelectObject32 (hdcImage, hbmMask);
1631 StretchBlt32 (hdcImageList, nIndex * himl->cx, 0, himl->cx, himl->cy,
1632 hdcImage, 0, 0, ptr->nWidth, ptr->nHeight, SRCCOPY);
1634 SelectObject32 (hdcImage, ii->hbmMask);
1635 StretchBlt32 (hdcImageList, nIndex * himl->cx, 0, himl->cx, himl->cy,
1636 hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
1640 DeleteDC32 (hdcImageList);
1641 DeleteDC32 (hdcImage);
1642 #ifdef __GET_ICON_INFO_HACK
1643 DeleteObject32 (hbmImage);
1644 DeleteObject32 (hbmMask);
1645 GlobalUnlock16 (hIcon);
1651 COLORREF WINAPI ImageList_SetBkColor (
1657 clrOldBk = himl->clrBk;
1658 himl->clrBk = clrBk;
1663 BOOL32 WINAPI ImageList_SetDragCursorImage (
1664 HIMAGELIST himlDrag,
1669 FIXME (imagelist, "empty stub!\n");
1676 BOOL32 WINAPI ImageList_SetFilter (
1681 FIXME (imagelist, "empty stub!\n");
1688 BOOL32 WINAPI ImageList_SetIconSize (
1695 /* remove all images*/
1696 himl->cMaxImage = himl->cInitial + himl->cGrow;
1697 himl->cCurImage = 0;
1701 /* initialize overlay mask indices */
1702 for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
1703 himl->nOvlIdx[nCount] = -1;
1705 DeleteObject32 (himl->hbmImage);
1707 CreateBitmap32 (himl->cMaxImage * himl->cx, himl->cy,
1708 1, himl->uBitsPixel, NULL);
1710 if (himl->hbmMask) {
1711 DeleteObject32 (himl->hbmMask);
1713 CreateBitmap32 (himl->cMaxImage * himl->cx, himl->cy,
1721 BOOL32 WINAPI ImageList_SetImageCount (
1725 HDC32 hdcImageList, hdcBitmap;
1726 HBITMAP32 hbmNewBitmap;
1727 INT32 nNewCount, nCopyCount;
1729 if (himl == NULL) return (FALSE);
1730 if (himl->cCurImage <= iImageCount) return (FALSE);
1731 if (himl->cMaxImage > iImageCount) return (TRUE);
1733 nNewCount = iImageCount + himl->cGrow;
1734 nCopyCount = _MIN(himl->cCurImage, iImageCount);
1736 hdcImageList = CreateCompatibleDC32 (0);
1737 hdcBitmap = CreateCompatibleDC32 (0);
1739 hbmNewBitmap = CreateBitmap32 (nNewCount * himl->cx, himl->cy,
1740 1, himl->uBitsPixel, NULL);
1741 if (hbmNewBitmap == 0)
1743 SelectObject32 (hdcImageList, himl->hbmImage);
1744 SelectObject32 (hdcBitmap, hbmNewBitmap);
1745 BitBlt32 (hdcBitmap, 0, 0, nCopyCount * himl->cx, himl->cy,
1746 hdcImageList, 0, 0, SRCCOPY);
1747 DeleteObject32 (himl->hbmImage);
1748 himl->hbmImage = hbmNewBitmap;
1752 WARN (imagelist, "Could not create new image bitmap !\n");
1757 hbmNewBitmap = CreateBitmap32 (nNewCount * himl->cx, himl->cy,
1759 if (hbmNewBitmap != 0)
1761 SelectObject32 (hdcImageList, himl->hbmMask);
1762 SelectObject32 (hdcBitmap, hbmNewBitmap);
1763 BitBlt32 (hdcBitmap, 0, 0, nCopyCount * himl->cx, himl->cy,
1764 hdcImageList, 0, 0, SRCCOPY);
1765 DeleteObject32 (himl->hbmMask);
1766 himl->hbmMask = hbmNewBitmap;
1770 WARN (imagelist, "Could not create new mask bitmap!\n");
1774 DeleteDC32 (hdcImageList);
1775 DeleteDC32 (hdcBitmap);
1777 /* Update max image count and current image count */
1778 himl->cMaxImage = nNewCount;
1779 if (himl->cCurImage > nCopyCount)
1780 himl->cCurImage = nCopyCount;
1786 BOOL32 WINAPI ImageList_SetOverlayImage (
1791 if ((iOverlay < 1) || (iOverlay > MAX_OVERLAYIMAGE)) return (FALSE);
1792 if ((iImage < 0) || (iImage > himl->cCurImage)) return (FALSE);
1794 himl->nOvlIdx[iOverlay - 1] = iImage;
1800 #if __IStream_INTERFACE_DEFINED__
1801 BOOL32 WINAPI ImageList_Write (
1805 FIXME (imagelist, "empty stub!\n");
1810 #endif /* __IStream_INTERFACE_DEFINED__ */