ReactOS 0.4.15-dev-5667-ged97270
imagelist.c File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "winerror.h"
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commctrl.h"
#include "comctl32.h"
#include "commoncontrols.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/heap.h"
#include "pshpack2.h"
#include "poppack.h"
Include dependency graph for imagelist.c:

Go to the source code of this file.

Classes

struct  _IMAGELIST
 
struct  _ILHEAD
 
struct  INTERNALDRAG
 

Macros

#define COBJMACROS
 
#define MAX_OVERLAYIMAGE   15
 
#define IMAGELIST_MAGIC   0x53414D58
 
#define TILE_COUNT   4
 

Typedefs

typedef struct _ILHEAD ILHEAD
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (imagelist)
 
static HIMAGELIST impl_from_IImageList2 (IImageList2 *iface)
 
static HBITMAP ImageList_CreateImage (HDC hdc, HIMAGELIST himl, UINT count)
 
static HRESULT ImageListImpl_CreateInstance (const IUnknown *pUnkOuter, REFIID iid, void **ppv)
 
static BOOL is_valid (HIMAGELIST himl)
 
static UINT imagelist_height (UINT count)
 
static void imagelist_point_from_index (HIMAGELIST himl, UINT index, LPPOINT pt)
 
static void imagelist_get_bitmap_size (HIMAGELIST himl, UINT count, SIZE *sz)
 
static int get_dib_stride (int width, int bpp)
 
static int get_dib_image_size (const BITMAPINFO *info)
 
static void imagelist_copy_images (HIMAGELIST himl, HDC hdcSrc, HDC hdcDest, UINT src, UINT count, UINT dest)
 
static void add_dib_bits (HIMAGELIST himl, int pos, int count, int width, int height, BITMAPINFO *info, BITMAPINFO *mask_info, DWORD *bits, BYTE *mask_bits)
 
static BOOL add_with_alpha (HIMAGELIST himl, HDC hdc, int pos, int count, int width, int height, HBITMAP hbmImage, HBITMAP hbmMask)
 
UINT WINAPI ImageList_SetColorTable (HIMAGELIST himl, UINT uStartIndex, UINT cEntries, const RGBQUAD *prgb)
 
static void IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount)
 
INT WINAPI ImageList_Add (HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
 
INT WINAPI ImageList_AddIcon (HIMAGELIST himl, HICON hIcon)
 
INT WINAPI ImageList_AddMasked (HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
 
BOOL WINAPI ImageList_BeginDrag (HIMAGELIST himlTrack, INT iTrack, INT dxHotspot, INT dyHotspot)
 
BOOL WINAPI ImageList_Copy (HIMAGELIST himlDst, INT iDst, HIMAGELIST himlSrc, INT iSrc, UINT uFlags)
 
HIMAGELIST WINAPI ImageList_Create (INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
 
BOOL WINAPI ImageList_Destroy (HIMAGELIST himl)
 
BOOL WINAPI ImageList_DragEnter (HWND hwndLock, INT x, INT y)
 
BOOL WINAPI ImageList_DragLeave (HWND hwndLock)
 
static void ImageList_InternalDragDraw (HDC hdc, INT x, INT y)
 
BOOL WINAPI ImageList_DragMove (INT x, INT y)
 
BOOL WINAPI ImageList_DragShowNolock (BOOL bShow)
 
BOOL WINAPI ImageList_Draw (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
 
BOOL WINAPI ImageList_DrawEx (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
 
static BOOL alpha_blend_image (HIMAGELIST himl, HDC dest_dc, int dest_x, int dest_y, int src_x, int src_y, int cx, int cy, BLENDFUNCTION func, UINT style, COLORREF blend_col)
 
BOOL WINAPI ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
 
HIMAGELIST WINAPI ImageList_Duplicate (HIMAGELIST himlSrc)
 
VOID WINAPI ImageList_EndDrag (void)
 
COLORREF WINAPI ImageList_GetBkColor (HIMAGELIST himl)
 
HIMAGELIST WINAPI ImageList_GetDragImage (POINT *ppt, POINT *pptHotspot)
 
DWORD WINAPI ImageList_GetFlags (HIMAGELIST himl)
 
HICON WINAPI ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle)
 
BOOL WINAPI ImageList_GetIconSize (HIMAGELIST himl, INT *cx, INT *cy)
 
INT WINAPI ImageList_GetImageCount (HIMAGELIST himl)
 
BOOL WINAPI ImageList_GetImageInfo (HIMAGELIST himl, INT i, IMAGEINFO *pImageInfo)
 
BOOL WINAPI ImageList_GetImageRect (HIMAGELIST himl, INT i, LPRECT lpRect)
 
HIMAGELIST WINAPI ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow, COLORREF clrMask, UINT uType, UINT uFlags)
 
HIMAGELIST WINAPI ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow, COLORREF clrMask, UINT uType, UINT uFlags)
 
HIMAGELIST WINAPI ImageList_Merge (HIMAGELIST himl1, INT i1, HIMAGELIST himl2, INT i2, INT dx, INT dy)
 
static voidread_bitmap (IStream *pstm, BITMAPINFO *bmi)
 
HIMAGELIST WINAPI ImageList_Read (IStream *pstm)
 
BOOL WINAPI ImageList_Remove (HIMAGELIST himl, INT i)
 
BOOL WINAPI ImageList_Replace (HIMAGELIST himl, INT i, HBITMAP hbmImage, HBITMAP hbmMask)
 
INT WINAPI ImageList_ReplaceIcon (HIMAGELIST himl, INT nIndex, HICON hIcon)
 
COLORREF WINAPI ImageList_SetBkColor (HIMAGELIST himl, COLORREF clrBk)
 
BOOL WINAPI ImageList_SetDragCursorImage (HIMAGELIST himlDrag, INT iDrag, INT dxHotspot, INT dyHotspot)
 
BOOL WINAPI ImageList_SetFilter (HIMAGELIST himl, INT i, DWORD dwFilter)
 
DWORD WINAPI ImageList_SetFlags (HIMAGELIST himl, DWORD flags)
 
BOOL WINAPI ImageList_SetIconSize (HIMAGELIST himl, INT cx, INT cy)
 
BOOL WINAPI ImageList_SetImageCount (HIMAGELIST himl, UINT iImageCount)
 
BOOL WINAPI ImageList_SetOverlayImage (HIMAGELIST himl, INT iImage, INT iOverlay)
 
static BOOL _write_bitmap (HBITMAP hBitmap, IStream *pstm)
 
BOOL WINAPI ImageList_Write (HIMAGELIST himl, IStream *pstm)
 
HRESULT WINAPI ImageList_CoCreateInstance (REFCLSID rclsid, const IUnknown *punkOuter, REFIID riid, void **ppv)
 
static HRESULT WINAPI ImageListImpl_QueryInterface (IImageList2 *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI ImageListImpl_AddRef (IImageList2 *iface)
 
static ULONG WINAPI ImageListImpl_Release (IImageList2 *iface)
 
static HRESULT WINAPI ImageListImpl_Add (IImageList2 *iface, HBITMAP hbmImage, HBITMAP hbmMask, int *pi)
 
static HRESULT WINAPI ImageListImpl_ReplaceIcon (IImageList2 *iface, int i, HICON hicon, int *pi)
 
static HRESULT WINAPI ImageListImpl_SetOverlayImage (IImageList2 *iface, int iImage, int iOverlay)
 
static HRESULT WINAPI ImageListImpl_Replace (IImageList2 *iface, int i, HBITMAP hbmImage, HBITMAP hbmMask)
 
static HRESULT WINAPI ImageListImpl_AddMasked (IImageList2 *iface, HBITMAP hbmImage, COLORREF crMask, int *pi)
 
static HRESULT WINAPI ImageListImpl_Draw (IImageList2 *iface, IMAGELISTDRAWPARAMS *pimldp)
 
static HRESULT WINAPI ImageListImpl_Remove (IImageList2 *iface, int i)
 
static HRESULT WINAPI ImageListImpl_GetIcon (IImageList2 *iface, int i, UINT flags, HICON *picon)
 
static HRESULT WINAPI ImageListImpl_GetImageInfo (IImageList2 *iface, int i, IMAGEINFO *pImageInfo)
 
static HRESULT WINAPI ImageListImpl_Copy (IImageList2 *iface, int dst_index, IUnknown *unk_src, int src_index, UINT flags)
 
static HRESULT WINAPI ImageListImpl_Merge (IImageList2 *iface, int i1, IUnknown *punk2, int i2, int dx, int dy, REFIID riid, void **ppv)
 
static HRESULT WINAPI ImageListImpl_Clone (IImageList2 *iface, REFIID riid, void **ppv)
 
static HRESULT WINAPI ImageListImpl_GetImageRect (IImageList2 *iface, int i, RECT *prc)
 
static HRESULT WINAPI ImageListImpl_GetIconSize (IImageList2 *iface, int *cx, int *cy)
 
static HRESULT WINAPI ImageListImpl_SetIconSize (IImageList2 *iface, int cx, int cy)
 
static HRESULT WINAPI ImageListImpl_GetImageCount (IImageList2 *iface, int *pi)
 
static HRESULT WINAPI ImageListImpl_SetImageCount (IImageList2 *iface, UINT count)
 
static HRESULT WINAPI ImageListImpl_SetBkColor (IImageList2 *iface, COLORREF clrBk, COLORREF *pclr)
 
static HRESULT WINAPI ImageListImpl_GetBkColor (IImageList2 *iface, COLORREF *pclr)
 
static HRESULT WINAPI ImageListImpl_BeginDrag (IImageList2 *iface, int iTrack, int dxHotspot, int dyHotspot)
 
static HRESULT WINAPI ImageListImpl_EndDrag (IImageList2 *iface)
 
static HRESULT WINAPI ImageListImpl_DragEnter (IImageList2 *iface, HWND hwndLock, int x, int y)
 
static HRESULT WINAPI ImageListImpl_DragLeave (IImageList2 *iface, HWND hwndLock)
 
static HRESULT WINAPI ImageListImpl_DragMove (IImageList2 *iface, int x, int y)
 
static HRESULT WINAPI ImageListImpl_SetDragCursorImage (IImageList2 *iface, IUnknown *punk, int iDrag, int dxHotspot, int dyHotspot)
 
static HRESULT WINAPI ImageListImpl_DragShowNolock (IImageList2 *iface, BOOL fShow)
 
static HRESULT WINAPI ImageListImpl_GetDragImage (IImageList2 *iface, POINT *ppt, POINT *pptHotspot, REFIID riid, PVOID *ppv)
 
static HRESULT WINAPI ImageListImpl_GetItemFlags (IImageList2 *iface, int i, DWORD *dwFlags)
 
static HRESULT WINAPI ImageListImpl_GetOverlayImage (IImageList2 *iface, int iOverlay, int *piIndex)
 
static HRESULT WINAPI ImageListImpl_Resize (IImageList2 *iface, INT cx, INT cy)
 
static HRESULT WINAPI ImageListImpl_GetOriginalSize (IImageList2 *iface, INT image, DWORD flags, INT *cx, INT *cy)
 
static HRESULT WINAPI ImageListImpl_SetOriginalSize (IImageList2 *iface, INT image, INT cx, INT cy)
 
static HRESULT WINAPI ImageListImpl_SetCallback (IImageList2 *iface, IUnknown *callback)
 
static HRESULT WINAPI ImageListImpl_GetCallback (IImageList2 *iface, REFIID riid, void **ppv)
 
static HRESULT WINAPI ImageListImpl_ForceImagePresent (IImageList2 *iface, INT image, DWORD flags)
 
static HRESULT WINAPI ImageListImpl_DiscardImages (IImageList2 *iface, INT first_image, INT last_image, DWORD flags)
 
static HRESULT WINAPI ImageListImpl_PreloadImages (IImageList2 *iface, IMAGELISTDRAWPARAMS *params)
 
static HRESULT WINAPI ImageListImpl_GetStatistics (IImageList2 *iface, IMAGELISTSTATS *stats)
 
static HRESULT WINAPI ImageListImpl_Initialize (IImageList2 *iface, INT cx, INT cy, UINT flags, INT initial, INT grow)
 
static HRESULT WINAPI ImageListImpl_Replace2 (IImageList2 *iface, INT i, HBITMAP image, HBITMAP mask, IUnknown *unk, DWORD flags)
 
static HRESULT WINAPI ImageListImpl_ReplaceFromImageList (IImageList2 *iface, INT i, IImageList *imagelist, INT src, IUnknown *unk, DWORD flags)
 
HRESULT WINAPI HIMAGELIST_QueryInterface (HIMAGELIST himl, REFIID riid, void **ppv)
 

Variables

static INTERNALDRAG InternalDrag = { 0, 0, 0, 0, 0, 0, 0, FALSE, 0 }
 
static const IImageList2Vtbl ImageListImpl_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 35 of file imagelist.c.

◆ IMAGELIST_MAGIC

#define IMAGELIST_MAGIC   0x53414D58

Definition at line 117 of file imagelist.c.

◆ MAX_OVERLAYIMAGE

#define MAX_OVERLAYIMAGE   15

Definition at line 52 of file imagelist.c.

◆ TILE_COUNT

#define TILE_COUNT   4

Definition at line 179 of file imagelist.c.

Typedef Documentation

◆ ILHEAD

Function Documentation

◆ _write_bitmap()

static BOOL _write_bitmap ( HBITMAP  hBitmap,
IStream pstm 
)
static

Definition at line 3197 of file imagelist.c.

3198{
3199 LPBITMAPFILEHEADER bmfh;
3200 LPBITMAPINFOHEADER bmih;
3201 LPBYTE data = NULL, lpBits;
3202 BITMAP bm;
3203 INT bitCount, sizeImage, offBits, totalSize;
3204 HDC xdc;
3205 BOOL result = FALSE;
3206
3207 if (!GetObjectW(hBitmap, sizeof(BITMAP), &bm))
3208 return FALSE;
3209
3210 bitCount = bm.bmBitsPixel;
3211 sizeImage = get_dib_stride(bm.bmWidth, bitCount) * bm.bmHeight;
3212
3213 totalSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
3214 if(bitCount <= 8)
3215 totalSize += (1 << bitCount) * sizeof(RGBQUAD);
3216 offBits = totalSize;
3217 totalSize += sizeImage;
3218
3219 data = heap_alloc_zero(totalSize);
3220 bmfh = (LPBITMAPFILEHEADER)data;
3221 bmih = (LPBITMAPINFOHEADER)(data + sizeof(BITMAPFILEHEADER));
3222 lpBits = data + offBits;
3223
3224 /* setup BITMAPFILEHEADER */
3225 bmfh->bfType = (('M' << 8) | 'B');
3226 bmfh->bfSize = offBits;
3227 bmfh->bfReserved1 = 0;
3228 bmfh->bfReserved2 = 0;
3229 bmfh->bfOffBits = offBits;
3230
3231 /* setup BITMAPINFOHEADER */
3232 bmih->biSize = sizeof(BITMAPINFOHEADER);
3233 bmih->biWidth = bm.bmWidth;
3234 bmih->biHeight = bm.bmHeight;
3235 bmih->biPlanes = 1;
3236 bmih->biBitCount = bitCount;
3237 bmih->biCompression = BI_RGB;
3238 bmih->biSizeImage = sizeImage;
3239 bmih->biXPelsPerMeter = 0;
3240 bmih->biYPelsPerMeter = 0;
3241 bmih->biClrUsed = 0;
3242 bmih->biClrImportant = 0;
3243
3244 xdc = GetDC(0);
3245 result = GetDIBits(xdc, hBitmap, 0, bm.bmHeight, lpBits, (BITMAPINFO *)bmih, DIB_RGB_COLORS) == bm.bmHeight;
3246 ReleaseDC(0, xdc);
3247 if (!result)
3248 goto failed;
3249
3250 TRACE("width %u, height %u, planes %u, bpp %u\n",
3251 bmih->biWidth, bmih->biHeight,
3252 bmih->biPlanes, bmih->biBitCount);
3253
3254 if(FAILED(IStream_Write(pstm, data, totalSize, NULL)))
3255 goto failed;
3256
3257 result = TRUE;
3258
3259failed:
3260 heap_free(data);
3261
3262 return result;
3263}
struct BITMAPINFOHEADER * LPBITMAPINFOHEADER
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static HBITMAP hBitmap
Definition: timezone.c:26
static int get_dib_stride(int width, int bpp)
Definition: imagelist.c:198
#define BI_RGB
Definition: precomp.h:47
ULONG RGBQUAD
Definition: precomp.h:50
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint64EXT * result
Definition: glext.h:11304
#define FAILED(hr)
Definition: intsafe.h:51
static HDC
Definition: imagelist.c:92
#define TRACE(s)
Definition: solgame.cpp:4
LONG biYPelsPerMeter
Definition: amvideo.idl:38
DWORD biCompression
Definition: amvideo.idl:35
DWORD biClrImportant
Definition: amvideo.idl:40
LONG biXPelsPerMeter
Definition: amvideo.idl:37
DWORD biSizeImage
Definition: amvideo.idl:36
Definition: bl.h:1331
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
#define DIB_RGB_COLORS
Definition: wingdi.h:367
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
struct tagBITMAPFILEHEADER BITMAPFILEHEADER
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
struct tagBITMAPFILEHEADER * LPBITMAPFILEHEADER
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by ImageList_Write().

◆ add_dib_bits()

static void add_dib_bits ( HIMAGELIST  himl,
int  pos,
int  count,
int  width,
int  height,
BITMAPINFO info,
BITMAPINFO mask_info,
DWORD bits,
BYTE mask_bits 
)
static

Definition at line 234 of file imagelist.c.

236{
237 int i, j, n;
238 POINT pt;
239 int stride = info->bmiHeader.biWidth;
240 int mask_stride = (info->bmiHeader.biWidth + 31) / 32 * 4;
241
242 for (n = 0; n < count; n++)
243 {
244 BOOL has_alpha = FALSE;
245
247
248 /* check if bitmap has an alpha channel */
249 for (i = 0; i < height && !has_alpha; i++)
250 for (j = n * width; j < (n + 1) * width; j++)
251 if ((has_alpha = ((bits[i * stride + j] & 0xff000000) != 0))) break;
252
253 if (!has_alpha) /* generate alpha channel from the mask */
254 {
255 for (i = 0; i < height; i++)
256 for (j = n * width; j < (n + 1) * width; j++)
257 if (!mask_info || !((mask_bits[i * mask_stride + j / 8] << (j % 8)) & 0x80))
258 bits[i * stride + j] |= 0xff000000;
259 else
260 bits[i * stride + j] = 0;
261 }
262 else
263 {
264 himl->has_alpha[pos + n] = 1;
265
266 if (mask_info && himl->hbmMask) /* generate the mask from the alpha channel */
267 {
268 for (i = 0; i < height; i++)
269 for (j = n * width; j < (n + 1) * width; j++)
270 if ((bits[i * stride + j] >> 24) > 25) /* more than 10% alpha */
271 mask_bits[i * mask_stride + j / 8] &= ~(0x80 >> (j % 8));
272 else
273 mask_bits[i * mask_stride + j / 8] |= 0x80 >> (j % 8);
274 }
275 }
278 if (mask_info)
280 n * width, 0, width, height, mask_bits, mask_info, DIB_RGB_COLORS, SRCCOPY );
281 }
282}
HIMAGELIST himl
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:186
#define pt(x, y)
Definition: drawing.c:79
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLdouble n
Definition: glext.h:7729
GLsizei stride
Definition: glext.h:5848
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
HDC hdcImage
Definition: imagelist.c:99
HBITMAP hbmMask
Definition: imagelist.c:98
HDC hdcMask
Definition: imagelist.c:100
char * has_alpha
Definition: imagelist.c:111
#define SRCCOPY
Definition: wingdi.h:333
int WINAPI StretchDIBits(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ const VOID *, _In_ const BITMAPINFO *, _In_ UINT, _In_ DWORD)

Referenced by add_with_alpha(), and ImageList_Read().

◆ add_with_alpha()

static BOOL add_with_alpha ( HIMAGELIST  himl,
HDC  hdc,
int  pos,
int  count,
int  width,
int  height,
HBITMAP  hbmImage,
HBITMAP  hbmMask 
)
static

Definition at line 285 of file imagelist.c.

287{
288 BOOL ret = FALSE;
289 BITMAP bm;
290 BITMAPINFO *info, *mask_info = NULL;
291 DWORD *bits = NULL;
292 BYTE *mask_bits = NULL;
293 DWORD mask_width;
294
295 if (!GetObjectW( hbmImage, sizeof(bm), &bm )) return FALSE;
296
297 /* if either the imagelist or the source bitmap don't have an alpha channel, bail out now */
298 if (!himl->has_alpha) return FALSE;
299 if (bm.bmBitsPixel != 32) return FALSE;
300
301 SelectObject( hdc, hbmImage );
302 mask_width = (bm.bmWidth + 31) / 32 * 4;
303
304 if (!(info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done;
305 info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
306 info->bmiHeader.biWidth = bm.bmWidth;
307 info->bmiHeader.biHeight = -height;
308 info->bmiHeader.biPlanes = 1;
309 info->bmiHeader.biBitCount = 32;
310 info->bmiHeader.biCompression = BI_RGB;
311 info->bmiHeader.biSizeImage = bm.bmWidth * height * 4;
312 info->bmiHeader.biXPelsPerMeter = 0;
313 info->bmiHeader.biYPelsPerMeter = 0;
314 info->bmiHeader.biClrUsed = 0;
315 info->bmiHeader.biClrImportant = 0;
316 if (!(bits = heap_alloc( info->bmiHeader.biSizeImage ))) goto done;
317 if (!GetDIBits( hdc, hbmImage, 0, height, bits, info, DIB_RGB_COLORS )) goto done;
318
319 if (hbmMask)
320 {
321 if (!(mask_info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[2] ))))
322 goto done;
323 mask_info->bmiHeader = info->bmiHeader;
324 mask_info->bmiHeader.biBitCount = 1;
325 mask_info->bmiHeader.biSizeImage = mask_width * height;
326 if (!(mask_bits = heap_alloc_zero( mask_info->bmiHeader.biSizeImage )))
327 goto done;
328 if (!GetDIBits( hdc, hbmMask, 0, height, mask_bits, mask_info, DIB_RGB_COLORS )) goto done;
329 }
330
331 add_dib_bits( himl, pos, count, width, height, info, mask_info, bits, mask_bits );
332 ret = TRUE;
333
334done:
335 heap_free( info );
336 heap_free( mask_info );
337 heap_free( bits );
338 heap_free( mask_bits );
339 return ret;
340}
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static void add_dib_bits(HIMAGELIST himl, int pos, int count, int width, int height, BITMAPINFO *info, BITMAPINFO *mask_info, DWORD *bits, BYTE *mask_bits)
Definition: imagelist.c:234
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
USHORT biBitCount
Definition: precomp.h:37
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int ret
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
unsigned char BYTE
Definition: xxhash.c:193

Referenced by ImageList_Add(), ImageList_Replace(), and ImageList_ReplaceIcon().

◆ alpha_blend_image()

static BOOL alpha_blend_image ( HIMAGELIST  himl,
HDC  dest_dc,
int  dest_x,
int  dest_y,
int  src_x,
int  src_y,
int  cx,
int  cy,
BLENDFUNCTION  func,
UINT  style,
COLORREF  blend_col 
)
static

Definition at line 1289 of file imagelist.c.

1293{
1294 BOOL ret = FALSE;
1295 HDC hdc;
1296 HBITMAP bmp = 0, mask = 0;
1298 void *bits, *mask_bits;
1299 unsigned int *ptr;
1300 int i, j;
1301
1302 if (!(hdc = CreateCompatibleDC( 0 ))) return FALSE;
1303 if (!(info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done;
1304 info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1305 info->bmiHeader.biWidth = cx;
1306 info->bmiHeader.biHeight = cy;
1307 info->bmiHeader.biPlanes = 1;
1308 info->bmiHeader.biBitCount = 32;
1309 info->bmiHeader.biCompression = BI_RGB;
1310 info->bmiHeader.biSizeImage = cx * cy * 4;
1311 info->bmiHeader.biXPelsPerMeter = 0;
1312 info->bmiHeader.biYPelsPerMeter = 0;
1313 info->bmiHeader.biClrUsed = 0;
1314 info->bmiHeader.biClrImportant = 0;
1315#ifdef __REACTOS__
1316 if (!(bmp = CreateDIBSection( srce_dc, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
1317#else
1318 if (!(bmp = CreateDIBSection( himl->hdcImage, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
1319#endif
1320 SelectObject( hdc, bmp );
1321#ifdef __REACTOS__
1322 if (!BitBlt(hdc, 0, 0, cx, cy, srce_dc, src_x, src_y, SRCCOPY))
1323 {
1324 TRACE("BitBlt failed\n");
1325 goto done;
1326 }
1327#else
1328 BitBlt( hdc, 0, 0, cx, cy, himl->hdcImage, src_x, src_y, SRCCOPY );
1329#endif
1330
1331 if (blend_col != CLR_NONE)
1332 {
1333 BYTE r = GetRValue( blend_col );
1334 BYTE g = GetGValue( blend_col );
1335 BYTE b = GetBValue( blend_col );
1336
1337 if (style & ILD_BLEND25)
1338 {
1339 for (i = 0, ptr = bits; i < cx * cy; i++, ptr++)
1340 *ptr = ((*ptr & 0xff000000) |
1341 ((((*ptr & 0x00ff0000) * 3 + (r << 16)) / 4) & 0x00ff0000) |
1342 ((((*ptr & 0x0000ff00) * 3 + (g << 8)) / 4) & 0x0000ff00) |
1343 ((((*ptr & 0x000000ff) * 3 + (b << 0)) / 4) & 0x000000ff));
1344 }
1345 else if (style & ILD_BLEND50)
1346 {
1347 for (i = 0, ptr = bits; i < cx * cy; i++, ptr++)
1348 *ptr = ((*ptr & 0xff000000) |
1349 ((((*ptr & 0x00ff0000) + (r << 16)) / 2) & 0x00ff0000) |
1350 ((((*ptr & 0x0000ff00) + (g << 8)) / 2) & 0x0000ff00) |
1351 ((((*ptr & 0x000000ff) + (b << 0)) / 2) & 0x000000ff));
1352 }
1353 }
1354
1355 if (himl->has_alpha) /* we already have an alpha channel in this case */
1356 {
1357 /* pre-multiply by the alpha channel */
1358 for (i = 0, ptr = bits; i < cx * cy; i++, ptr++)
1359 {
1360 DWORD alpha = *ptr >> 24;
1361 *ptr = ((*ptr & 0xff000000) |
1362 (((*ptr & 0x00ff0000) * alpha / 255) & 0x00ff0000) |
1363 (((*ptr & 0x0000ff00) * alpha / 255) & 0x0000ff00) |
1364 (((*ptr & 0x000000ff) * alpha / 255)));
1365 }
1366 }
1367 else if (himl->hbmMask)
1368 {
1369 unsigned int width_bytes = (cx + 31) / 32 * 4;
1370 /* generate alpha channel from the mask */
1371 info->bmiHeader.biBitCount = 1;
1372 info->bmiHeader.biSizeImage = width_bytes * cy;
1373 info->bmiColors[0].rgbRed = 0;
1374 info->bmiColors[0].rgbGreen = 0;
1375 info->bmiColors[0].rgbBlue = 0;
1376 info->bmiColors[0].rgbReserved = 0;
1377 info->bmiColors[1].rgbRed = 0xff;
1378 info->bmiColors[1].rgbGreen = 0xff;
1379 info->bmiColors[1].rgbBlue = 0xff;
1380 info->bmiColors[1].rgbReserved = 0;
1381 if (!(mask = CreateDIBSection( srce_dcMask, info, DIB_RGB_COLORS, &mask_bits, 0, 0)))
1382 {
1383 TRACE("CreateDIBSection failed %i\n", GetLastError());
1384 goto done;
1385 }
1386 if (SelectObject(hdc, mask) == NULL)
1387 {
1388 TRACE("SelectObject failed %i\n", GetLastError());
1390 goto done;
1391 }
1392 if (!BitBlt( hdc, 0, 0, cx, cy, srce_dcMask, src_x, src_y, SRCCOPY))
1393 {
1394 TRACE("BitBlt failed %i\n", GetLastError());
1396 goto done;
1397 }
1398 if (SelectObject( hdc, bmp) == NULL)
1399 {
1400 TRACE("SelectObject failed %i\n", GetLastError());
1401 goto done;
1402 }
1403 for (i = 0, ptr = bits; i < cy; i++)
1404 for (j = 0; j < cx; j++, ptr++)
1405 if ((((BYTE *)mask_bits)[i * width_bytes + j / 8] << (j % 8)) & 0x80) *ptr = 0;
1406 else *ptr |= 0xff000000;
1407 }
1408
1409 ret = GdiAlphaBlend( dest_dc, dest_x, dest_y, cx, cy, hdc, 0, 0, cx, cy, func );
1410
1411done:
1412 DeleteDC( hdc );
1413 if (bmp) DeleteObject( bmp );
1414 if (mask) DeleteObject( mask );
1415 heap_free( info );
1416 return ret;
1417}
Arabic default style
Definition: afstyles.h:94
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
#define GetBValue(quad)
Definition: precomp.h:66
#define GetGValue(quad)
Definition: precomp.h:65
#define GetRValue(quad)
Definition: precomp.h:64
pKey DeleteObject()
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLenum func
Definition: glext.h:6028
GLenum GLint GLuint mask
Definition: glext.h:6028
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
#define bits
Definition: infblock.c:15
static PVOID ptr
Definition: dispmode.c:27
BITMAP bmp
Definition: alphablend.c:62
BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heightDst, HDC hdcSrc, int xSrc, int ySrc, int widthSrc, int heightSrc, BLENDFUNCTION blendFunction)
static HBITMAP
Definition: button.c:44
static UINT width_bytes(UINT width, UINT bpp)
Definition: tiffformat.c:888
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define ILD_BLEND25
Definition: commctrl.h:422
#define CLR_NONE
Definition: commctrl.h:319
_Out_opt_ int * cx
Definition: commctrl.h:585
#define ILD_BLEND50
Definition: commctrl.h:423
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:199
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by ImageList_DrawIndirect().

◆ get_dib_image_size()

static int get_dib_image_size ( const BITMAPINFO info)
inlinestatic

Definition at line 203 of file imagelist.c.

204{
205 return get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount )
206 * abs( info->bmiHeader.biHeight );
207}
#define abs(i)
Definition: fconv.c:206

Referenced by MFDRV_StretchBlt(), and read_bitmap().

◆ get_dib_stride()

static int get_dib_stride ( int  width,
int  bpp 
)
inlinestatic

Definition at line 198 of file imagelist.c.

199{
200 return ((width * bpp + 31) >> 3) & ~3;
201}
DWORD bpp
Definition: surface.c:185

Referenced by _write_bitmap(), EMFDRV_StretchBlt(), get_dib_image_size(), MFDRV_CreateBrushIndirect(), and MFDRV_StretchBlt().

◆ HIMAGELIST_QueryInterface()

HRESULT WINAPI HIMAGELIST_QueryInterface ( HIMAGELIST  himl,
REFIID  riid,
void **  ppv 
)

Definition at line 4038 of file imagelist.c.

4039{
4040 TRACE("(%p,%s,%p)\n", himl, debugstr_guid(riid), ppv);
4041 return IImageList2_QueryInterface((IImageList2 *) himl, riid, ppv);
4042}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35

Referenced by ImageListImpl_Clone(), ImageListImpl_GetDragImage(), ImageListImpl_Merge(), init_functions(), and SHGetImageList().

◆ ImageList_Add()

INT WINAPI ImageList_Add ( HIMAGELIST  himl,
HBITMAP  hbmImage,
HBITMAP  hbmMask 
)

Definition at line 448 of file imagelist.c.

449{
450 HDC hdcBitmap, hdcTemp = 0;
451 INT nFirstIndex, nImageCount, i;
452 BITMAP bmp;
453 POINT pt;
454
455 TRACE("himl=%p hbmimage=%p hbmmask=%p\n", himl, hbmImage, hbmMask);
456 if (!is_valid(himl))
457 return -1;
458
459 if (!GetObjectW(hbmImage, sizeof(BITMAP), &bmp))
460 return -1;
461
462 TRACE("himl %p, cCurImage %d, cMaxImage %d, cGrow %d, cx %d, cy %d\n",
464
465 nImageCount = bmp.bmWidth / himl->cx;
466
467 TRACE("%p has %d images (%d x %d) bpp %d\n", hbmImage, nImageCount, bmp.bmWidth, bmp.bmHeight,
468 bmp.bmBitsPixel);
469
471
473
474 SelectObject(hdcBitmap, hbmImage);
475
476 if (add_with_alpha( himl, hdcBitmap, himl->cCurImage, nImageCount,
477 himl->cx, min( himl->cy, bmp.bmHeight), hbmImage, hbmMask ))
478 goto done;
479
480 if (himl->hbmMask)
481 {
482 hdcTemp = CreateCompatibleDC(0);
483 SelectObject(hdcTemp, hbmMask);
484 }
485
486 if (himl->uBitsPixel <= 8 && bmp.bmBitsPixel <= 8 &&
488 {
489 RGBQUAD colors[256];
490 UINT num = GetDIBColorTable( hdcBitmap, 0, 1 << bmp.bmBitsPixel, colors );
491 if (num) ImageList_SetColorTable( himl, 0, num, colors );
492 }
493
494 for (i=0; i<nImageCount; i++)
495 {
497
498 /* Copy result to the imagelist
499 */
500 BitBlt( himl->hdcImage, pt.x, pt.y, himl->cx, bmp.bmHeight,
501 hdcBitmap, i*himl->cx, 0, SRCCOPY );
502
503 if (!himl->hbmMask)
504 continue;
505
506 BitBlt( himl->hdcMask, pt.x, pt.y, himl->cx, bmp.bmHeight,
507 hdcTemp, i*himl->cx, 0, SRCCOPY );
508
509 /* Remove the background from the image
510 */
511 BitBlt( himl->hdcImage, pt.x, pt.y, himl->cx, bmp.bmHeight,
512 himl->hdcMask, pt.x, pt.y, 0x220326 ); /* NOTSRCAND */
513 }
514 if (hdcTemp) DeleteDC(hdcTemp);
515
516done:
518
519 nFirstIndex = himl->cCurImage;
520 himl->cCurImage += nImageCount;
521
522 return nFirstIndex;
523}
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
static void IMAGELIST_InternalExpandBitmaps(HIMAGELIST himl, INT nImageCount)
Definition: imagelist.c:361
static BOOL add_with_alpha(HIMAGELIST himl, HDC hdc, int pos, int count, int width, int height, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:285
UINT WINAPI ImageList_SetColorTable(HIMAGELIST himl, UINT uStartIndex, UINT cEntries, const RGBQUAD *prgb)
Definition: imagelist.c:3403
GLuint GLuint num
Definition: glext.h:9618
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
HDC hdcBitmap
Definition: solcreate.cpp:9
INT cGrow
Definition: imagelist.c:88
INT cMaxImage
Definition: imagelist.c:87
INT cCurImage
Definition: imagelist.c:86
UINT uBitsPixel
Definition: imagelist.c:110
BOOL color_table_set
Definition: imagelist.c:112
UINT WINAPI GetDIBColorTable(HDC hDC, UINT iStartIndex, UINT cEntries, RGBQUAD *pColors)
Definition: palette.c:123

Referenced by Icon::add_to_imagelist(), AddContentTab(), HEADER_CreateDragImage(), ImageList_AddAlphaIcon(), ImageList_AddMasked(), ImageList_LoadImageW(), ImageListImpl_Add(), init_functions(), LISTVIEW_CreateCheckBoxIL(), LISTVIEW_CreateDragImage(), msi_seltree_create_imagelist(), CRootNode::SetupNode(), and TREEVIEW_CreateDragImage().

◆ ImageList_AddIcon()

INT WINAPI ImageList_AddIcon ( HIMAGELIST  himl,
HICON  hIcon 
)

Definition at line 540 of file imagelist.c.

541{
542 return ImageList_ReplaceIcon (himl, -1, hIcon);
543}
INT WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, INT nIndex, HICON hIcon)
Definition: imagelist.c:2779
HICON hIcon
Definition: msconfig.c:44

◆ ImageList_AddMasked()

INT WINAPI ImageList_AddMasked ( HIMAGELIST  himl,
HBITMAP  hBitmap,
COLORREF  clrMask 
)

Definition at line 563 of file imagelist.c.

564{
565 HDC hdcMask, hdcBitmap;
566 INT ret;
567 BITMAP bmp;
568 HBITMAP hMaskBitmap;
569 COLORREF bkColor;
570
571 TRACE("himl=%p hbitmap=%p clrmask=%x\n", himl, hBitmap, clrMask);
572 if (!is_valid(himl))
573 return -1;
574
575 if (!GetObjectW(hBitmap, sizeof(BITMAP), &bmp))
576 return -1;
577
580
581 /* Create a temp Mask so we can remove the background of the Image */
582 hdcMask = CreateCompatibleDC(0);
583 hMaskBitmap = CreateBitmap(bmp.bmWidth, bmp.bmHeight, 1, 1, NULL);
584 SelectObject(hdcMask, hMaskBitmap);
585
586 /* create monochrome image to the mask bitmap */
587 bkColor = (clrMask != CLR_DEFAULT) ? clrMask : GetPixel (hdcBitmap, 0, 0);
588 SetBkColor (hdcBitmap, bkColor);
589 BitBlt (hdcMask, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcBitmap, 0, 0, SRCCOPY);
590
591 /*
592 * Remove the background from the image
593 *
594 * WINDOWS BUG ALERT!!!!!!
595 * The statement below should not be done in common practice
596 * but this is how ImageList_AddMasked works in Windows.
597 * It overwrites the original bitmap passed, this was discovered
598 * by using the same bitmap to iterate the different styles
599 * on windows where it failed (BUT ImageList_Add is OK)
600 * This is here in case some apps rely on this bug
601 *
602 * Blt mode 0x220326 is NOTSRCAND
603 */
604 if (bmp.bmBitsPixel > 8) /* NOTSRCAND can't work with palettes */
605 {
606 SetBkColor(hdcBitmap, RGB(255,255,255));
607 BitBlt(hdcBitmap, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcMask, 0, 0, 0x220326);
608 }
609
611 DeleteDC(hdcMask);
612
613 ret = ImageList_Add( himl, hBitmap, hMaskBitmap );
614
615 DeleteObject(hMaskBitmap);
616 return ret;
617}
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:448
#define RGB(r, g, b)
Definition: precomp.h:62
#define CLR_DEFAULT
Definition: commctrl.h:320
DWORD COLORREF
Definition: windef.h:300
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999

Referenced by cert_mgr_advanced_dlg_proc(), cert_mgr_dlg_proc(), cert_properties_general_dlg_proc(), CreateDragImage(), CShellLink::CreateShortcutIcon(), CreateStateImageList(), ImageList_LoadImageW(), ImageListImpl_AddMasked(), ImageView_CreateToolBar(), init_hierarchy_page(), InitImageList(), LV_Init(), CToolBox::OnCreate(), SecurityPageProc(), select_cert_dlg_proc(), CBaseBarSite::SetDeskBarSite(), SetImageList(), ThemePageDlgProc(), TOOLBAR_AddBitmapToImageList(), TOOLBAR_ReplaceBitmap(), and TREEVIEW_InitCheckboxes().

◆ ImageList_BeginDrag()

BOOL WINAPI ImageList_BeginDrag ( HIMAGELIST  himlTrack,
INT  iTrack,
INT  dxHotspot,
INT  dyHotspot 
)

Definition at line 638 of file imagelist.c.

640{
641 INT cx, cy;
642 POINT src, dst;
643
644 TRACE("(himlTrack=%p iTrack=%d dx=%d dy=%d)\n", himlTrack, iTrack,
645 dxHotspot, dyHotspot);
646
647 if (!is_valid(himlTrack))
648 return FALSE;
649
650 if (iTrack >= himlTrack->cCurImage)
651 return FALSE;
652
653 if (InternalDrag.himl)
654 return FALSE;
655
656 cx = himlTrack->cx;
657 cy = himlTrack->cy;
658
660 if (InternalDrag.himl == NULL) {
661 WARN("Error creating drag image list!\n");
662 return FALSE;
663 }
664
665 InternalDrag.dxHotspot = dxHotspot;
666 InternalDrag.dyHotspot = dyHotspot;
667
668 /* copy image */
670 imagelist_point_from_index(himlTrack, iTrack, &src);
671 BitBlt(InternalDrag.himl->hdcImage, dst.x, dst.y, cx, cy, himlTrack->hdcImage, src.x, src.y,
672 SRCCOPY);
673 BitBlt(InternalDrag.himl->hdcMask, dst.x, dst.y, cx, cy, himlTrack->hdcMask, src.x, src.y,
674 SRCCOPY);
675
677
678 return TRUE;
679}
#define WARN(fmt,...)
Definition: debug.h:112
static INTERNALDRAG InternalDrag
Definition: imagelist.c:157
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
HIMAGELIST himlNoCursor
Definition: imagelist.c:144
HIMAGELIST himl
Definition: imagelist.c:143
UINT flags
Definition: imagelist.c:92

Referenced by GROUP_GroupWndProc(), HEADER_MouseMove(), ImageListImpl_BeginDrag(), init_functions(), and CDefView::OnNotify().

◆ ImageList_CoCreateInstance()

HRESULT WINAPI ImageList_CoCreateInstance ( REFCLSID  rclsid,
const IUnknown punkOuter,
REFIID  riid,
void **  ppv 
)

Definition at line 3430 of file imagelist.c.

3431{
3432 TRACE("(%s,%p,%s,%p)\n", debugstr_guid(rclsid), punkOuter, debugstr_guid(riid), ppv);
3433
3434 if (!IsEqualCLSID(&CLSID_ImageList, rclsid))
3435 return E_NOINTERFACE;
3436
3437 return ImageListImpl_CreateInstance(punkOuter, riid, ppv);
3438}
static HRESULT ImageListImpl_CreateInstance(const IUnknown *pUnkOuter, REFIID iid, void **ppv)
Definition: imagelist.c:4044
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
#define E_NOINTERFACE
Definition: winerror.h:2364

Referenced by init_functions().

◆ ImageList_Copy()

BOOL WINAPI ImageList_Copy ( HIMAGELIST  himlDst,
INT  iDst,
HIMAGELIST  himlSrc,
INT  iSrc,
UINT  uFlags 
)

Definition at line 706 of file imagelist.c.

708{
709 POINT ptSrc, ptDst;
710
711 TRACE("himlDst=%p iDst=%d himlSrc=%p iSrc=%d\n", himlDst, iDst, himlSrc, iSrc);
712
713 if (!is_valid(himlSrc) || !is_valid(himlDst))
714 return FALSE;
715 if ((iDst < 0) || (iDst >= himlDst->cCurImage))
716 return FALSE;
717 if ((iSrc < 0) || (iSrc >= himlSrc->cCurImage))
718 return FALSE;
719
720 imagelist_point_from_index( himlDst, iDst, &ptDst );
721 imagelist_point_from_index( himlSrc, iSrc, &ptSrc );
722
723 if (uFlags & ILCF_SWAP) {
724 /* swap */
725 HDC hdcBmp;
726 HBITMAP hbmTempImage, hbmTempMask;
727
728 hdcBmp = CreateCompatibleDC (0);
729
730 /* create temporary bitmaps */
731 hbmTempImage = CreateBitmap (himlSrc->cx, himlSrc->cy, 1,
732 himlSrc->uBitsPixel, NULL);
733 hbmTempMask = CreateBitmap (himlSrc->cx, himlSrc->cy, 1,
734 1, NULL);
735
736 /* copy (and stretch) destination to temporary bitmaps.(save) */
737 /* image */
738 SelectObject (hdcBmp, hbmTempImage);
739 StretchBlt (hdcBmp, 0, 0, himlSrc->cx, himlSrc->cy,
740 himlDst->hdcImage, ptDst.x, ptDst.y, himlDst->cx, himlDst->cy,
741 SRCCOPY);
742 /* mask */
743 SelectObject (hdcBmp, hbmTempMask);
744 StretchBlt (hdcBmp, 0, 0, himlSrc->cx, himlSrc->cy,
745 himlDst->hdcMask, ptDst.x, ptDst.y, himlDst->cx, himlDst->cy,
746 SRCCOPY);
747
748 /* copy (and stretch) source to destination */
749 /* image */
750 StretchBlt (himlDst->hdcImage, ptDst.x, ptDst.y, himlDst->cx, himlDst->cy,
751 himlSrc->hdcImage, ptSrc.x, ptSrc.y, himlSrc->cx, himlSrc->cy,
752 SRCCOPY);
753 /* mask */
754 StretchBlt (himlDst->hdcMask, ptDst.x, ptDst.y, himlDst->cx, himlDst->cy,
755 himlSrc->hdcMask, ptSrc.x, ptSrc.y, himlSrc->cx, himlSrc->cy,
756 SRCCOPY);
757
758 /* copy (without stretching) temporary bitmaps to source (restore) */
759 /* mask */
760 BitBlt (himlSrc->hdcMask, ptSrc.x, ptSrc.y, himlSrc->cx, himlSrc->cy,
761 hdcBmp, 0, 0, SRCCOPY);
762
763 /* image */
764 BitBlt (himlSrc->hdcImage, ptSrc.x, ptSrc.y, himlSrc->cx, himlSrc->cy,
765 hdcBmp, 0, 0, SRCCOPY);
766 /* delete temporary bitmaps */
767 DeleteObject (hbmTempMask);
768 DeleteObject (hbmTempImage);
769 DeleteDC(hdcBmp);
770 }
771 else {
772 /* copy image */
773 StretchBlt (himlDst->hdcImage, ptDst.x, ptDst.y, himlDst->cx, himlDst->cy,
774 himlSrc->hdcImage, ptSrc.x, ptSrc.y, himlSrc->cx, himlSrc->cy,
775 SRCCOPY);
776
777 /* copy mask */
778 StretchBlt (himlDst->hdcMask, ptDst.x, ptDst.y, himlDst->cx, himlDst->cy,
779 himlSrc->hdcMask, ptSrc.x, ptSrc.y, himlSrc->cx, himlSrc->cy,
780 SRCCOPY);
781 }
782
783 return TRUE;
784}
UINT uFlags
Definition: api.c:59
#define ILCF_SWAP
Definition: commctrl.h:511
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)

Referenced by ImageListImpl_Copy(), and init_functions().

◆ imagelist_copy_images()

static void imagelist_copy_images ( HIMAGELIST  himl,
HDC  hdcSrc,
HDC  hdcDest,
UINT  src,
UINT  count,
UINT  dest 
)
inlinestatic

Definition at line 215 of file imagelist.c.

217{
218 POINT ptSrc, ptDest;
219 SIZE sz;
220 UINT i;
221
222 for ( i=0; i<TILE_COUNT; i++ )
223 {
226 sz.cx = himl->cx;
227 sz.cy = himl->cy * imagelist_height( count - i );
228
229 BitBlt( hdcDest, ptDest.x, ptDest.y, sz.cx, sz.cy,
230 hdcSrc, ptSrc.x, ptSrc.y, SRCCOPY );
231 }
232}
#define TILE_COUNT
Definition: imagelist.c:179
static UINT imagelist_height(UINT count)
Definition: imagelist.c:181
static char * dest
Definition: rtl.c:135
LONG cx
Definition: windef.h:334
LONG cy
Definition: windef.h:335
static HDC hdcSrc
Definition: xlate.c:32

Referenced by ImageList_Remove(), and ImageList_SetImageCount().

◆ ImageList_Create()

HIMAGELIST WINAPI ImageList_Create ( INT  cx,
INT  cy,
UINT  flags,
INT  cInitial,
INT  cGrow 
)

Definition at line 804 of file imagelist.c.

806{
808 INT nCount;
809 HBITMAP hbmTemp;
810 UINT ilc = (flags & 0xFE);
811 static const WORD aBitBlend25[] =
812 {0xAA, 0x00, 0x55, 0x00, 0xAA, 0x00, 0x55, 0x00};
813
814 static const WORD aBitBlend50[] =
815 {0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA};
816
817 TRACE("(%d %d 0x%x %d %d)\n", cx, cy, flags, cInitial, cGrow);
818
819 if (cx < 0 || cy < 0) return NULL;
820 if (!((flags&ILC_COLORDDB) == ILC_COLORDDB) && (cx == 0 || cy == 0)) return NULL;
821
822 /* Create the IImageList interface for the image list */
823 if (FAILED(ImageListImpl_CreateInstance(NULL, &IID_IImageList, (void **)&himl)))
824 return NULL;
825
826 cGrow = (WORD)((max( cGrow, 1 ) + 3) & ~3);
827
828 if (cGrow > 256)
829 {
830 /* Windows doesn't limit the size here, but X11 doesn't let us allocate such huge bitmaps */
831 WARN( "grow %d too large, limiting to 256\n", cGrow );
832 cGrow = 256;
833 }
834
835 himl->cx = cx;
836 himl->cy = cy;
837 himl->flags = flags;
838 himl->cMaxImage = cInitial + 1;
839 himl->cInitial = cInitial;
840 himl->cGrow = cGrow;
844
845 /* initialize overlay mask indices */
846 for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
847 himl->nOvlIdx[nCount] = -1;
848
849 /* Create Image & Mask DCs */
851 if (!himl->hdcImage)
852 goto cleanup;
853 if (himl->flags & ILC_MASK){
855 if (!himl->hdcMask)
856 goto cleanup;
857 }
858
859 /* Default to ILC_COLOR4 if none of the ILC_COLOR* flags are specified */
860 if (ilc == ILC_COLOR)
861 {
862 ilc = ILC_COLOR4;
864 }
865
866 if (ilc >= ILC_COLOR4 && ilc <= ILC_COLOR32)
867 himl->uBitsPixel = ilc;
868 else
870
871 if (himl->cMaxImage > 0) {
874 } else
875 himl->hbmImage = 0;
876
877 if ((himl->cMaxImage > 0) && (himl->flags & ILC_MASK)) {
878 SIZE sz;
879
881 himl->hbmMask = CreateBitmap (sz.cx, sz.cy, 1, 1, NULL);
882 if (himl->hbmMask == 0) {
883 ERR("Error creating mask bitmap!\n");
884 goto cleanup;
885 }
887 }
888 else
889 himl->hbmMask = 0;
890
891 if (ilc == ILC_COLOR32)
892 himl->has_alpha = heap_alloc_zero( himl->cMaxImage );
893 else
895
896 /* create blending brushes */
897 hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend25);
899 DeleteObject (hbmTemp);
900
901 hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend50);
903 DeleteObject (hbmTemp);
904
905 TRACE("created imagelist %p\n", himl);
906 return himl;
907
908cleanup:
910 return NULL;
911}
#define ERR(fmt,...)
Definition: debug.h:110
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
static void imagelist_get_bitmap_size(HIMAGELIST himl, UINT count, SIZE *sz)
Definition: imagelist.c:192
static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count)
Definition: imagelist.c:3326
#define MAX_OVERLAYIMAGE
Definition: imagelist.c:52
static void cleanup(void)
Definition: main.c:1335
unsigned short WORD
Definition: ntddk_ex.h:93
GLbitfield flags
Definition: glext.h:7161
#define ILC_COLOR4
Definition: commctrl.h:354
#define ILC_COLORDDB
Definition: commctrl.h:353
#define ILC_COLOR32
Definition: commctrl.h:358
#define ILC_MASK
Definition: commctrl.h:351
#define ILC_COLOR
Definition: commctrl.h:352
HBRUSH hbrBlend50
Definition: imagelist.c:108
HBITMAP hbmImage
Definition: imagelist.c:97
COLORREF clrBk
Definition: imagelist.c:94
INT nOvlIdx[MAX_OVERLAYIMAGE]
Definition: imagelist.c:101
COLORREF clrFg
Definition: imagelist.c:93
INT cInitial
Definition: imagelist.c:109
HBRUSH hbrBlend25
Definition: imagelist.c:107
#define max(a, b)
Definition: svc.c:63
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define BITSPIXEL
Definition: wingdi.h:720
HBRUSH WINAPI CreatePatternBrush(_In_ HBITMAP)

Referenced by AddContentTab(), AddListViewItems(), ApplicationPageWndProc(), cert_mgr_advanced_dlg_proc(), cert_mgr_dlg_proc(), cert_properties_general_dlg_proc(), Control_CreateListView(), CAppsListView::Create(), CreateDragImage(), CShellLink::CreateShortcutIcon(), CreateStateImageList(), DesktopOnInitDialog(), DriveDlgProc(), EnumerateConnectedDrives(), FILEDLG95_InitControls(), FileTypesDlg_DoList(), GetGeneralGroupData(), GetUserMembershipData(), GROUP_GroupWndProc(), HEADER_CreateDragImage(), ImageList_BeginDrag(), ImageList_Duplicate(), ImageList_LoadImageW(), ImageList_Merge(), ImageList_Read(), ImageView_CreateToolBar(), COpenWithDialog::Init(), init_functions(), init_hierarchy_page(), InitGroupMembersList(), CNotifyToolbar::Initialize(), CMainToolbar::InitImageList(), InitImageList(), InitInstance(), InitListViewImage(), InitListViewImageLists(), InitTreeViewImageLists(), InitUserGroupsList(), ShellBrowser::invalidate_cache(), LISTVIEW_CreateCheckBoxIL(), LISTVIEW_CreateDragImage(), LV_Init(), MainFrameBase::MainFrameBase(), msi_dialog_listview(), msi_seltree_create_imagelist(), CToolBox::OnCreate(), CTaskSwitchWnd::OnCreate(), OnGroupsPageInitDialog(), OnInitDialog(), OnInitSettingsPage(), PROPSHEET_CollectPageInfo(), CNotifyToolbar::ResizeImagelist(), security_on_initdialog(), SecurityPageProc(), select_cert_dlg_proc(), CBaseBarSite::SetDeskBarSite(), SetImageList(), SetupDiGetClassImageListExW(), ShellBrowser::ShellBrowser(), SIC_Initialize(), ThemePageDlgProc(), TOOLBAR_AddBitmap(), TOOLBAR_CheckImageListIconSize(), TREEVIEW_CreateDragImage(), TREEVIEW_InitCheckboxes(), and UpgradeRepairDlgProc().

◆ ImageList_CreateImage()

static HBITMAP ImageList_CreateImage ( HDC  hdc,
HIMAGELIST  himl,
UINT  count 
)
static

Definition at line 3326 of file imagelist.c.

3327{
3328 HBITMAP hbmNewBitmap;
3329 UINT ilc = (himl->flags & 0xFE);
3330 SIZE sz;
3331
3333
3334 if ((ilc >= ILC_COLOR4 && ilc <= ILC_COLOR32) || ilc == ILC_COLOR)
3335 {
3336 char buffer[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
3337 BITMAPINFO *bmi = (BITMAPINFO *)buffer;
3338
3339 TRACE("Creating DIBSection %d x %d, %d Bits per Pixel\n",
3340 sz.cx, sz.cy, himl->uBitsPixel);
3341
3342 memset( buffer, 0, sizeof(buffer) );
3343 bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
3344 bmi->bmiHeader.biWidth = sz.cx;
3345 bmi->bmiHeader.biHeight = sz.cy;
3346 bmi->bmiHeader.biPlanes = 1;
3349
3350 if (himl->uBitsPixel <= ILC_COLOR8)
3351 {
3352 if (!himl->color_table_set)
3353 {
3354 /* retrieve the default color map */
3355 HBITMAP tmp = CreateBitmap( 1, 1, 1, 1, NULL );
3356 GetDIBits( hdc, tmp, 0, 0, NULL, bmi, DIB_RGB_COLORS );
3357 DeleteObject( tmp );
3358 if (ilc == ILC_COLOR4)
3359 {
3360 RGBQUAD tmp;
3361 tmp = bmi->bmiColors[7];
3362 bmi->bmiColors[7] = bmi->bmiColors[8];
3363 bmi->bmiColors[8] = tmp;
3364 }
3365 }
3366 else
3367 {
3369 }
3370 }
3371 hbmNewBitmap = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, NULL, 0, 0);
3372 }
3373 else /*if (ilc == ILC_COLORDDB)*/
3374 {
3375 TRACE("Creating Bitmap: %d Bits per Pixel\n", himl->uBitsPixel);
3376
3377 hbmNewBitmap = CreateBitmap (sz.cx, sz.cy, 1, himl->uBitsPixel, NULL);
3378 }
3379 TRACE("returning %p\n", hbmNewBitmap);
3380 return hbmNewBitmap;
3381}
GLuint buffer
Definition: glext.h:5915
#define ILC_COLOR8
Definition: commctrl.h:355
#define memset(x, y, z)
Definition: compat.h:39
ULONG biCompression
Definition: precomp.h:38
RGBQUAD bmiColors[1]
Definition: wingdi.h:1477

Referenced by ImageList_Create(), IMAGELIST_InternalExpandBitmaps(), ImageList_Remove(), ImageList_SetIconSize(), and ImageList_SetImageCount().

◆ ImageList_Destroy()

BOOL WINAPI ImageList_Destroy ( HIMAGELIST  himl)

Definition at line 928 of file imagelist.c.

929{
930 if (!is_valid(himl))
931 return FALSE;
932
933 IImageList_Release((IImageList *) himl);
934 return TRUE;
935}

Referenced by cert_mgr_advanced_dlg_proc(), cert_mgr_dlg_proc(), cert_properties_general_callback(), CAddressBand::CloseDW(), CToolsBand::CloseDW(), CMainToolbar::Create(), CShellLink::CreateShortcutIcon(), CreateStateImageList(), DependenciesPageProc(), DesktopOnDestroyDialog(), CSideTreeView::DestroyImageList(), DestroySecurityPage(), DestroyTreeView(), DriveDlgProc(), FileOpenDlgProc95(), GROUP_GroupWndProc(), HEADER_MouseMove(), hierarchy_callback(), iewnd_OnDestroy(), ImageList_Create(), ImageList_EndDrag(), ImageList_SetDragCursorImage(), ImageListImpl_Clone(), ImageListImpl_Merge(), ImageView_CreateToolBar(), init_functions(), InitImageList(), InitTreeViewImageLists(), ShellBrowser::invalidate_cache(), LISTVIEW_NCDestroy(), LISTVIEW_SetExtendedListViewStyle(), msi_destroy_control(), OnInitSettingsPage(), pCreateToolbar(), PROPSHEET_CleanUp(), ReleaseHelpViewer(), CNotifyToolbar::ResizeImagelist(), security_on_destroy(), select_cert_dlg_proc(), SetImageList(), SetupDiDestroyClassImageList(), SHGetImageList(), SIC_Destroy(), SIC_Initialize(), SoundsDlgProc(), TOOLBAR_CheckImageListIconSize(), TOOLBAR_Destroy(), TreeListProc(), TreeView_Cleanup(), TV1_Initialize(), TV2_Initialize(), UpgradeRepairDlgProc(), CAppsListView::~CAppsListView(), COpenWithDialog::~COpenWithDialog(), CStartButton::~CStartButton(), MainFrameBase::~MainFrameBase(), Pane::~Pane(), ShellBrowser::~ShellBrowser(), and TrayNotifyDlg::~TrayNotifyDlg().

◆ ImageList_DragEnter()

BOOL WINAPI ImageList_DragEnter ( HWND  hwndLock,
INT  x,
INT  y 
)

Definition at line 958 of file imagelist.c.

959{
960 TRACE("(hwnd=%p x=%d y=%d)\n", hwndLock, x, y);
961
963 return FALSE;
964
965 if (hwndLock)
966 InternalDrag.hwnd = hwndLock;
967 else
969
970 InternalDrag.x = x;
971 InternalDrag.y = y;
972
973 /* draw the drag image and save the background */
975}
BOOL WINAPI ImageList_DragShowNolock(BOOL bShow)
Definition: imagelist.c:1153
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656

Referenced by CDefView::DragEnter(), GROUP_GroupWndProc(), and ImageListImpl_DragEnter().

◆ ImageList_DragLeave()

BOOL WINAPI ImageList_DragLeave ( HWND  hwndLock)

Definition at line 992 of file imagelist.c.

993{
994 /* As we don't save drag info in the window this can lead to problems if
995 an app does not supply the same window as DragEnter */
996 /* if (hwndLock)
997 InternalDrag.hwnd = hwndLock;
998 else
999 InternalDrag.hwnd = GetDesktopWindow (); */
1000 if(!hwndLock)
1001 hwndLock = GetDesktopWindow();
1002 if(InternalDrag.hwnd != hwndLock)
1003 FIXME("DragLeave hWnd != DragEnter hWnd\n");
1004
1006
1007 return TRUE;
1008}
#define FIXME(fmt,...)
Definition: debug.h:111

Referenced by CDefView::DragLeave(), CDefView::Drop(), GROUP_GroupWndProc(), and ImageListImpl_DragLeave().

◆ ImageList_DragMove()

BOOL WINAPI ImageList_DragMove ( INT  x,
INT  y 
)

Definition at line 1070 of file imagelist.c.

1071{
1072 TRACE("(x=%d y=%d)\n", x, y);
1073
1075 return FALSE;
1076
1077 /* draw/update the drag image */
1078 if (InternalDrag.bShow) {
1079 HDC hdcDrag;
1080 HDC hdcOffScreen;
1081 HDC hdcBg;
1082 HBITMAP hbmOffScreen;
1083 INT origNewX, origNewY;
1084 INT origOldX, origOldY;
1085 INT origRegX, origRegY;
1086 INT sizeRegX, sizeRegY;
1087
1088
1089 /* calculate the update region */
1090 origNewX = x - InternalDrag.dxHotspot;
1091 origNewY = y - InternalDrag.dyHotspot;
1092 origOldX = InternalDrag.x - InternalDrag.dxHotspot;
1093 origOldY = InternalDrag.y - InternalDrag.dyHotspot;
1094 origRegX = min(origNewX, origOldX);
1095 origRegY = min(origNewY, origOldY);
1096 sizeRegX = InternalDrag.himl->cx + abs(x - InternalDrag.x);
1097 sizeRegY = InternalDrag.himl->cy + abs(y - InternalDrag.y);
1098
1099 hdcDrag = GetDCEx(InternalDrag.hwnd, 0,
1101 hdcOffScreen = CreateCompatibleDC(hdcDrag);
1102 hdcBg = CreateCompatibleDC(hdcDrag);
1103
1104 hbmOffScreen = CreateCompatibleBitmap(hdcDrag, sizeRegX, sizeRegY);
1105 SelectObject(hdcOffScreen, hbmOffScreen);
1107
1108 /* get the actual background of the update region */
1109 BitBlt(hdcOffScreen, 0, 0, sizeRegX, sizeRegY, hdcDrag,
1110 origRegX, origRegY, SRCCOPY);
1111 /* erase the old image */
1112 BitBlt(hdcOffScreen, origOldX - origRegX, origOldY - origRegY,
1113 InternalDrag.himl->cx, InternalDrag.himl->cy, hdcBg, 0, 0,
1114 SRCCOPY);
1115 /* save the background */
1116 BitBlt(hdcBg, 0, 0, InternalDrag.himl->cx, InternalDrag.himl->cy,
1117 hdcOffScreen, origNewX - origRegX, origNewY - origRegY, SRCCOPY);
1118 /* draw the image */
1119 ImageList_InternalDragDraw(hdcOffScreen, origNewX - origRegX,
1120 origNewY - origRegY);
1121 /* draw the update region to the screen */
1122 BitBlt(hdcDrag, origRegX, origRegY, sizeRegX, sizeRegY,
1123 hdcOffScreen, 0, 0, SRCCOPY);
1124
1125 DeleteDC(hdcBg);
1126 DeleteDC(hdcOffScreen);
1127 DeleteObject(hbmOffScreen);
1128 ReleaseDC(InternalDrag.hwnd, hdcDrag);
1129 }
1130
1131 /* update the image position */
1132 InternalDrag.x = x;
1133 InternalDrag.y = y;
1134
1135 return TRUE;
1136}
static void ImageList_InternalDragDraw(HDC hdc, INT x, INT y)
Definition: imagelist.c:1032
HBITMAP hbmBg
Definition: imagelist.c:154
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define DCX_CACHE
Definition: winuser.h:2104
#define DCX_WINDOW
Definition: winuser.h:2103
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
#define DCX_LOCKWINDOWUPDATE
Definition: winuser.h:2110

Referenced by CDefView::DragOver(), GROUP_GroupWndProc(), HEADER_MouseMove(), and ImageListImpl_DragMove().

◆ ImageList_DragShowNolock()

BOOL WINAPI ImageList_DragShowNolock ( BOOL  bShow)

Definition at line 1153 of file imagelist.c.

1154{
1155 HDC hdcDrag;
1156 HDC hdcBg;
1157 INT x, y;
1158
1160 return FALSE;
1161
1162 TRACE("bShow=0x%X!\n", bShow);
1163
1164 /* DragImage is already visible/hidden */
1165 if ((InternalDrag.bShow && bShow) || (!InternalDrag.bShow && !bShow)) {
1166 return FALSE;
1167 }
1168
1169 /* position of the origin of the DragImage */
1172
1173 hdcDrag = GetDCEx (InternalDrag.hwnd, 0,
1175 if (!hdcDrag) {
1176 return FALSE;
1177 }
1178
1179 hdcBg = CreateCompatibleDC(hdcDrag);
1180 if (!InternalDrag.hbmBg) {
1183 }
1185
1186 if (bShow) {
1187 /* save the background */
1188 BitBlt(hdcBg, 0, 0, InternalDrag.himl->cx, InternalDrag.himl->cy,
1189 hdcDrag, x, y, SRCCOPY);
1190 /* show the image */
1191 ImageList_InternalDragDraw(hdcDrag, x, y);
1192 } else {
1193 /* hide the image */
1195 hdcBg, 0, 0, SRCCOPY);
1196 }
1197
1199
1200 DeleteDC(hdcBg);
1201 ReleaseDC (InternalDrag.hwnd, hdcDrag);
1202 return TRUE;
1203}

Referenced by HEADER_LButtonUp(), HEADER_MouseMove(), HEADER_Refresh(), ImageList_DragEnter(), ImageList_DragLeave(), ImageList_SetDragCursorImage(), and ImageListImpl_DragShowNolock().

◆ ImageList_Draw()

BOOL WINAPI ImageList_Draw ( HIMAGELIST  himl,
INT  i,
HDC  hdc,
INT  x,
INT  y,
UINT  fStyle 
)

Definition at line 1228 of file imagelist.c.

1229{
1230 return ImageList_DrawEx (himl, i, hdc, x, y, 0, 0,
1231 CLR_DEFAULT, CLR_DEFAULT, fStyle);
1232}
BOOL WINAPI ImageList_DrawEx(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
Definition: imagelist.c:1264

Referenced by CFn_WMDrawItem(), CreateDragImage(), FILEDLG95_LOOKIN_DrawItem(), FileMenu_DrawItem(), init_functions(), LISTVIEW_DrawItemPart(), REBAR_DrawBand(), TAB_DrawItemInterior(), TOOLBAR_CustomizeDialogProc(), TOOLBAR_DrawImage(), TreeListDraw(), TREEVIEW_CreateDragImage(), and TREEVIEW_DrawItem().

◆ ImageList_DrawEx()

BOOL WINAPI ImageList_DrawEx ( HIMAGELIST  himl,
INT  i,
HDC  hdc,
INT  x,
INT  y,
INT  dx,
INT  dy,
COLORREF  rgbBk,
COLORREF  rgbFg,
UINT  fStyle 
)

Definition at line 1264 of file imagelist.c.

1267{
1268 IMAGELISTDRAWPARAMS imldp;
1269
1270 ZeroMemory (&imldp, sizeof(imldp));
1271 imldp.cbSize = sizeof(imldp);
1272 imldp.himl = himl;
1273 imldp.i = i;
1274 imldp.hdcDst = hdc,
1275 imldp.x = x;
1276 imldp.y = y;
1277 imldp.cx = dx;
1278 imldp.cy = dy;
1279 imldp.rgbBk = rgbBk;
1280 imldp.rgbFg = rgbFg;
1281 imldp.fStyle = fStyle;
1282
1283 return ImageList_DrawIndirect (&imldp);
1284}
BOOL WINAPI ImageList_DrawIndirect(IMAGELISTDRAWPARAMS *pimldp)
Definition: imagelist.c:1525
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
#define ZeroMemory
Definition: winbase.h:1670

Referenced by Icon::add_to_imagelist(), Icon::create_bitmap(), Icon::draw(), Pane::draw_item(), HEADER_DrawItem(), ImageList_Draw(), LISTVIEW_DrawItemPart(), TOOLBAR_DrawMasked(), and TREEVIEW_DrawItem().

◆ ImageList_DrawIndirect()

BOOL WINAPI ImageList_DrawIndirect ( IMAGELISTDRAWPARAMS pimldp)

Definition at line 1525 of file imagelist.c.

1526{
1527 INT cx, cy, nOvlIdx;
1528 DWORD fState, dwRop;
1529 UINT fStyle;
1530 COLORREF oldImageBk, oldImageFg;
1531 HDC hImageDC, hImageListDC, hMaskListDC;
1532 HBITMAP hImageBmp, hOldImageBmp, hBlendMaskBmp;
1533 BOOL bIsTransparent, bBlend, bResult = FALSE, bMask;
1535 HBRUSH hOldBrush;
1536 POINT pt;
1537 BOOL has_alpha;
1538#ifdef __REACTOS__
1539 HDC hdcSaturated = NULL, hdcSaturatedMask = NULL;
1540#endif
1541
1542 if (!pimldp || !(himl = pimldp->himl)) return FALSE;
1543 if (!is_valid(himl)) return FALSE;
1544 if ((pimldp->i < 0) || (pimldp->i >= himl->cCurImage)) return FALSE;
1545
1546 imagelist_point_from_index( himl, pimldp->i, &pt );
1547 pt.x += pimldp->xBitmap;
1548 pt.y += pimldp->yBitmap;
1549
1550 fState = pimldp->cbSize < sizeof(IMAGELISTDRAWPARAMS) ? ILS_NORMAL : pimldp->fState;
1551 fStyle = pimldp->fStyle & ~ILD_OVERLAYMASK;
1552 cx = (pimldp->cx == 0) ? himl->cx : pimldp->cx;
1553 cy = (pimldp->cy == 0) ? himl->cy : pimldp->cy;
1554
1555 bIsTransparent = (fStyle & ILD_TRANSPARENT);
1556 if( pimldp->rgbBk == CLR_NONE )
1557 bIsTransparent = TRUE;
1558 if( ( pimldp->rgbBk == CLR_DEFAULT ) && ( himl->clrBk == CLR_NONE ) )
1559 bIsTransparent = TRUE;
1560 bMask = (himl->flags & ILC_MASK) && (fStyle & ILD_MASK) ;
1561 bBlend = (fStyle & (ILD_BLEND25 | ILD_BLEND50) ) && !bMask;
1562
1563 TRACE("himl(%p) hbmMask(%p) iImage(%d) x(%d) y(%d) cx(%d) cy(%d)\n",
1564 himl, himl->hbmMask, pimldp->i, pimldp->x, pimldp->y, cx, cy);
1565
1566 /* we will use these DCs to access the images and masks in the ImageList */
1567 hImageListDC = himl->hdcImage;
1568 hMaskListDC = himl->hdcMask;
1569
1570 /* these will accumulate the image and mask for the image we're drawing */
1571 hImageDC = CreateCompatibleDC( pimldp->hdcDst );
1572 hImageBmp = CreateCompatibleBitmap( pimldp->hdcDst, cx, cy );
1573 hBlendMaskBmp = bBlend ? CreateBitmap(cx, cy, 1, 1, NULL) : 0;
1574
1575 /* Create a compatible DC. */
1576 if (!hImageListDC || !hImageDC || !hImageBmp ||
1577 (bBlend && !hBlendMaskBmp) || (himl->hbmMask && !hMaskListDC))
1578 goto cleanup;
1579
1580 hOldImageBmp = SelectObject(hImageDC, hImageBmp);
1581
1582 /*
1583 * To obtain a transparent look, background color should be set
1584 * to white and foreground color to black when blitting the
1585 * monochrome mask.
1586 */
1587 oldImageFg = SetTextColor( hImageDC, RGB( 0, 0, 0 ) );
1588 oldImageBk = SetBkColor( hImageDC, RGB( 0xff, 0xff, 0xff ) );
1589
1590#ifdef __REACTOS__
1591 /*
1592 * If the ILS_SATURATE bit is enabled we should multiply the
1593 * RGB colors of the original image by the contents of rgbFg.
1594 */
1595 if (fState & ILS_SATURATE)
1596 {
1597 if (saturate_image(himl, pimldp->hdcDst, pimldp->x, pimldp->y,
1598 pt.x, pt.y, cx, cy, pimldp->rgbFg,
1599 &hdcSaturated, &hdcSaturatedMask))
1600 {
1601 hImageListDC = hdcSaturated;
1602 hMaskListDC = hdcSaturatedMask;
1603 /* shitty way of getting subroutines to blit at the right place (top left corner),
1604 as our modified imagelist only contains a single image for performance reasons */
1605 pt.x = 0;
1606 pt.y = 0;
1607 }
1608 }
1609#endif
1610
1611 has_alpha = (himl->has_alpha && himl->has_alpha[pimldp->i]);
1612 if (!bMask && (has_alpha || (fState & ILS_ALPHA)))
1613 {
1614 COLORREF colour, blend_col = CLR_NONE;
1616
1617 if (bBlend)
1618 {
1619 blend_col = pimldp->rgbFg;
1620 if (blend_col == CLR_DEFAULT) blend_col = GetSysColor( COLOR_HIGHLIGHT );
1621 else if (blend_col == CLR_NONE) blend_col = GetTextColor( pimldp->hdcDst );
1622 }
1623
1624 func.BlendOp = AC_SRC_OVER;
1625 func.BlendFlags = 0;
1626 func.SourceConstantAlpha = (fState & ILS_ALPHA) ? pimldp->Frame : 255;
1627 func.AlphaFormat = AC_SRC_ALPHA;
1628
1629 if (bIsTransparent)
1630 {
1631#ifdef __REACTOS__
1632 bResult = alpha_blend_image( himl, hImageListDC, hMaskListDC, pimldp->hdcDst, pimldp->x, pimldp->y,
1633#else
1634 bResult = alpha_blend_image( himl, pimldp->hdcDst, pimldp->x, pimldp->y,
1635#endif
1636 pt.x, pt.y, cx, cy, func, fStyle, blend_col );
1637 goto end;
1638 }
1639 colour = pimldp->rgbBk;
1640 if (colour == CLR_DEFAULT) colour = himl->clrBk;
1641 if (colour == CLR_NONE) colour = GetBkColor( pimldp->hdcDst );
1642
1643 hOldBrush = SelectObject (hImageDC, CreateSolidBrush (colour));
1644 PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY );
1645#ifdef __REACTOS__
1646 alpha_blend_image( himl, hImageListDC, hMaskListDC, hImageDC, 0, 0, pt.x, pt.y, cx, cy, func, fStyle, blend_col );
1647#else
1648 alpha_blend_image( himl, hImageDC, 0, 0, pt.x, pt.y, cx, cy, func, fStyle, blend_col );
1649#endif
1650 DeleteObject (SelectObject (hImageDC, hOldBrush));
1651 bResult = BitBlt( pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, SRCCOPY );
1652 goto end;
1653 }
1654
1655 /*
1656 * Draw the initial image
1657 */
1658 if( bMask ) {
1659 if (himl->hbmMask) {
1660 hOldBrush = SelectObject (hImageDC, CreateSolidBrush (GetTextColor(pimldp->hdcDst)));
1661 PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY );
1662 BitBlt(hImageDC, 0, 0, cx, cy, hMaskListDC, pt.x, pt.y, SRCPAINT);
1663 DeleteObject (SelectObject (hImageDC, hOldBrush));
1664 if( bIsTransparent )
1665 {
1666 BitBlt ( pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, SRCAND);
1667 bResult = TRUE;
1668 goto end;
1669 }
1670 } else {
1671 hOldBrush = SelectObject (hImageDC, GetStockObject(BLACK_BRUSH));
1672 PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY);
1673 SelectObject(hImageDC, hOldBrush);
1674 }
1675 } else {
1676 /* blend the image with the needed solid background */
1677 COLORREF colour = RGB(0,0,0);
1678
1679 if( !bIsTransparent )
1680 {
1681 colour = pimldp->rgbBk;
1682 if( colour == CLR_DEFAULT )
1683 colour = himl->clrBk;
1684 if( colour == CLR_NONE )
1685 colour = GetBkColor(pimldp->hdcDst);
1686 }
1687
1688 hOldBrush = SelectObject (hImageDC, CreateSolidBrush (colour));
1689 PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY );
1690 if (himl->hbmMask)
1691 {
1692 BitBlt( hImageDC, 0, 0, cx, cy, hMaskListDC, pt.x, pt.y, SRCAND );
1693 BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, pt.x, pt.y, SRCPAINT );
1694 }
1695 else
1696 BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, pt.x, pt.y, SRCCOPY);
1697 DeleteObject (SelectObject (hImageDC, hOldBrush));
1698 }
1699
1700 /* Time for blending, if required */
1701 if (bBlend) {
1702 HBRUSH hBlendBrush;
1703 COLORREF clrBlend = pimldp->rgbFg;
1704 HDC hBlendMaskDC = hImageListDC;
1705 HBITMAP hOldBitmap;
1706
1707 /* Create the blend Mask */
1708 hOldBitmap = SelectObject(hBlendMaskDC, hBlendMaskBmp);
1709 hBlendBrush = fStyle & ILD_BLEND50 ? himl->hbrBlend50 : himl->hbrBlend25;
1710 hOldBrush = SelectObject(hBlendMaskDC, hBlendBrush);
1711 PatBlt(hBlendMaskDC, 0, 0, cx, cy, PATCOPY);
1712 SelectObject(hBlendMaskDC, hOldBrush);
1713
1714 /* Modify the blend mask if an Image Mask exist */
1715 if(himl->hbmMask) {
1716 BitBlt(hBlendMaskDC, 0, 0, cx, cy, hMaskListDC, pt.x, pt.y, 0x220326); /* NOTSRCAND */
1717 BitBlt(hBlendMaskDC, 0, 0, cx, cy, hBlendMaskDC, 0, 0, NOTSRCCOPY);
1718 }
1719
1720 /* now apply blend to the current image given the BlendMask */
1721 if (clrBlend == CLR_DEFAULT) clrBlend = GetSysColor (COLOR_HIGHLIGHT);
1722 else if (clrBlend == CLR_NONE) clrBlend = GetTextColor (pimldp->hdcDst);
1723 hOldBrush = SelectObject (hImageDC, CreateSolidBrush(clrBlend));
1724 BitBlt (hImageDC, 0, 0, cx, cy, hBlendMaskDC, 0, 0, 0xB8074A); /* PSDPxax */
1725 DeleteObject(SelectObject(hImageDC, hOldBrush));
1726 SelectObject(hBlendMaskDC, hOldBitmap);
1727 }
1728
1729 /* Now do the overlay image, if any */
1730 nOvlIdx = (pimldp->fStyle & ILD_OVERLAYMASK) >> 8;
1731 if ( (nOvlIdx >= 1) && (nOvlIdx <= MAX_OVERLAYIMAGE)) {
1732 nOvlIdx = himl->nOvlIdx[nOvlIdx - 1];
1733 if ((nOvlIdx >= 0) && (nOvlIdx < himl->cCurImage)) {
1734 POINT ptOvl;
1735 imagelist_point_from_index( himl, nOvlIdx, &ptOvl );
1736 ptOvl.x += pimldp->xBitmap;
1737 if (himl->hbmMask && !(fStyle & ILD_IMAGE))
1738 BitBlt (hImageDC, 0, 0, cx, cy, hMaskListDC, ptOvl.x, ptOvl.y, SRCAND);
1739 BitBlt (hImageDC, 0, 0, cx, cy, hImageListDC, ptOvl.x, ptOvl.y, SRCPAINT);
1740 }
1741 }
1742
1743#ifndef __REACTOS__
1744 if (fState & ILS_SATURATE) FIXME("ILS_SATURATE: unimplemented!\n");
1745#endif
1746 if (fState & ILS_GLOW) FIXME("ILS_GLOW: unimplemented!\n");
1747 if (fState & ILS_SHADOW) FIXME("ILS_SHADOW: unimplemented!\n");
1748
1749 if (fStyle & ILD_PRESERVEALPHA) FIXME("ILD_PRESERVEALPHA: unimplemented!\n");
1750 if (fStyle & ILD_SCALE) FIXME("ILD_SCALE: unimplemented!\n");
1751 if (fStyle & ILD_DPISCALE) FIXME("ILD_DPISCALE: unimplemented!\n");
1752
1753 /* now copy the image to the screen */
1754 dwRop = SRCCOPY;
1755 if (himl->hbmMask && bIsTransparent ) {
1756 COLORREF oldDstFg = SetTextColor(pimldp->hdcDst, RGB( 0, 0, 0 ) );
1757 COLORREF oldDstBk = SetBkColor(pimldp->hdcDst, RGB( 0xff, 0xff, 0xff ));
1758 BitBlt (pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hMaskListDC, pt.x, pt.y, SRCAND);
1759 SetBkColor(pimldp->hdcDst, oldDstBk);
1760 SetTextColor(pimldp->hdcDst, oldDstFg);
1761 dwRop = SRCPAINT;
1762 }
1763 if (fStyle & ILD_ROP) dwRop = pimldp->dwRop;
1764 BitBlt (pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, dwRop);
1765
1766 bResult = TRUE;
1767end:
1768 /* cleanup the mess */
1769 SetBkColor(hImageDC, oldImageBk);
1770 SetTextColor(hImageDC, oldImageFg);
1771 SelectObject(hImageDC, hOldImageBmp);
1772cleanup:
1773#ifdef __REACTOS__
1774 if (hdcSaturated)
1775 DeleteDC(hdcSaturated);
1776 if (hdcSaturatedMask)
1777 DeleteDC(hdcSaturatedMask);
1778#endif
1779 DeleteObject(hBlendMaskBmp);
1780 DeleteObject(hImageBmp);
1781 DeleteDC(hImageDC);
1782
1783 return bResult;
1784}
static BOOL alpha_blend_image(HIMAGELIST himl, HDC dest_dc, int dest_x, int dest_y, int src_x, int src_y, int cx, int cy, BLENDFUNCTION func, UINT style, COLORREF blend_col)
Definition: imagelist.c:1289
GLuint GLuint end
Definition: gl.h:1545
if(dx< 0)
Definition: linetemp.h:194
#define AC_SRC_ALPHA
Definition: alphablend.c:9
#define ILD_OVERLAYMASK
Definition: commctrl.h:424
#define ILS_SHADOW
Definition: commctrl.h:437
#define ILD_DPISCALE
Definition: commctrl.h:428
#define ILS_ALPHA
Definition: commctrl.h:439
#define ILD_TRANSPARENT
Definition: commctrl.h:418
#define ILS_NORMAL
Definition: commctrl.h:435
#define ILS_SATURATE
Definition: commctrl.h:438
#define ILS_GLOW
Definition: commctrl.h:436
#define ILD_ROP
Definition: commctrl.h:421
#define ILD_IMAGE
Definition: commctrl.h:420
#define ILD_SCALE
Definition: commctrl.h:427
#define ILD_MASK
Definition: commctrl.h:419
#define ILD_PRESERVEALPHA
Definition: commctrl.h:426
HGDIOBJ WINAPI GetStockObject(_In_ int)
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:861
#define AC_SRC_OVER
Definition: wingdi.h:1369
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
#define PATCOPY
Definition: wingdi.h:335
#define SRCPAINT
Definition: wingdi.h:334
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define BLACK_BRUSH
Definition: wingdi.h:896
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
#define NOTSRCCOPY
Definition: wingdi.h:325
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define SRCAND
Definition: wingdi.h:330
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_HIGHLIGHT
Definition: winuser.h:920

Referenced by ImageList_DrawEx(), ImageList_InternalDragDraw(), ImageListImpl_Draw(), init_functions(), and TOOLBAR_DrawImage().

◆ ImageList_Duplicate()

HIMAGELIST WINAPI ImageList_Duplicate ( HIMAGELIST  himlSrc)

Definition at line 1801 of file imagelist.c.

1802{
1803 HIMAGELIST himlDst;
1804
1805 if (!is_valid(himlSrc)) {
1806 ERR("Invalid image list handle!\n");
1807 return NULL;
1808 }
1809
1810 himlDst = ImageList_Create (himlSrc->cx, himlSrc->cy, himlSrc->flags,
1811 himlSrc->cCurImage, himlSrc->cGrow);
1812
1813 if (himlDst)
1814 {
1815 SIZE sz;
1816
1817 imagelist_get_bitmap_size(himlSrc, himlSrc->cCurImage, &sz);
1818 BitBlt (himlDst->hdcImage, 0, 0, sz.cx, sz.cy,
1819 himlSrc->hdcImage, 0, 0, SRCCOPY);
1820
1821 if (himlDst->hbmMask)
1822 BitBlt (himlDst->hdcMask, 0, 0, sz.cx, sz.cy,
1823 himlSrc->hdcMask, 0, 0, SRCCOPY);
1824
1825 himlDst->cCurImage = himlSrc->cCurImage;
1826 if (himlSrc->has_alpha && himlDst->has_alpha)
1827 memcpy( himlDst->has_alpha, himlSrc->has_alpha, himlDst->cCurImage );
1828 }
1829 return himlDst;
1830}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by ImageListImpl_Clone(), and SHGetImageList().

◆ ImageList_EndDrag()

VOID WINAPI ImageList_EndDrag ( void  )

◆ imagelist_get_bitmap_size()

static void imagelist_get_bitmap_size ( HIMAGELIST  himl,
UINT  count,
SIZE sz 
)
inlinestatic

◆ ImageList_GetBkColor()

COLORREF WINAPI ImageList_GetBkColor ( HIMAGELIST  himl)

Definition at line 1879 of file imagelist.c.

1880{
1881 return himl ? himl->clrBk : CLR_NONE;
1882}

Referenced by ImageListImpl_GetBkColor().

◆ ImageList_GetDragImage()

HIMAGELIST WINAPI ImageList_GetDragImage ( POINT ppt,
POINT pptHotspot 
)

Definition at line 1900 of file imagelist.c.

1901{
1902 if (is_valid(InternalDrag.himl)) {
1903 if (ppt) {
1904 ppt->x = InternalDrag.x;
1905 ppt->y = InternalDrag.y;
1906 }
1907 if (pptHotspot) {
1910 }
1911 return (InternalDrag.himl);
1912 }
1913
1914 return NULL;
1915}
_Out_opt_ POINT * pptHotspot
Definition: commctrl.h:554

Referenced by ImageListImpl_GetDragImage(), and init_functions().

◆ ImageList_GetFlags()

DWORD WINAPI ImageList_GetFlags ( HIMAGELIST  himl)

Definition at line 1934 of file imagelist.c.

1935{
1936 TRACE("%p\n", himl);
1937#ifdef __REACTOS__
1938 if(!is_valid2(himl))
1939 return 0;
1940 return himl->flags;
1941#else
1942 return is_valid(himl) ? himl->flags : 0;
1943#endif
1944}

Referenced by init_functions().

◆ ImageList_GetIcon()

HICON WINAPI ImageList_GetIcon ( HIMAGELIST  himl,
INT  i,
UINT  fStyle 
)

Definition at line 1963 of file imagelist.c.

1964{
1965 ICONINFO ii;
1966 HICON hIcon;
1967 HBITMAP hOldDstBitmap;
1968 HDC hdcDst;
1969 POINT pt;
1970
1971 TRACE("%p %d %d\n", himl, i, fStyle);
1972 if (!is_valid(himl) || (i < 0) || (i >= himl->cCurImage)) return NULL;
1973
1974 ii.fIcon = TRUE;
1975 ii.xHotspot = 0;
1976 ii.yHotspot = 0;
1977
1978 /* create colour bitmap */
1979 hdcDst = GetDC(0);
1981 ReleaseDC(0, hdcDst);
1982
1984
1986
1987 /* draw mask*/
1988 ii.hbmMask = CreateBitmap (himl->cx, himl->cy, 1, 1, NULL);
1989 hOldDstBitmap = SelectObject (hdcDst, ii.hbmMask);
1990 if (himl->hbmMask) {
1991 BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
1992 himl->hdcMask, pt.x, pt.y, SRCCOPY);
1993 }
1994 else
1995 PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS);
1996
1997 /* draw image*/
1999 BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
2000 himl->hdcImage, pt.x, pt.y, SRCCOPY);
2001
2002 /*
2003 * CreateIconIndirect requires us to deselect the bitmaps from
2004 * the DCs before calling
2005 */
2006 SelectObject(hdcDst, hOldDstBitmap);
2007
2008 hIcon = CreateIconIndirect (&ii);
2009
2010 DeleteObject (ii.hbmMask);
2012 DeleteDC (hdcDst);
2013
2014 return hIcon;
2015}
static HICON
Definition: imagelist.c:84
DWORD yHotspot
Definition: winuser.h:3115
BOOL fIcon
Definition: winuser.h:3113
DWORD xHotspot
Definition: winuser.h:3114
HBITMAP hbmColor
Definition: winuser.h:3117
HBITMAP hbmMask
Definition: winuser.h:3116
#define BLACKNESS
Definition: wingdi.h:323
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2550
static HDC hdcDst
Definition: xlate.c:32

Referenced by CShellBrowser::BrowseToPath(), CShellLink::CreateShortcutIcon(), ImageListImpl_GetIcon(), SHGetFileInfoW(), and SIC_OverlayShortcutImage().

◆ ImageList_GetIconSize()

◆ ImageList_GetImageCount()

◆ ImageList_GetImageInfo()

BOOL WINAPI ImageList_GetImageInfo ( HIMAGELIST  himl,
INT  i,
IMAGEINFO pImageInfo 
)

Definition at line 2088 of file imagelist.c.

2089{
2090 POINT pt;
2091
2092 if (!is_valid(himl) || (pImageInfo == NULL))
2093 return FALSE;
2094 if ((i < 0) || (i >= himl->cCurImage))
2095 return FALSE;
2096
2099
2101 pImageInfo->rcImage.top = pt.y;
2104 pImageInfo->rcImage.right = pt.x + himl->cx;
2105
2106 return TRUE;
2107}
_In_ int _Out_ IMAGEINFO * pImageInfo
Definition: commctrl.h:604
HBITMAP hbmMask
HBITMAP hbmImage
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306

Referenced by ImageList_GetImageRect(), ImageListImpl_GetImageInfo(), ImageListImpl_GetImageRect(), init_functions(), TOOLBAR_DrawImage(), and TreeListProc().

◆ ImageList_GetImageRect()

BOOL WINAPI ImageList_GetImageRect ( HIMAGELIST  himl,
INT  i,
LPRECT  lpRect 
)

Definition at line 2129 of file imagelist.c.

2130{
2131#ifdef __REACTOS__
2132 IMAGEINFO ImageInfo;
2133 if (!ImageList_GetImageInfo(himl, i, &ImageInfo))
2134 return FALSE;
2135 *lpRect = ImageInfo.rcImage;
2136#else
2137 POINT pt;
2138
2139 if (!is_valid(himl) || (lpRect == NULL))
2140 return FALSE;
2141 if ((i < 0) || (i >= himl->cCurImage))
2142 return FALSE;
2143
2145 lpRect->left = pt.x;
2146 lpRect->top = pt.y;
2147 lpRect->right = pt.x + himl->cx;
2148 lpRect->bottom = pt.y + himl->cy;
2149#endif
2150 return TRUE;
2151}
BOOL WINAPI ImageList_GetImageInfo(HIMAGELIST himl, INT i, IMAGEINFO *pImageInfo)
Definition: imagelist.c:2088

◆ imagelist_height()

static UINT imagelist_height ( UINT  count)
inlinestatic

Definition at line 181 of file imagelist.c.

182{
183 return ((count + TILE_COUNT - 1)/TILE_COUNT);
184}

Referenced by imagelist_copy_images(), and imagelist_get_bitmap_size().

◆ ImageList_InternalDragDraw()

static void ImageList_InternalDragDraw ( HDC  hdc,
INT  x,
INT  y 
)
inlinestatic

Definition at line 1032 of file imagelist.c.

1033{
1034 IMAGELISTDRAWPARAMS imldp;
1035
1036 ZeroMemory (&imldp, sizeof(imldp));
1037 imldp.cbSize = sizeof(imldp);
1038 imldp.himl = InternalDrag.himl;
1039 imldp.i = 0;
1040 imldp.hdcDst = hdc,
1041 imldp.x = x;
1042 imldp.y = y;
1043 imldp.rgbBk = CLR_DEFAULT;
1044 imldp.rgbFg = CLR_DEFAULT;
1045 imldp.fStyle = ILD_NORMAL;
1046 imldp.fState = ILS_ALPHA;
1047 imldp.Frame = 192;
1048 ImageList_DrawIndirect (&imldp);
1049}
#define ILD_NORMAL
Definition: commctrl.h:417

Referenced by ImageList_DragMove(), and ImageList_DragShowNolock().

◆ IMAGELIST_InternalExpandBitmaps()

static void IMAGELIST_InternalExpandBitmaps ( HIMAGELIST  himl,
INT  nImageCount 
)
static

Definition at line 361 of file imagelist.c.

362{
364 HBITMAP hbmNewBitmap, hbmNull;
365 INT nNewCount;
366 SIZE sz;
367
368 TRACE("%p has allocated %d, max %d, grow %d images\n", himl, himl->cCurImage, himl->cMaxImage, himl->cGrow);
369
370 if (himl->cCurImage + nImageCount < himl->cMaxImage)
371 return;
372
373 nNewCount = himl->cMaxImage + max(nImageCount, himl->cGrow) + 1;
374
375 imagelist_get_bitmap_size(himl, nNewCount, &sz);
376
377 TRACE("Create expanded bitmaps : himl=%p x=%d y=%d count=%d\n", himl, sz.cx, sz.cy, nNewCount);
379
380 hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount);
381
382 if (hbmNewBitmap == 0)
383 ERR("creating new image bitmap (x=%d y=%d)!\n", sz.cx, sz.cy);
384
385 if (himl->cCurImage)
386 {
387 hbmNull = SelectObject (hdcBitmap, hbmNewBitmap);
388 BitBlt (hdcBitmap, 0, 0, sz.cx, sz.cy,
389 himl->hdcImage, 0, 0, SRCCOPY);
390 SelectObject (hdcBitmap, hbmNull);
391 }
392 SelectObject (himl->hdcImage, hbmNewBitmap);
394 himl->hbmImage = hbmNewBitmap;
395
396 if (himl->flags & ILC_MASK)
397 {
398 hbmNewBitmap = CreateBitmap (sz.cx, sz.cy, 1, 1, NULL);
399
400 if (hbmNewBitmap == 0)
401 ERR("creating new mask bitmap!\n");
402
403 if(himl->cCurImage)
404 {
405 hbmNull = SelectObject (hdcBitmap, hbmNewBitmap);
406 BitBlt (hdcBitmap, 0, 0, sz.cx, sz.cy,
407 himl->hdcMask, 0, 0, SRCCOPY);
408 SelectObject (hdcBitmap, hbmNull);
409 }
410 SelectObject (himl->hdcMask, hbmNewBitmap);
412 himl->hbmMask = hbmNewBitmap;
413 }
414
415 if (himl->has_alpha)
416 {
417 char *new_alpha = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, himl->has_alpha, nNewCount );
418 if (new_alpha) himl->has_alpha = new_alpha;
419 else
420 {
423 }
424 }
425
426 himl->cMaxImage = nNewCount;
427
429}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapReAlloc
Definition: compat.h:734
#define HEAP_ZERO_MEMORY
Definition: compat.h:134

Referenced by ImageList_Add(), and ImageList_ReplaceIcon().

◆ ImageList_LoadImageA()

HIMAGELIST WINAPI ImageList_LoadImageA ( HINSTANCE  hi,
LPCSTR  lpbmp,
INT  cx,
INT  cGrow,
COLORREF  clrMask,
UINT  uType,
UINT  uFlags 
)

Definition at line 2164 of file imagelist.c.

2166{
2168 LPWSTR lpbmpW;
2169 DWORD len;
2170
2171 if (IS_INTRESOURCE(lpbmp))
2172 return ImageList_LoadImageW(hi, (LPCWSTR)lpbmp, cx, cGrow, clrMask,
2173 uType, uFlags);
2174
2175 len = MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, NULL, 0);
2176 lpbmpW = heap_alloc(len * sizeof(WCHAR));
2177 MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, lpbmpW, len);
2178
2179 himl = ImageList_LoadImageW(hi, lpbmpW, cx, cGrow, clrMask, uType, uFlags);
2180 heap_free (lpbmpW);
2181 return himl;
2182}
HIMAGELIST WINAPI ImageList_LoadImageW(HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow, COLORREF clrMask, UINT uType, UINT uFlags)
Definition: imagelist.c:2208
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
GLenum GLsizei len
Definition: glext.h:6722
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by init_functions().

◆ ImageList_LoadImageW()

HIMAGELIST WINAPI ImageList_LoadImageW ( HINSTANCE  hi,
LPCWSTR  lpbmp,
INT  cx,
INT  cGrow,
COLORREF  clrMask,
UINT  uType,
UINT  uFlags 
)

Definition at line 2208 of file imagelist.c.

2210{
2212 HANDLE handle;
2213 INT nImageCount;
2214
2215 handle = LoadImageW (hi, lpbmp, uType, 0, 0, uFlags);
2216 if (!handle) {
2217 WARN("Couldn't load image\n");
2218 return NULL;
2219 }
2220
2221 if (uType == IMAGE_BITMAP) {
2223 UINT color;
2224
2225 if (GetObjectW (handle, sizeof(dib), &dib) == sizeof(BITMAP)) color = ILC_COLOR;
2226 else color = dib.dsBm.bmBitsPixel;
2227
2228 /* To match windows behavior, if cx is set to zero and
2229 the flag DI_DEFAULTSIZE is specified, cx becomes the
2230 system metric value for icons. If the flag is not specified
2231 the function sets the size to the height of the bitmap */
2232 if (cx == 0)
2233 {
2234 if (uFlags & DI_DEFAULTSIZE)
2236 else
2237 cx = dib.dsBm.bmHeight;
2238 }
2239
2240 nImageCount = dib.dsBm.bmWidth / cx;
2241
2242 if (clrMask != CLR_NONE) color |= ILC_MASK;
2243 himl = ImageList_Create (cx, dib.dsBm.bmHeight, color, nImageCount, cGrow);
2244 if (!himl) {
2246 return NULL;
2247 }
2248 ImageList_AddMasked (himl, handle, clrMask);
2249 }
2250 else if ((uType == IMAGE_ICON) || (uType == IMAGE_CURSOR)) {
2251 ICONINFO ii;
2252 BITMAP bmp;
2253
2254 GetIconInfo (handle, &ii);
2255 GetObjectW (ii.hbmColor, sizeof(BITMAP), &bmp);
2256 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight,
2257 ILC_MASK | ILC_COLOR, 1, cGrow);
2258 if (!himl) {
2260 DeleteObject (ii.hbmMask);
2262 return NULL;
2263 }
2266 DeleteObject (ii.hbmMask);
2267 }
2268
2270
2271 return himl;
2272}
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
GLuint color
Definition: glext.h:6243
static const BYTE dib[]
Definition: ole2.c:201
#define DI_DEFAULTSIZE
Definition: wingdi.h:69
#define IMAGE_BITMAP
Definition: winuser.h:211
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2014
#define IMAGE_CURSOR
Definition: winuser.h:213
#define SM_CXICON
Definition: winuser.h:966
int WINAPI GetSystemMetrics(_In_ int)

Referenced by CFn_WMInitDialog(), CFn_WMMeasureItem(), create_rebar(), CAddressBand::CreateGoButton(), ImageList_LoadImageA(), init_functions(), CStartButton::Initialize(), CToolsBand::SetSite(), and wWinMain().

◆ ImageList_Merge()

HIMAGELIST WINAPI ImageList_Merge ( HIMAGELIST  himl1,
INT  i1,
HIMAGELIST  himl2,
INT  i2,
INT  dx,
INT  dy 
)

Definition at line 2300 of file imagelist.c.

2302{
2303 HIMAGELIST himlDst = NULL;
2304 INT cxDst, cyDst;
2305 INT xOff1, yOff1, xOff2, yOff2;
2306 POINT pt1, pt2;
2307 INT newFlags;
2308
2309 TRACE("(himl1=%p i1=%d himl2=%p i2=%d dx=%d dy=%d)\n", himl1, i1, himl2,
2310 i2, dx, dy);
2311
2312 if (!is_valid(himl1) || !is_valid(himl2))
2313 return NULL;
2314
2315 if (dx > 0) {
2316 cxDst = max (himl1->cx, dx + himl2->cx);
2317 xOff1 = 0;
2318 xOff2 = dx;
2319 }
2320 else if (dx < 0) {
2321 cxDst = max (himl2->cx, himl1->cx - dx);
2322 xOff1 = -dx;
2323 xOff2 = 0;
2324 }
2325 else {
2326 cxDst = max (himl1->cx, himl2->cx);
2327 xOff1 = 0;
2328 xOff2 = 0;
2329 }
2330
2331 if (dy > 0) {
2332 cyDst = max (himl1->cy, dy + himl2->cy);
2333 yOff1 = 0;
2334 yOff2 = dy;
2335 }
2336 else if (dy < 0) {
2337 cyDst = max (himl2->cy, himl1->cy - dy);
2338 yOff1 = -dy;
2339 yOff2 = 0;
2340 }
2341 else {
2342 cyDst = max (himl1->cy, himl2->cy);
2343 yOff1 = 0;
2344 yOff2 = 0;
2345 }
2346
2347 newFlags = (himl1->flags > himl2->flags ? himl1->flags : himl2->flags) & ILC_COLORDDB;
2348 if (newFlags == ILC_COLORDDB && (himl1->flags & ILC_COLORDDB) == ILC_COLOR16)
2349 newFlags = ILC_COLOR16; /* this is what native (at least v5) does, don't know why */
2350 himlDst = ImageList_Create (cxDst, cyDst, ILC_MASK | newFlags, 1, 1);
2351
2352 if (himlDst)
2353 {
2354 imagelist_point_from_index( himl1, i1, &pt1 );
2355 imagelist_point_from_index( himl2, i2, &pt2 );
2356
2357 /* copy image */
2358 BitBlt (himlDst->hdcImage, 0, 0, cxDst, cyDst, himl1->hdcImage, 0, 0, BLACKNESS);
2359 if (i1 >= 0 && i1 < himl1->cCurImage)
2360 BitBlt (himlDst->hdcImage, xOff1, yOff1, himl1->cx, himl1->cy, himl1->hdcImage, pt1.x, pt1.y, SRCCOPY);
2361 if (i2 >= 0 && i2 < himl2->cCurImage)
2362 {
2363 if (himl2->flags & ILC_MASK)
2364 {
2365 BitBlt (himlDst->hdcImage, xOff2, yOff2, himl2->cx, himl2->cy, himl2->hdcMask , pt2.x, pt2.y, SRCAND);
2366 BitBlt (himlDst->hdcImage, xOff2, yOff2, himl2->cx, himl2->cy, himl2->hdcImage, pt2.x, pt2.y, SRCPAINT);
2367 }
2368 else
2369 BitBlt (himlDst->hdcImage, xOff2, yOff2, himl2->cx, himl2->cy, himl2->hdcImage, pt2.x, pt2.y, SRCCOPY);
2370 }
2371
2372 /* copy mask */
2373 BitBlt (himlDst->hdcMask, 0, 0, cxDst, cyDst, himl1->hdcMask, 0, 0, WHITENESS);
2374 if (i1 >= 0 && i1 < himl1->cCurImage)
2375 BitBlt (himlDst->hdcMask, xOff1, yOff1, himl1->cx, himl1->cy, himl1->hdcMask, pt1.x, pt1.y, SRCCOPY);
2376 if (i2 >= 0 && i2 < himl2->cCurImage)
2377 BitBlt (himlDst->hdcMask, xOff2, yOff2, himl2->cx, himl2->cy, himl2->hdcMask, pt2.x, pt2.y, SRCAND);
2378
2379 himlDst->cCurImage = 1;
2380 }
2381
2382 return himlDst;
2383}
#define ILC_COLOR16
Definition: commctrl.h:356
#define WHITENESS
Definition: wingdi.h:337

Referenced by GROUP_GroupWndProc(), ImageList_SetDragCursorImage(), ImageListImpl_Merge(), and init_functions().

◆ imagelist_point_from_index()

◆ ImageList_Read()

HIMAGELIST WINAPI ImageList_Read ( IStream pstm)

Definition at line 2463 of file imagelist.c.

2464{
2465 char image_buf[sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256];
2466 char mask_buf[sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256];
2467 BITMAPINFO *image_info = (BITMAPINFO *)image_buf;
2468 BITMAPINFO *mask_info = (BITMAPINFO *)mask_buf;
2469 void *image_bits, *mask_bits = NULL;
2470 ILHEAD ilHead;
2472 unsigned int i;
2473
2474 TRACE("%p\n", pstm);
2475
2476 if (FAILED(IStream_Read (pstm, &ilHead, sizeof(ILHEAD), NULL)))
2477 return NULL;
2478 if (ilHead.usMagic != (('L' << 8) | 'I'))
2479 return NULL;
2480 if (ilHead.usVersion != 0x101) /* probably version? */
2481 return NULL;
2482
2483 TRACE("cx %u, cy %u, flags 0x%04x, cCurImage %u, cMaxImage %u\n",
2484 ilHead.cx, ilHead.cy, ilHead.flags, ilHead.cCurImage, ilHead.cMaxImage);
2485
2486 himl = ImageList_Create(ilHead.cx, ilHead.cy, ilHead.flags, ilHead.cCurImage, ilHead.cMaxImage);
2487 if (!himl)
2488 return NULL;
2489
2490 if (!(image_bits = read_bitmap(pstm, image_info)))
2491 {
2492 WARN("failed to read bitmap from stream\n");
2493 return NULL;
2494 }
2495 if (ilHead.flags & ILC_MASK)
2496 {
2497 if (!(mask_bits = read_bitmap(pstm, mask_info)))
2498 {
2499 WARN("failed to read mask bitmap from stream\n");
2500 return NULL;
2501 }
2502 }
2503 else mask_info = NULL;
2504
2505 if (himl->has_alpha && image_info->bmiHeader.biBitCount == 32)
2506 {
2507 DWORD *ptr = image_bits;
2508 BYTE *mask_ptr = mask_bits;
2509 int stride = himl->cy * image_info->bmiHeader.biWidth;
2510
2511 if (image_info->bmiHeader.biHeight > 0) /* bottom-up */
2512 {
2513 ptr += image_info->bmiHeader.biHeight * image_info->bmiHeader.biWidth - stride;
2514 mask_ptr += (image_info->bmiHeader.biHeight * image_info->bmiHeader.biWidth - stride) / 8;
2515 stride = -stride;
2516 image_info->bmiHeader.biHeight = himl->cy;
2517 }
2518 else image_info->bmiHeader.biHeight = -himl->cy;
2519
2520 for (i = 0; i < ilHead.cCurImage; i += TILE_COUNT)
2521 {
2522 add_dib_bits( himl, i, min( ilHead.cCurImage - i, TILE_COUNT ),
2523 himl->cx, himl->cy, image_info, mask_info, ptr, mask_ptr );
2524 ptr += stride;
2525 mask_ptr += stride / 8;
2526 }
2527 }
2528 else
2529 {
2530 StretchDIBits( himl->hdcImage, 0, 0, image_info->bmiHeader.biWidth, image_info->bmiHeader.biHeight,
2531 0, 0, image_info->bmiHeader.biWidth, image_info->bmiHeader.biHeight,
2532 image_bits, image_info, DIB_RGB_COLORS, SRCCOPY);
2533 if (mask_info)
2534 StretchDIBits( himl->hdcMask, 0, 0, mask_info->bmiHeader.biWidth, mask_info->bmiHeader.biHeight,
2535 0, 0, mask_info->bmiHeader.biWidth, mask_info->bmiHeader.biHeight,
2536 mask_bits, mask_info, DIB_RGB_COLORS, SRCCOPY);
2537 }
2538 heap_free( image_bits );
2539 heap_free( mask_bits );
2540
2541 himl->cCurImage = ilHead.cCurImage;
2542 himl->cMaxImage = ilHead.cMaxImage;
2543
2545 for (i=0;i<4;i++)
2547 return himl;
2548}
COLORREF WINAPI ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk)
Definition: imagelist.c:2889
BOOL WINAPI ImageList_SetOverlayImage(HIMAGELIST himl, INT iImage, INT iOverlay)
Definition: imagelist.c:3180
static void * read_bitmap(IStream *pstm, BITMAPINFO *bmi)
Definition: imagelist.c:2387
WORD cCurImage
Definition: imagelist.c:128
WORD flags
Definition: imagelist.c:134
WORD cy
Definition: imagelist.c:132
SHORT ovls[4]
Definition: imagelist.c:135
WORD cMaxImage
Definition: imagelist.c:129
USHORT usMagic
Definition: imagelist.c:126
COLORREF bkcolor
Definition: imagelist.c:133
USHORT usVersion
Definition: imagelist.c:127
WORD cx
Definition: imagelist.c:131

Referenced by init_functions().

◆ ImageList_Remove()

BOOL WINAPI ImageList_Remove ( HIMAGELIST  himl,
INT  i 
)

Definition at line 2568 of file imagelist.c.

2569{
2570 HBITMAP hbmNewImage, hbmNewMask;
2571 HDC hdcBmp;
2572 SIZE sz;
2573
2574 TRACE("(himl=%p i=%d)\n", himl, i);
2575
2576 if (!is_valid(himl)) {
2577 ERR("Invalid image list handle!\n");
2578 return FALSE;
2579 }
2580
2581 if ((i < -1) || (i >= himl->cCurImage)) {
2582 TRACE("index out of range! %d\n", i);
2583 return FALSE;
2584 }
2585
2586 if (i == -1) {
2587 INT nCount;
2588
2589 /* remove all */
2590 if (himl->cCurImage == 0) {
2591 /* remove all on empty ImageList is allowed */
2592 TRACE("remove all on empty ImageList!\n");
2593 return TRUE;
2594 }
2595
2597 himl->cCurImage = 0;
2598 for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
2599 himl->nOvlIdx[nCount] = -1;
2600
2601 if (himl->has_alpha)
2602 {
2604 himl->has_alpha = heap_alloc_zero( himl->cMaxImage );
2605 }
2606
2608 SelectObject (himl->hdcImage, hbmNewImage);
2610 himl->hbmImage = hbmNewImage;
2611
2612 if (himl->hbmMask) {
2613
2615 hbmNewMask = CreateBitmap (sz.cx, sz.cy, 1, 1, NULL);
2616 SelectObject (himl->hdcMask, hbmNewMask);
2618 himl->hbmMask = hbmNewMask;
2619 }
2620 }
2621 else {
2622 /* delete one image */
2623 TRACE("Remove single image! %d\n", i);
2624
2625 /* create new bitmap(s) */
2626 TRACE(" - Number of images: %d / %d (Old/New)\n",
2627 himl->cCurImage, himl->cCurImage - 1);
2628
2630
2632 if (himl->hbmMask)
2633 hbmNewMask = CreateBitmap (sz.cx, sz.cy, 1, 1, NULL);
2634 else
2635 hbmNewMask = 0; /* Just to keep compiler happy! */
2636
2637 hdcBmp = CreateCompatibleDC (0);
2638
2639 /* copy all images and masks prior to the "removed" image */
2640 if (i > 0) {
2641 TRACE("Pre image copy: Copy %d images\n", i);
2642
2643 SelectObject (hdcBmp, hbmNewImage);
2644 imagelist_copy_images( himl, himl->hdcImage, hdcBmp, 0, i, 0 );
2645
2646 if (himl->hbmMask) {
2647 SelectObject (hdcBmp, hbmNewMask);
2648 imagelist_copy_images( himl, himl->hdcMask, hdcBmp, 0, i, 0 );
2649 }
2650 }
2651
2652 /* copy all images and masks behind the removed image */
2653 if (i < himl->cCurImage - 1) {
2654 TRACE("Post image copy!\n");
2655
2656 SelectObject (hdcBmp, hbmNewImage);
2657 imagelist_copy_images( himl, himl->hdcImage, hdcBmp, i + 1,
2658 (himl->cCurImage - i), i );
2659
2660 if (himl->hbmMask) {
2661 SelectObject (hdcBmp, hbmNewMask);
2662 imagelist_copy_images( himl, himl->hdcMask, hdcBmp, i + 1,
2663 (himl->cCurImage - i), i );
2664 }
2665 }
2666
2667 DeleteDC (hdcBmp);
2668
2669 /* delete old images and insert new ones */
2670 SelectObject (himl->hdcImage, hbmNewImage);
2672 himl->hbmImage = hbmNewImage;
2673 if (himl->hbmMask) {
2674 SelectObject (himl->hdcMask, hbmNewMask);
2676 himl->hbmMask = hbmNewMask;
2677 }
2678
2679 himl->cCurImage--;
2680 }
2681
2682 return TRUE;
2683}
static void imagelist_copy_images(HIMAGELIST himl, HDC hdcSrc, HDC hdcDest, UINT src, UINT count, UINT dest)
Definition: imagelist.c:215

Referenced by ApplicationPageRefreshThread(), ImageListImpl_Remove(), init_functions(), CNotifyToolbar::RemoveButton(), CTaskSwitchWnd::RemoveIcon(), SIC_IconAppend(), TAB_RemoveImage(), and TOOLBAR_ReplaceBitmap().

◆ ImageList_Replace()

BOOL WINAPI ImageList_Replace ( HIMAGELIST  himl,
INT  i,
HBITMAP  hbmImage,
HBITMAP  hbmMask 
)

Definition at line 2703 of file imagelist.c.

2705{
2706 HDC hdcImage;
2707 BITMAP bmp;
2708 POINT pt;
2709
2710 TRACE("%p %d %p %p\n", himl, i, hbmImage, hbmMask);
2711
2712 if (!is_valid(himl)) {
2713 ERR("Invalid image list handle!\n");
2714 return FALSE;
2715 }
2716
2717 if ((i >= himl->cMaxImage) || (i < 0)) {
2718 ERR("Invalid image index!\n");
2719 return FALSE;
2720 }
2721
2722 if (!GetObjectW(hbmImage, sizeof(BITMAP), &bmp))
2723 return FALSE;
2724
2725 hdcImage = CreateCompatibleDC (0);
2726
2727 /* Replace Image */
2728 SelectObject (hdcImage, hbmImage);
2729
2730 if (add_with_alpha( himl, hdcImage, i, 1, bmp.bmWidth, bmp.bmHeight, hbmImage, hbmMask ))
2731 goto done;
2732
2734 StretchBlt (himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy,
2735 hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
2736
2737 if (himl->hbmMask)
2738 {
2739 HDC hdcTemp;
2740 HBITMAP hOldBitmapTemp;
2741
2742 hdcTemp = CreateCompatibleDC(0);
2743 hOldBitmapTemp = SelectObject(hdcTemp, hbmMask);
2744
2745 StretchBlt (himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy,
2746 hdcTemp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
2747 SelectObject(hdcTemp, hOldBitmapTemp);
2748 DeleteDC(hdcTemp);
2749
2750 /* Remove the background from the image
2751 */
2752 BitBlt (himl->hdcImage, pt.x, pt.y, bmp.bmWidth, bmp.bmHeight,
2753 himl->hdcMask, pt.x, pt.y, 0x220326); /* NOTSRCAND */
2754 }
2755
2756done:
2757 DeleteDC (hdcImage);
2758
2759 return TRUE;
2760}

Referenced by ImageListImpl_Replace(), and init_functions().

◆ ImageList_ReplaceIcon()

INT WINAPI ImageList_ReplaceIcon ( HIMAGELIST  himl,
INT  nIndex,
HICON  hIcon 
)

Definition at line 2779 of file imagelist.c.

2780{
2781 HICON hBestFitIcon;
2782 ICONINFO ii;
2783 BITMAP bmp;
2784 BOOL ret;
2785 POINT pt;
2786
2787 TRACE("(%p %d %p)\n", himl, nIndex, hIcon);
2788
2789 if (!is_valid(himl)) {
2790 ERR("invalid image list\n");
2791 return -1;
2792 }
2793 if ((nIndex >= himl->cMaxImage) || (nIndex < -1)) {
2794 ERR("invalid image index %d / %d\n", nIndex, himl->cMaxImage);
2795 return -1;
2796 }
2797
2798 hBestFitIcon = CopyImage(
2800 himl->cx, himl->cy,
2802 /* the above will fail if the icon wasn't loaded from a resource, so try
2803 * again without LR_COPYFROMRESOURCE flag */
2804 if (!hBestFitIcon)
2805 hBestFitIcon = CopyImage(
2807 himl->cx, himl->cy,
2808 0);
2809 if (!hBestFitIcon)
2810 return -1;
2811
2812 if (nIndex == -1) {
2813 if (himl->cCurImage + 1 >= himl->cMaxImage)
2815
2816 nIndex = himl->cCurImage;
2817 himl->cCurImage++;
2818 }
2819
2820 if (himl->has_alpha && GetIconInfo (hBestFitIcon, &ii))
2821 {
2822 HDC hdcImage = CreateCompatibleDC( 0 );
2823 GetObjectW (ii.hbmMask, sizeof(BITMAP), &bmp);
2824
2825 if (!ii.hbmColor)
2826 {
2827 UINT height = bmp.bmHeight / 2;
2828 HDC hdcMask = CreateCompatibleDC( 0 );
2829 HBITMAP color = CreateBitmap( bmp.bmWidth, height, 1, 1, NULL );
2830 SelectObject( hdcImage, color );
2831 SelectObject( hdcMask, ii.hbmMask );
2832 BitBlt( hdcImage, 0, 0, bmp.bmWidth, height, hdcMask, 0, height, SRCCOPY );
2833 ret = add_with_alpha( himl, hdcImage, nIndex, 1, bmp.bmWidth, height, color, ii.hbmMask );
2834 DeleteDC( hdcMask );
2836 }
2837 else ret = add_with_alpha( himl, hdcImage, nIndex, 1, bmp.bmWidth, bmp.bmHeight,
2838 ii.hbmColor, ii.hbmMask );
2839
2840 DeleteDC( hdcImage );
2841 DeleteObject (ii.hbmMask);
2842 if (ii.hbmColor) DeleteObject (ii.hbmColor);
2843 if (ret) goto done;
2844 }
2845
2847
2848 if (himl->hbmMask)
2849 {
2850 DrawIconEx( himl->hdcImage, pt.x, pt.y, hBestFitIcon, himl->cx, himl->cy, 0, 0, DI_IMAGE );
2851 PatBlt( himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy, WHITENESS );
2852 DrawIconEx( himl->hdcMask, pt.x, pt.y, hBestFitIcon, himl->cx, himl->cy, 0, 0, DI_MASK );
2853 }
2854 else
2855 {
2857 HBRUSH brush = CreateSolidBrush( GetNearestColor( himl->hdcImage, color ));
2858
2859 SelectObject( himl->hdcImage, brush );
2860 PatBlt( himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy, PATCOPY );
2862 DeleteObject( brush );
2863 DrawIconEx( himl->hdcImage, pt.x, pt.y, hBestFitIcon, himl->cx, himl->cy, 0, 0, DI_NORMAL );
2864 }
2865
2866done:
2867 DestroyIcon(hBestFitIcon);
2868
2869 TRACE("Insert index = %d, himl->cCurImage = %d\n", nIndex, himl->cCurImage);
2870 return nIndex;
2871}
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
COLORREF clrWindow
Definition: comctl32.h:176
#define DI_NORMAL
Definition: wingdi.h:72
#define DI_IMAGE
Definition: wingdi.h:70
#define DI_MASK
Definition: wingdi.h:71
COLORREF WINAPI GetNearestColor(_In_ HDC, _In_ COLORREF)
#define LR_COPYFROMRESOURCE
Definition: winuser.h:1093
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:1997
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022

Referenced by AddOrUpdateHwnd(), CTaskSwitchWnd::AddTaskItemButton(), DesktopPageProc(), ImageList_AddIcon(), ImageListImpl_ReplaceIcon(), init_functions(), PROGRAM_AddProgram(), CNotifyToolbar::UpdateButton(), and CTaskSwitchWnd::UpdateTaskItemButton().

◆ ImageList_SetBkColor()

◆ ImageList_SetColorTable()

UINT WINAPI ImageList_SetColorTable ( HIMAGELIST  himl,
UINT  uStartIndex,
UINT  cEntries,
const RGBQUAD prgb 
)

Definition at line 3403 of file imagelist.c.

3404{
3405#ifdef __REACTOS__
3406 if(!is_valid2(himl))
3407 return 0;
3408#endif
3409 TRACE("(%p, %d, %d, %p)\n", himl, uStartIndex, cEntries, prgb);
3411 return SetDIBColorTable(himl->hdcImage, uStartIndex, cEntries, prgb);
3412}
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3621
UINT WINAPI SetDIBColorTable(_In_ HDC hdc, _In_ UINT iStart, _In_ UINT cEntries, _In_reads_(cEntries) const RGBQUAD *prgbq)

Referenced by ImageList_Add(), and init_functions().

◆ ImageList_SetDragCursorImage()

BOOL WINAPI ImageList_SetDragCursorImage ( HIMAGELIST  himlDrag,
INT  iDrag,
INT  dxHotspot,
INT  dyHotspot 
)

Definition at line 2928 of file imagelist.c.

2930{
2931 HIMAGELIST himlTemp;
2932 BOOL visible;
2933
2934 if (!is_valid(InternalDrag.himl) || !is_valid(himlDrag))
2935 return FALSE;
2936
2937 TRACE(" dxH=%d dyH=%d nX=%d nY=%d\n",
2938 dxHotspot, dyHotspot, InternalDrag.dxHotspot, InternalDrag.dyHotspot);
2939
2940 visible = InternalDrag.bShow;
2941
2942 himlTemp = ImageList_Merge (InternalDrag.himlNoCursor, 0, himlDrag, iDrag,
2943 dxHotspot, dyHotspot);
2944
2945 if (visible) {
2946 /* hide the drag image */
2948 }
2949 if ((InternalDrag.himl->cx != himlTemp->cx) ||
2950 (InternalDrag.himl->cy != himlTemp->cy)) {
2951 /* the size of the drag image changed, invalidate the buffer */
2953 InternalDrag.hbmBg = 0;
2954 }
2955
2958 InternalDrag.himl = himlTemp;
2959
2960 if (visible) {
2961 /* show the drag image */
2963 }
2964
2965 return TRUE;
2966}
HIMAGELIST WINAPI ImageList_Merge(HIMAGELIST himl1, INT i1, HIMAGELIST himl2, INT i2, INT dx, INT dy)
Definition: imagelist.c:2300

Referenced by ImageListImpl_SetDragCursorImage(), and init_functions().

◆ ImageList_SetFilter()

BOOL WINAPI ImageList_SetFilter ( HIMAGELIST  himl,
INT  i,
DWORD  dwFilter 
)

Definition at line 2990 of file imagelist.c.

2991{
2992 FIXME("(%p 0x%x 0x%x):empty stub!\n", himl, i, dwFilter);
2993
2994 return FALSE;
2995}

◆ ImageList_SetFlags()

DWORD WINAPI ImageList_SetFlags ( HIMAGELIST  himl,
DWORD  flags 
)

Definition at line 3015 of file imagelist.c.

3016{
3017 FIXME("(%p %08x):empty stub\n", himl, flags);
3018 return 0;
3019}

◆ ImageList_SetIconSize()

BOOL WINAPI ImageList_SetIconSize ( HIMAGELIST  himl,
INT  cx,
INT  cy 
)

Definition at line 3038 of file imagelist.c.

3039{
3040 INT nCount;
3041 HBITMAP hbmNew;
3042
3043 if (!is_valid(himl))
3044 return FALSE;
3045
3046 /* remove all images */
3047 himl->cMaxImage = himl->cInitial + 1;
3048 himl->cCurImage = 0;
3049 himl->cx = cx;
3050 himl->cy = cy;
3051
3052 /* initialize overlay mask indices */
3053 for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
3054 himl->nOvlIdx[nCount] = -1;
3055
3057 SelectObject (himl->hdcImage, hbmNew);
3059 himl->hbmImage = hbmNew;
3060
3061 if (himl->hbmMask) {
3062 SIZE sz;
3064 hbmNew = CreateBitmap (sz.cx, sz.cy, 1, 1, NULL);
3065 SelectObject (himl->hdcMask, hbmNew);
3067 himl->hbmMask = hbmNew;
3068 }
3069
3070 return TRUE;
3071}

Referenced by ImageListImpl_SetIconSize(), TOOLBAR_SetBitmapSize(), and CTaskSwitchWnd::UpdateButtonsSize().

◆ ImageList_SetImageCount()

BOOL WINAPI ImageList_SetImageCount ( HIMAGELIST  himl,
UINT  iImageCount 
)

Definition at line 3089 of file imagelist.c.

3090{
3091 HDC hdcBitmap;
3092 HBITMAP hbmNewBitmap, hbmOld;
3093 INT nNewCount, nCopyCount;
3094
3095 TRACE("%p %d\n",himl,iImageCount);
3096
3097 if (!is_valid(himl))
3098 return FALSE;
3099
3100 nNewCount = iImageCount + 1;
3101 nCopyCount = min(himl->cCurImage, iImageCount);
3102
3104
3105 hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount);
3106
3107 if (hbmNewBitmap != 0)
3108 {
3109 hbmOld = SelectObject (hdcBitmap, hbmNewBitmap);
3110 imagelist_copy_images( himl, himl->hdcImage, hdcBitmap, 0, nCopyCount, 0 );
3111 SelectObject (hdcBitmap, hbmOld);
3112
3113 /* FIXME: delete 'empty' image space? */
3114
3115 SelectObject (himl->hdcImage, hbmNewBitmap);
3117 himl->hbmImage = hbmNewBitmap;
3118 }
3119 else
3120 ERR("Could not create new image bitmap!\n");
3121
3122 if (himl->hbmMask)
3123 {
3124 SIZE sz;
3125 imagelist_get_bitmap_size( himl, nNewCount, &sz );
3126 hbmNewBitmap = CreateBitmap (sz.cx, sz.cy, 1, 1, NULL);
3127 if (hbmNewBitmap != 0)
3128 {
3129 hbmOld = SelectObject (hdcBitmap, hbmNewBitmap);
3130 imagelist_copy_images( himl, himl->hdcMask, hdcBitmap, 0, nCopyCount, 0 );
3131 SelectObject (hdcBitmap, hbmOld);
3132
3133 /* FIXME: delete 'empty' image space? */
3134
3135 SelectObject (himl->hdcMask, hbmNewBitmap);
3137 himl->hbmMask = hbmNewBitmap;
3138 }
3139 else
3140 ERR("Could not create new mask bitmap!\n");
3141 }
3142
3144
3145 if (himl->has_alpha)
3146 {
3147 char *new_alpha = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, himl->has_alpha, nNewCount );
3148 if (new_alpha) himl->has_alpha = new_alpha;
3149 else
3150 {
3152 himl->has_alpha = NULL;
3153 }
3154 }
3155
3156 /* Update max image count and current image count */
3157 himl->cMaxImage = nNewCount;
3158 himl->cCurImage = iImageCount;
3159
3160 return TRUE;
3161}

Referenced by ImageListImpl_SetImageCount(), init_functions(), and TOOLBAR_AddBitmapToImageList().

◆ ImageList_SetOverlayImage()

BOOL WINAPI ImageList_SetOverlayImage ( HIMAGELIST  himl,
INT  iImage,
INT  iOverlay 
)

Definition at line 3180 of file imagelist.c.

3181{
3182 if (!is_valid(himl))
3183 return FALSE;
3184 if ((iOverlay < 1) || (iOverlay > MAX_OVERLAYIMAGE))
3185 return FALSE;
3186 if ((iImage!=-1) && ((iImage < 0) || (iImage > himl->cCurImage)))
3187 return FALSE;
3188 himl->nOvlIdx[iOverlay - 1] = iImage;
3189 return TRUE;
3190}

Referenced by ImageList_Read(), ImageListImpl_SetOverlayImage(), and SetupDiGetClassImageListExW().

◆ ImageList_Write()

BOOL WINAPI ImageList_Write ( HIMAGELIST  himl,
IStream pstm 
)

Definition at line 3283 of file imagelist.c.

3284{
3285 ILHEAD ilHead;
3286 int i;
3287
3288 TRACE("%p %p\n", himl, pstm);
3289
3290 if (!is_valid(himl))
3291 return FALSE;
3292
3293 ilHead.usMagic = (('L' << 8) | 'I');
3294 ilHead.usVersion = 0x101;
3295 ilHead.cCurImage = himl->cCurImage;
3296 ilHead.cMaxImage = himl->cMaxImage;
3297 ilHead.cGrow = himl->cGrow;
3298 ilHead.cx = himl->cx;
3299 ilHead.cy = himl->cy;
3300 ilHead.bkcolor = himl->clrBk;
3301 ilHead.flags = himl->flags;
3302 for(i = 0; i < 4; i++) {
3303 ilHead.ovls[i] = himl->nOvlIdx[i];
3304 }
3305
3306 TRACE("cx %u, cy %u, flags 0x04%x, cCurImage %u, cMaxImage %u\n",
3307 ilHead.cx, ilHead.cy, ilHead.flags, ilHead.cCurImage, ilHead.cMaxImage);
3308
3309 if(FAILED(IStream_Write(pstm, &ilHead, sizeof(ILHEAD), NULL)))
3310 return FALSE;
3311
3312 /* write the bitmap */
3313 if(!_write_bitmap(himl->hbmImage, pstm))
3314 return FALSE;
3315
3316 /* write the mask if we have one */
3317 if(himl->flags & ILC_MASK) {
3318 if(!_write_bitmap(himl->hbmMask, pstm))
3319 return FALSE;
3320 }
3321
3322 return TRUE;
3323}
static BOOL _write_bitmap(HBITMAP hBitmap, IStream *pstm)
Definition: imagelist.c:3197
WORD cGrow
Definition: imagelist.c:130

Referenced by init_functions().

◆ ImageListImpl_Add()

static HRESULT WINAPI ImageListImpl_Add ( IImageList2 iface,
HBITMAP  hbmImage,
HBITMAP  hbmMask,
int pi 
)
static

Definition at line 3511 of file imagelist.c.

3513{
3514 HIMAGELIST imgl = impl_from_IImageList2(iface);
3515 int ret;
3516
3517 if (!pi)
3518 return E_FAIL;
3519
3520 ret = ImageList_Add(imgl, hbmImage, hbmMask);
3521
3522 if (ret == -1)
3523 return E_FAIL;
3524
3525 *pi = ret;
3526 return S_OK;
3527}
#define E_FAIL
Definition: ddrawi.h:102
static HIMAGELIST impl_from_IImageList2(IImageList2 *iface)
Definition: imagelist.c:159
#define S_OK
Definition: intsafe.h:52
static refpint_t pi[]
Definition: server.c:96

◆ ImageListImpl_AddMasked()

static HRESULT WINAPI ImageListImpl_AddMasked ( IImageList2 iface,
HBITMAP  hbmImage,
COLORREF  crMask,
int pi 
)
static

Definition at line 3561 of file imagelist.c.

3563{
3564 HIMAGELIST imgl = impl_from_IImageList2(iface);
3565 int ret;
3566
3567 if (!pi)
3568 return E_FAIL;
3569
3570 ret = ImageList_AddMasked(imgl, hbmImage, crMask);
3571
3572 if (ret == -1)
3573 return E_FAIL;
3574
3575 *pi = ret;
3576 return S_OK;
3577}

◆ ImageListImpl_AddRef()

static ULONG WINAPI ImageListImpl_AddRef ( IImageList2 iface)
static

Definition at line 3470 of file imagelist.c.

3471{
3472 HIMAGELIST imgl = impl_from_IImageList2(iface);
3474
3475 TRACE("(%p) refcount=%u\n", iface, ref);
3476 return ref;
3477}
#define InterlockedIncrement
Definition: armddk.h:53
LONG ref
Definition: imagelist.c:114
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ ImageListImpl_BeginDrag()

static HRESULT WINAPI ImageListImpl_BeginDrag ( IImageList2 iface,
int  iTrack,
int  dxHotspot,
int  dyHotspot 
)
static

Definition at line 3771 of file imagelist.c.

3773{
3774 HIMAGELIST imgl = impl_from_IImageList2(iface);
3775 return ImageList_BeginDrag(imgl, iTrack, dxHotspot, dyHotspot) ? S_OK : E_FAIL;
3776}
BOOL WINAPI ImageList_BeginDrag(HIMAGELIST himlTrack, INT iTrack, INT dxHotspot, INT dyHotspot)
Definition: imagelist.c:638

◆ ImageListImpl_Clone()

static HRESULT WINAPI ImageListImpl_Clone ( IImageList2 iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 3692 of file imagelist.c.

3693{
3694 HIMAGELIST imgl = impl_from_IImageList2(iface);
3695 HIMAGELIST clone;
3696 HRESULT ret = E_FAIL;
3697
3698 TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
3699
3700 clone = ImageList_Duplicate(imgl);
3701
3702 /* Get the interface for the new image list */
3703 if (clone)
3704 {
3706 ImageList_Destroy(clone);
3707 }
3708
3709 return ret;
3710}
HRESULT WINAPI HIMAGELIST_QueryInterface(HIMAGELIST himl, REFIID riid, void **ppv)
Definition: imagelist.c:4038
HIMAGELIST WINAPI ImageList_Duplicate(HIMAGELIST himlSrc)
Definition: imagelist.c:1801

◆ ImageListImpl_Copy()

static HRESULT WINAPI ImageListImpl_Copy ( IImageList2 iface,
int  dst_index,
IUnknown unk_src,
int  src_index,
UINT  flags 
)
static

Definition at line 3628 of file imagelist.c.

3630{
3631 HIMAGELIST imgl = impl_from_IImageList2(iface);
3632 IImageList *src = NULL;
3633 HRESULT ret;
3634
3635 if (!unk_src)
3636 return E_FAIL;
3637
3638#ifdef __REACTOS__
3639 /* Make sure that the second image list uses the same implementation with the first */
3640 if (!is_valid2((HIMAGELIST)unk_src))
3641 return E_FAIL;
3642#endif
3643
3644 /* TODO: Add test for IID_ImageList2 too */
3645 if (FAILED(IUnknown_QueryInterface(unk_src, &IID_IImageList,
3646 (void **) &src)))
3647 return E_FAIL;
3648
3649 if (ImageList_Copy(imgl, dst_index, (HIMAGELIST) src, src_index, flags))
3650 ret = S_OK;
3651 else
3652 ret = E_FAIL;
3653
3654 IImageList_Release(src);
3655 return ret;
3656}
BOOL WINAPI ImageList_Copy(HIMAGELIST himlDst, INT iDst, HIMAGELIST himlSrc, INT iSrc, UINT uFlags)
Definition: imagelist.c:706

◆ ImageListImpl_CreateInstance()

static HRESULT ImageListImpl_CreateInstance ( const IUnknown pUnkOuter,
REFIID  iid,
void **  ppv 
)
static

Definition at line 4044 of file imagelist.c.

4045{
4047 HRESULT ret;
4048
4049 TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv);
4050
4051 *ppv = NULL;
4052
4053 if (pUnkOuter) return CLASS_E_NOAGGREGATION;
4054
4055 This = heap_alloc_zero(sizeof(struct _IMAGELIST));
4056 if (!This) return E_OUTOFMEMORY;
4057
4058 This->IImageList2_iface.lpVtbl = &ImageListImpl_Vtbl;
4059#ifdef __REACTOS__
4060 This->usMagic = IMAGELIST_MAGIC;
4061#endif
4062 This->ref = 1;
4063
4064 ret = IImageList2_QueryInterface(&This->IImageList2_iface, iid, ppv);
4065 IImageList2_Release(&This->IImageList2_iface);
4066
4067 return ret;
4068}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define IMAGELIST_MAGIC
Definition: imagelist.c:117
static const IImageList2Vtbl ImageListImpl_Vtbl
Definition: imagelist.c:3951
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662

Referenced by ImageList_CoCreateInstance(), and ImageList_Create().

◆ ImageListImpl_DiscardImages()

static HRESULT WINAPI ImageListImpl_DiscardImages ( IImageList2 iface,
INT  first_image,
INT  last_image,
DWORD  flags 
)
static

Definition at line 3914 of file imagelist.c.

3915{
3916 FIXME("(%p)->(%d %d %x): stub\n", iface, first_image, last_image, flags);
3917 return E_NOTIMPL;
3918}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ImageListImpl_DragEnter()

static HRESULT WINAPI ImageListImpl_DragEnter ( IImageList2 iface,
HWND  hwndLock,
int  x,
int  y 
)
static

Definition at line 3784 of file imagelist.c.

3786{
3787 return