ReactOS  0.4.14-dev-606-g14ebc0b
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 
3259 failed:
3260  heap_free(data);
3261 
3262  return result;
3263 }
#define TRUE
Definition: types.h:120
DWORD biClrImportant
Definition: amvideo.idl:40
HDC WINAPI GetDC(_In_opt_ HWND)
LONG biXPelsPerMeter
Definition: amvideo.idl:37
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
LONG biYPelsPerMeter
Definition: amvideo.idl:38
int32_t INT
Definition: typedefs.h:56
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
static int get_dib_stride(int width, int bpp)
Definition: imagelist.c:198
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
struct BITMAPINFOHEADER * LPBITMAPINFOHEADER
DWORD biSizeImage
Definition: amvideo.idl:36
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
struct tagBITMAPFILEHEADER BITMAPFILEHEADER
Definition: bl.h:1331
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)
#define DIB_RGB_COLORS
Definition: wingdi.h:366
GLuint64EXT * result
Definition: glext.h:11304
#define BI_RGB
Definition: precomp.h:34
static HBITMAP hBitmap
Definition: timezone.c:35
struct tagBITMAPFILEHEADER * LPBITMAPFILEHEADER
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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  }
276  StretchDIBits( himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy,
278  if (mask_info)
279  StretchDIBits( himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy,
280  n * width, 0, width, height, mask_bits, mask_info, DIB_RGB_COLORS, SRCCOPY );
281  }
282 }
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)
GLint GLint GLsizei width
Definition: gl.h:1546
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
GLdouble n
Definition: glext.h:7729
char * has_alpha
Definition: imagelist.c:111
HIMAGELIST himl
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
unsigned int BOOL
Definition: ntddk_ex.h:94
HBITMAP hbmMask
Definition: imagelist.c:98
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
GLsizei stride
Definition: glext.h:5848
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
HDC hdcMask
Definition: imagelist.c:100
HDC hdcImage
Definition: imagelist.c:99
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define SRCCOPY
Definition: wingdi.h:332

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 
334 done:
335  heap_free( info );
336  heap_free( mask_info );
337  heap_free( bits );
338  heap_free( mask_bits );
339  return ret;
340 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1475
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
GLuint GLuint GLsizei count
Definition: gl.h:1545
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
char * has_alpha
Definition: imagelist.c:111
HIMAGELIST himl
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
struct _test_info info[]
Definition: SetCursorPos.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
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
DWORD biSizeImage
Definition: amvideo.idl:36
int ret
HDC hdc
Definition: main.c:9
unsigned char BYTE
Definition: mem.h:68
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
Definition: bl.h:1331
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
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)
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define BI_RGB
Definition: precomp.h:34
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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;
1297  BITMAPINFO *info;
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());
1389  SelectObject(hdc, bmp);
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());
1395  SelectObject(hdc, bmp);
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 
1411 done:
1412  DeleteDC( hdc );
1413  if (bmp) DeleteObject( bmp );
1414  if (mask) DeleteObject( mask );
1415  heap_free( info );
1416  return ret;
1417 }
GLenum func
Definition: glext.h:6028
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)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
#define GetRValue(rgb)
Definition: wingdi.h:2934
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
char * has_alpha
Definition: imagelist.c:111
HIMAGELIST himl
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define ILD_BLEND25
Definition: commctrl.h:418
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
struct _test_info info[]
Definition: SetCursorPos.c:19
#define GetGValue(rgb)
Definition: wingdi.h:2935
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
GLenum GLint GLuint mask
Definition: glext.h:6028
unsigned int BOOL
Definition: ntddk_ex.h:94
static PVOID ptr
Definition: dispmode.c:27
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hbmMask
Definition: imagelist.c:98
#define CLR_NONE
Definition: commctrl.h:315
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
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
BITMAP bmp
Definition: alphablend.c:62
int ret
static UINT width_bytes(UINT width, UINT bpp)
Definition: tiffformat.c:847
HDC hdc
Definition: main.c:9
unsigned char BYTE
Definition: mem.h:68
#define ILD_BLEND50
Definition: commctrl.h:419
static HBITMAP
Definition: imagelist.c:69
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
_Out_opt_ int * cx
Definition: commctrl.h:581
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
HDC hdcImage
Definition: imagelist.c:99
#define GetBValue(rgb)
Definition: wingdi.h:2936
#define DIB_RGB_COLORS
Definition: wingdi.h:366
Arabic default style
Definition: afstyles.h:93
#define BI_RGB
Definition: precomp.h:34
#define SRCCOPY
Definition: wingdi.h:332
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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
static int get_dib_stride(int width, int bpp)
Definition: imagelist.c:198

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 }
GLint GLint GLsizei width
Definition: gl.h:1546
DWORD bpp
Definition: surface.c:181

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: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
HIMAGELIST himl
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4

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 &&
487  !himl->color_table_set && himl->cCurImage == 0)
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 
516 done:
518 
519  nFirstIndex = himl->cCurImage;
520  himl->cCurImage += nImageCount;
521 
522  return nFirstIndex;
523 }
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:186
HDC hdcBitmap
Definition: solcreate.cpp:11
#define pt(x, y)
Definition: drawing.c:79
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
INT cMaxImage
Definition: imagelist.c:87
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HIMAGELIST himl
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
UINT uBitsPixel
Definition: imagelist.c:110
int32_t INT
Definition: typedefs.h:56
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
HBITMAP hbmMask
Definition: imagelist.c:98
UINT WINAPI GetDIBColorTable(HDC hDC, UINT iStartIndex, UINT cEntries, RGBQUAD *pColors)
Definition: palette.c:123
INT cCurImage
Definition: imagelist.c:86
#define TRACE(s)
Definition: solgame.cpp:4
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
BOOL color_table_set
Definition: imagelist.c:112
UINT WINAPI ImageList_SetColorTable(HIMAGELIST himl, UINT uStartIndex, UINT cEntries, const RGBQUAD *prgb)
Definition: imagelist.c:3403
GLuint GLuint num
Definition: glext.h:9618
BITMAP bmp
Definition: alphablend.c:62
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BOOL WINAPI DeleteDC(_In_ HDC)
Definition: bl.h:1331
HDC hdcMask
Definition: imagelist.c:100
static void IMAGELIST_InternalExpandBitmaps(HIMAGELIST himl, INT nImageCount)
Definition: imagelist.c:361
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
HDC hdcImage
Definition: imagelist.c:99
INT cGrow
Definition: imagelist.c:88
#define SRCCOPY
Definition: wingdi.h:332

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(), TREEVIEW_CreateDragImage(), and ViewDlg_CreateTreeImageList().

◆ ImageList_AddIcon()

◆ 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 }
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:448
HDC hdcBitmap
Definition: solcreate.cpp:11
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
HIMAGELIST himl
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
int32_t INT
Definition: typedefs.h:56
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
DWORD COLORREF
Definition: windef.h:300
#define RGB(r, g, b)
Definition: wingdi.h:2939
BITMAP bmp
Definition: alphablend.c:62
int ret
static HBITMAP
Definition: imagelist.c:69
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BOOL WINAPI DeleteDC(_In_ HDC)
Definition: bl.h:1331
#define CLR_DEFAULT
Definition: commctrl.h:316
static HBITMAP hBitmap
Definition: timezone.c:35
#define SRCCOPY
Definition: wingdi.h:332
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

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 TRUE
Definition: types.h:120
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:186
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
#define WARN(fmt,...)
Definition: debug.h:111
static INTERNALDRAG InternalDrag
Definition: imagelist.c:157
UINT flags
Definition: imagelist.c:92
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
int32_t INT
Definition: typedefs.h:56
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
INT cCurImage
Definition: imagelist.c:86
#define TRACE(s)
Definition: solgame.cpp:4
HIMAGELIST himl
Definition: imagelist.c:143
GLenum src
Definition: glext.h:6340
HDC hdcMask
Definition: imagelist.c:100
GLenum GLenum dst
Definition: glext.h:6340
_Out_opt_ int * cx
Definition: commctrl.h:581
HDC hdcImage
Definition: imagelist.c:99
HIMAGELIST himlNoCursor
Definition: imagelist.c:144
#define SRCCOPY
Definition: wingdi.h:332

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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT ImageListImpl_CreateInstance(const IUnknown *pUnkOuter, REFIID iid, void **ppv)
Definition: imagelist.c:4044
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96

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 }
#define ILCF_SWAP
Definition: commctrl.h:507
#define TRUE
Definition: types.h:120
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:186
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
UINT uFlags
Definition: api.c:59
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
UINT uBitsPixel
Definition: imagelist.c:110
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)
smooth NULL
Definition: ftsmooth.c:416
INT cCurImage
Definition: imagelist.c:86
#define TRACE(s)
Definition: solgame.cpp:4
static HBITMAP
Definition: imagelist.c:69
BOOL WINAPI DeleteDC(_In_ HDC)
HDC hdcMask
Definition: imagelist.c:100
HDC hdcImage
Definition: imagelist.c:99
#define SRCCOPY
Definition: wingdi.h:332
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

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  {
224  imagelist_point_from_index( himl, src+i, &ptSrc );
225  imagelist_point_from_index( himl, dest+i, &ptDest );
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 }
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:186
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
GLuint GLuint GLsizei count
Definition: gl.h:1545
static HDC hdcSrc
Definition: xlate.c:32
static UINT imagelist_height(UINT count)
Definition: imagelist.c:181
HIMAGELIST himl
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
#define TILE_COUNT
Definition: imagelist.c:179
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
LONG cx
Definition: windef.h:334
GLenum src
Definition: glext.h:6340
unsigned int UINT
Definition: ndis.h:50
static char * dest
Definition: rtl.c:135
LONG cy
Definition: windef.h:335
#define SRCCOPY
Definition: wingdi.h:332

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;
842  himl->clrBk = CLR_NONE;
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;
863  himl->flags |= 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
894  himl->has_alpha = NULL;
895 
896  /* create blending brushes */
897  hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend25);
898  himl->hbrBlend25 = CreatePatternBrush (hbmTemp);
899  DeleteObject (hbmTemp);
900 
901  hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend50);
902  himl->hbrBlend50 = CreatePatternBrush (hbmTemp);
903  DeleteObject (hbmTemp);
904 
905  TRACE("created imagelist %p\n", himl);
906  return himl;
907 
908 cleanup:
910  return NULL;
911 }
#define BITSPIXEL
Definition: wingdi.h:719
#define max(a, b)
Definition: svc.c:63
INT cMaxImage
Definition: imagelist.c:87
INT nOvlIdx[MAX_OVERLAYIMAGE]
Definition: imagelist.c:101
#define WARN(fmt,...)
Definition: debug.h:111
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
char * has_alpha
Definition: imagelist.c:111
UINT flags
Definition: imagelist.c:92
HIMAGELIST himl
UINT uBitsPixel
Definition: imagelist.c:110
int32_t INT
Definition: typedefs.h:56
#define ILC_COLOR4
Definition: commctrl.h:350
HBITMAP hbmImage
Definition: imagelist.c:97
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define ILC_COLOR32
Definition: commctrl.h:354
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
HBRUSH hbrBlend50
Definition: imagelist.c:108
#define ILC_COLOR
Definition: commctrl.h:348
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
INT cInitial
Definition: imagelist.c:109
HBITMAP hbmMask
Definition: imagelist.c:98
#define CLR_NONE
Definition: commctrl.h:315
HBRUSH WINAPI CreatePatternBrush(_In_ HBITMAP)
#define TRACE(s)
Definition: solgame.cpp:4
COLORREF clrFg
Definition: imagelist.c:93
BOOL color_table_set
Definition: imagelist.c:112
COLORREF clrBk
Definition: imagelist.c:94
unsigned short WORD
Definition: ntddk_ex.h:93
GLbitfield flags
Definition: glext.h:7161
static UINT
Definition: imagelist.c:67
static HRESULT ImageListImpl_CreateInstance(const IUnknown *pUnkOuter, REFIID iid, void **ppv)
Definition: imagelist.c:4044
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define ILC_MASK
Definition: commctrl.h:347
HBRUSH hbrBlend25
Definition: imagelist.c:107
static HBITMAP
Definition: imagelist.c:69
#define ERR(fmt,...)
Definition: debug.h:109
#define MAX_OVERLAYIMAGE
Definition: imagelist.c:52
#define ILC_COLORDDB
Definition: commctrl.h:349
HDC hdcMask
Definition: imagelist.c:100
unsigned int UINT
Definition: ndis.h:50
#define CLR_DEFAULT
Definition: commctrl.h:316
_Out_opt_ int * cx
Definition: commctrl.h:581
HDC hdcImage
Definition: imagelist.c:99
char * cleanup(char *str)
Definition: wpickclick.c:99
INT cGrow
Definition: imagelist.c:88
LONG cy
Definition: windef.h:335
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by AddContentTab(), ApplicationPageWndProc(), cert_mgr_advanced_dlg_proc(), cert_mgr_dlg_proc(), cert_properties_general_dlg_proc(), Control_CreateListView(), CreateDragImage(), CShellLink::CreateShortcutIcon(), CreateStateImageList(), 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(), InitImageList(), CMainToolbar::InitImageList(), InitInstance(), InitListViewImage(), InitListViewImageLists(), InitTreeViewImageLists(), InitUserGroupsList(), ShellBrowser::invalidate_cache(), LISTVIEW_CreateCheckBoxIL(), LISTVIEW_CreateDragImage(), LV_Init(), MainFrameBase::MainFrameBase(), 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(), CMainWindow::UpdateApplicationsList(), UpgradeRepairDlgProc(), and ViewDlg_CreateTreeImageList().

◆ 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 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1475
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
GLuint GLuint GLsizei count
Definition: gl.h:1545
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLuint buffer
Definition: glext.h:5915
UINT flags
Definition: imagelist.c:92
HIMAGELIST himl
UINT uBitsPixel
Definition: imagelist.c:110
#define ILC_COLOR4
Definition: commctrl.h:350
#define ILC_COLOR32
Definition: commctrl.h:354
static void imagelist_get_bitmap_size(HIMAGELIST himl, UINT count, SIZE *sz)
Definition: imagelist.c:192
#define ILC_COLOR
Definition: commctrl.h:348
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
UINT WINAPI GetDIBColorTable(HDC hDC, UINT iStartIndex, UINT cEntries, RGBQUAD *pColors)
Definition: palette.c:123
#define TRACE(s)
Definition: solgame.cpp:4
RGBQUAD bmiColors[1]
Definition: wingdi.h:1476
BOOL color_table_set
Definition: imagelist.c:112
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: imagelist.c:69
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
unsigned int UINT
Definition: ndis.h:50
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)
HDC hdcImage
Definition: imagelist.c:99
#define ILC_COLOR8
Definition: commctrl.h:351
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define memset(x, y, z)
Definition: compat.h:39
LONG cy
Definition: windef.h:335
#define BI_RGB
Definition: precomp.h:34
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

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 }
#define TRUE
Definition: types.h:120
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
HIMAGELIST himl

Referenced by cert_mgr_advanced_dlg_proc(), cert_mgr_dlg_proc(), cert_properties_general_callback(), CToolsBand::CloseDW(), CAddressBand::CloseDW(), CMainToolbar::Create(), CShellLink::CreateShortcutIcon(), CreateStateImageList(), DependenciesPageProc(), CSideTreeView::DestroyImageList(), DestroySecurityPage(), DestroyTreeView(), DriveDlgProc(), ExitInstance(), FileOpenDlgProc95(), FloatToolbarCreateHistoryGui(), FloatToolbarCreateToolsGui(), 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(), MainWndCreateToolbarClient(), 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(), CMainWindow::UpdateApplicationsList(), UpgradeRepairDlgProc(), 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 
962  if (!is_valid(InternalDrag.himl))
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 }
#define TRUE
Definition: types.h:120
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
static INTERNALDRAG InternalDrag
Definition: imagelist.c:157
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
BOOL WINAPI ImageList_DragShowNolock(BOOL bShow)
Definition: imagelist.c:1153
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define TRACE(s)
Definition: solgame.cpp:4
HIMAGELIST himl
Definition: imagelist.c:143
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

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 TRUE
Definition: types.h:120
static INTERNALDRAG InternalDrag
Definition: imagelist.c:157
BOOL WINAPI ImageList_DragShowNolock(BOOL bShow)
Definition: imagelist.c:1153
#define FIXME(fmt,...)
Definition: debug.h:110
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652

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 
1074  if (!is_valid(InternalDrag.himl))
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 }
#define abs(i)
Definition: fconv.c:206
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
#define TRUE
Definition: types.h:120
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
HBITMAP hbmBg
Definition: imagelist.c:154
static INTERNALDRAG InternalDrag
Definition: imagelist.c:157
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
int32_t INT
Definition: typedefs.h:56
#define DCX_WINDOW
Definition: winuser.h:2095
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define DCX_LOCKWINDOWUPDATE
Definition: winuser.h:2102
#define TRACE(s)
Definition: solgame.cpp:4
HIMAGELIST himl
Definition: imagelist.c:143
static HBITMAP
Definition: imagelist.c:69
#define DCX_CACHE
Definition: winuser.h:2096
BOOL WINAPI DeleteDC(_In_ HDC)
static void ImageList_InternalDragDraw(HDC hdc, INT x, INT y)
Definition: imagelist.c:1032
#define min(a, b)
Definition: monoChain.cc:55
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define SRCCOPY
Definition: wingdi.h:332

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 
1159  if (!is_valid(InternalDrag.himl))
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 */
1194  BitBlt(hdcDrag, x, y, InternalDrag.himl->cx, InternalDrag.himl->cy,
1195  hdcBg, 0, 0, SRCCOPY);
1196  }
1197 
1199 
1200  DeleteDC(hdcBg);
1201  ReleaseDC (InternalDrag.hwnd, hdcDrag);
1202  return TRUE;
1203 }
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
#define TRUE
Definition: types.h:120
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
HBITMAP hbmBg
Definition: imagelist.c:154
static INTERNALDRAG InternalDrag
Definition: imagelist.c:157
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
int32_t INT
Definition: typedefs.h:56
#define DCX_WINDOW
Definition: winuser.h:2095
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define DCX_LOCKWINDOWUPDATE
Definition: winuser.h:2102
#define TRACE(s)
Definition: solgame.cpp:4
HIMAGELIST himl
Definition: imagelist.c:143
#define DCX_CACHE
Definition: winuser.h:2096
BOOL WINAPI DeleteDC(_In_ HDC)
static void ImageList_InternalDragDraw(HDC hdc, INT x, INT y)
Definition: imagelist.c:1032
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define SRCCOPY
Definition: wingdi.h:332

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 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HIMAGELIST himl
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
HDC hdc
Definition: main.c:9
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define CLR_DEFAULT
Definition: commctrl.h:316
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(), COMBOEX_DrawItem(), 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 }
GLint dy
Definition: linetemp.h:97
#define ZeroMemory
Definition: winbase.h:1642
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HIMAGELIST himl
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
BOOL WINAPI ImageList_DrawIndirect(IMAGELISTDRAWPARAMS *pimldp)
Definition: imagelist.c:1525
HDC hdc
Definition: main.c:9
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97

Referenced by Icon::add_to_imagelist(), Icon::create_bitmap(), Icon::draw(), Pane::draw_item(), 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;
1534  HIMAGELIST himl;
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;
1767 end:
1768  /* cleanup the mess */
1769  SetBkColor(hImageDC, oldImageBk);
1770  SetTextColor(hImageDC, oldImageFg);
1771  SelectObject(hImageDC, hOldImageBmp);
1772 cleanup:
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 }
#define SRCPAINT
Definition: wingdi.h:333
HGDIOBJ WINAPI GetStockObject(_In_ int)
GLenum func
Definition: glext.h:6028
#define ILS_ALPHA
Definition: commctrl.h:435
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:954
#define TRUE
Definition: types.h:120
#define ILS_SHADOW
Definition: commctrl.h:433
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:186
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define pt(x, y)
Definition: drawing.c:79
#define ILS_SATURATE
Definition: commctrl.h:434
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
INT nOvlIdx[MAX_OVERLAYIMAGE]
Definition: imagelist.c:101
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define ILS_GLOW
Definition: commctrl.h:432
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
char * has_alpha
Definition: imagelist.c:111
GLuint GLuint end
Definition: gl.h:1545
#define AC_SRC_ALPHA
Definition: alphablend.c:9
UINT flags
Definition: imagelist.c:92
HIMAGELIST himl
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
int32_t INT
Definition: typedefs.h:56
DWORD WINAPI GetSysColor(_In_ int)
#define ILD_BLEND25
Definition: commctrl.h:418
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
unsigned int BOOL
Definition: ntddk_ex.h:94
HBRUSH hbrBlend50
Definition: imagelist.c:108
#define FIXME(fmt,...)
Definition: debug.h:110
#define ILD_DPISCALE
Definition: commctrl.h:424
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:831
smooth NULL
Definition: ftsmooth.c:416
#define NOTSRCCOPY
Definition: wingdi.h:324
HBITMAP hbmMask
Definition: imagelist.c:98
#define CLR_NONE
Definition: commctrl.h:315
INT cCurImage
Definition: imagelist.c:86
#define BLACK_BRUSH
Definition: wingdi.h:895
#define TRACE(s)
Definition: solgame.cpp:4
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define ILD_PRESERVEALPHA
Definition: commctrl.h:422
DWORD COLORREF
Definition: windef.h:300
#define ILD_SCALE
Definition: commctrl.h:423
#define RGB(r, g, b)
Definition: wingdi.h:2939
COLORREF clrBk
Definition: imagelist.c:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ILD_ROP
Definition: commctrl.h:417
#define ILD_IMAGE
Definition: commctrl.h:416
#define AC_SRC_OVER
Definition: wingdi.h:1368
#define ILD_OVERLAYMASK
Definition: commctrl.h:420
#define ILC_MASK
Definition: commctrl.h:347
HBRUSH hbrBlend25
Definition: imagelist.c:107
#define ILD_BLEND50
Definition: commctrl.h:419
static HBITMAP
Definition: imagelist.c:69
#define PATCOPY
Definition: wingdi.h:334
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define ILD_TRANSPARENT
Definition: commctrl.h:414
#define MAX_OVERLAYIMAGE
Definition: imagelist.c:52
BOOL WINAPI DeleteDC(_In_ HDC)
HDC hdcMask
Definition: imagelist.c:100
#define SRCAND
Definition: wingdi.h:329
unsigned int UINT
Definition: ndis.h:50
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
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
#define CLR_DEFAULT
Definition: commctrl.h:316
_Out_opt_ int * cx
Definition: commctrl.h:581
HDC hdcImage
Definition: imagelist.c:99
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ILS_NORMAL
Definition: commctrl.h:431
struct _IMAGELISTDRAWPARAMS IMAGELISTDRAWPARAMS
#define ILD_MASK
Definition: commctrl.h:415
#define SRCCOPY
Definition: wingdi.h:332
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

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 }
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
char * has_alpha
Definition: imagelist.c:111
UINT flags
Definition: imagelist.c:92
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
static void imagelist_get_bitmap_size(HIMAGELIST himl, UINT count, SIZE *sz)
Definition: imagelist.c:192
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
HBITMAP hbmMask
Definition: imagelist.c:98
INT cCurImage
Definition: imagelist.c:86
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:109
HDC hdcMask
Definition: imagelist.c:100
HDC hdcImage
Definition: imagelist.c:99
INT cGrow
Definition: imagelist.c:88
LONG cy
Definition: windef.h:335
#define SRCCOPY
Definition: wingdi.h:332

Referenced by ImageListImpl_Clone(), and SHGetImageList().

◆ ImageList_EndDrag()

VOID WINAPI ImageList_EndDrag ( void  )

Definition at line 1847 of file imagelist.c.

1848 {
1849  /* cleanup the InternalDrag struct */
1850  InternalDrag.hwnd = 0;
1855  InternalDrag.x= 0;
1856  InternalDrag.y= 0;
1857  InternalDrag.dxHotspot = 0;
1858  InternalDrag.dyHotspot = 0;
1861  InternalDrag.hbmBg = 0;
1862 }
HBITMAP hbmBg
Definition: imagelist.c:154
static INTERNALDRAG InternalDrag
Definition: imagelist.c:157
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
HIMAGELIST himl
Definition: imagelist.c:143
HIMAGELIST himlNoCursor
Definition: imagelist.c:144

Referenced by CDefView::Drop(), GROUP_GroupWndProc(), HEADER_LButtonUp(), ImageListImpl_EndDrag(), and init_functions().

◆ imagelist_get_bitmap_size()

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

Definition at line 192 of file imagelist.c.

193 {
194  sz->cx = himl->cx * TILE_COUNT;
195  sz->cy = imagelist_height( count ) * himl->cy;
196 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
static UINT imagelist_height(UINT count)
Definition: imagelist.c:181
HIMAGELIST himl
#define TILE_COUNT
Definition: imagelist.c:179
LONG cx
Definition: windef.h:334
LONG cy
Definition: windef.h:335

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

◆ 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 }
HIMAGELIST himl
#define CLR_NONE
Definition: commctrl.h:315
COLORREF clrBk
Definition: imagelist.c:94

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 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
static INTERNALDRAG InternalDrag
Definition: imagelist.c:157
smooth NULL
Definition: ftsmooth.c:416
HIMAGELIST himl
Definition: imagelist.c:143
_Out_opt_ POINT * pptHotspot
Definition: commctrl.h:550

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 }
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
UINT flags
Definition: imagelist.c:92
HIMAGELIST himl
#define TRACE(s)
Definition: solgame.cpp:4

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);
2011  DeleteObject (ii.hbmColor);
2012  DeleteDC (hdcDst);
2013 
2014  return hIcon;
2015 }
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:186
HDC WINAPI GetDC(_In_opt_ HWND)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define pt(x, y)
Definition: drawing.c:79
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
DWORD yHotspot
Definition: winuser.h:3100
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HIMAGELIST himl
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
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
HBITMAP hbmMask
Definition: winuser.h:3101
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hbmColor
Definition: winuser.h:3102
HBITMAP hbmMask
Definition: imagelist.c:98
INT cCurImage
Definition: imagelist.c:86
BOOL fIcon
Definition: winuser.h:3098
#define TRACE(s)
Definition: solgame.cpp:4
DWORD xHotspot
Definition: winuser.h:3099
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2546
static HBITMAP
Definition: imagelist.c:69
static HDC hdcDst
Definition: xlate.c:32
#define BLACKNESS
Definition: wingdi.h:322
BOOL WINAPI DeleteDC(_In_ HDC)
HICON hIcon
Definition: msconfig.c:44
HDC hdcMask
Definition: imagelist.c:100
HDC hdcImage
Definition: imagelist.c:99
#define SRCCOPY
Definition: wingdi.h:332
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

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

◆ ImageList_GetIconSize()

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

◆ 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;
2102  pImageInfo->rcImage.bottom = pt.y + himl->cy;
2103  pImageInfo->rcImage.left = pt.x;
2104  pImageInfo->rcImage.right = pt.x + himl->cx;
2105 
2106  return TRUE;
2107 }
HBITMAP hbmImage
#define TRUE
Definition: types.h:120
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:186
#define pt(x, y)
Definition: drawing.c:79
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
HIMAGELIST himl
HBITMAP hbmImage
Definition: imagelist.c:97
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
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hbmMask
Definition: imagelist.c:98
INT cCurImage
Definition: imagelist.c:86
_In_ int _Out_ IMAGEINFO * pImageInfo
Definition: commctrl.h:599
HBITMAP hbmMask
LONG bottom
Definition: windef.h:309

Referenced by COMBOEX_AdjustEditPos(), COMBOEX_DrawItem(), COMBOEX_ReSize(), 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 }
#define TRUE
Definition: types.h:120
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:186
#define pt(x, y)
Definition: drawing.c:79
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3998
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
HIMAGELIST himl
BOOL WINAPI ImageList_GetImageInfo(HIMAGELIST himl, INT i, IMAGEINFO *pImageInfo)
Definition: imagelist.c:2088
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
smooth NULL
Definition: ftsmooth.c:416
INT cCurImage
Definition: imagelist.c:86
LONG bottom
Definition: windef.h:309

◆ 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 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define TILE_COUNT
Definition: imagelist.c:179

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 ILS_ALPHA
Definition: commctrl.h:435
static INTERNALDRAG InternalDrag
Definition: imagelist.c:157
#define ZeroMemory
Definition: winbase.h:1642
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
BOOL WINAPI ImageList_DrawIndirect(IMAGELISTDRAWPARAMS *pimldp)
Definition: imagelist.c:1525
HIMAGELIST himl
Definition: imagelist.c:143
HDC hdc
Definition: main.c:9
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define CLR_DEFAULT
Definition: commctrl.h:316
#define ILD_NORMAL
Definition: commctrl.h:413

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 {
363  HDC hdcBitmap;
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  {
422  himl->has_alpha = NULL;
423  }
424  }
425 
426  himl->cMaxImage = nNewCount;
427 
429 }
#define max(a, b)
Definition: svc.c:63
HDC hdcBitmap
Definition: solcreate.cpp:11
INT cMaxImage
Definition: imagelist.c:87
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
char * has_alpha
Definition: imagelist.c:111
UINT flags
Definition: imagelist.c:92
HIMAGELIST himl
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
int32_t INT
Definition: typedefs.h:56
HBITMAP hbmImage
Definition: imagelist.c:97
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
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
HBITMAP hbmMask
Definition: imagelist.c:98
INT cCurImage
Definition: imagelist.c:86
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define ILC_MASK
Definition: commctrl.h:347
static HBITMAP
Definition: imagelist.c:69
#define ERR(fmt,...)
Definition: debug.h:109
BOOL WINAPI DeleteDC(_In_ HDC)
#define HeapReAlloc
Definition: compat.h:401
HDC hdcMask
Definition: imagelist.c:100
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HDC hdcImage
Definition: imagelist.c:99
INT cGrow
Definition: imagelist.c:88
LONG cy
Definition: windef.h:335
#define SRCCOPY
Definition: wingdi.h:332
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

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 {
2167  HIMAGELIST himl;
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 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CP_ACP
Definition: compat.h:99
UINT uFlags
Definition: api.c:59
HIMAGELIST himl
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
smooth NULL
Definition: ftsmooth.c:416
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
HIMAGELIST WINAPI ImageList_LoadImageW(HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow, COLORREF clrMask, UINT uType, UINT uFlags)
Definition: imagelist.c:2208
_Out_opt_ int * cx
Definition: commctrl.h:581
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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 {
2211  HIMAGELIST himl = NULL;
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) {
2222  DIBSECTION dib;
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) {
2245  DeleteObject (handle);
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) {
2259  DeleteObject (ii.hbmColor);
2260  DeleteObject (ii.hbmMask);
2261  DeleteObject (handle);
2262  return NULL;
2263  }
2264  ImageList_Add (himl, ii.hbmColor, ii.hbmMask);
2265  DeleteObject (ii.hbmColor);
2266  DeleteObject (ii.hbmMask);
2267  }
2268 
2269  DeleteObject (handle);
2270 
2271  return himl;
2272 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define IMAGE_ICON
Definition: winuser.h:212
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:448
#define IMAGE_CURSOR
Definition: winuser.h:213
#define WARN(fmt,...)
Definition: debug.h:111
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT uFlags
Definition: api.c:59
HIMAGELIST himl
int32_t INT
Definition: typedefs.h:56
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2014
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
GLuint color
Definition: glext.h:6243
HBITMAP hbmMask
Definition: winuser.h:3101
#define ILC_COLOR
Definition: commctrl.h:348
#define SM_CXICON
Definition: winuser.h:962
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hbmColor
Definition: winuser.h:3102
#define DI_DEFAULTSIZE
Definition: wingdi.h:69
#define CLR_NONE
Definition: commctrl.h:315
int WINAPI GetSystemMetrics(_In_ int)
BITMAP bmp
Definition: alphablend.c:62
#define ILC_MASK
Definition: commctrl.h:347
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
Definition: bl.h:1331
unsigned int UINT
Definition: ndis.h:50
#define IMAGE_BITMAP
Definition: winuser.h:211
static const BYTE dib[]
Definition: ole2.c:201
_Out_opt_ int * cx
Definition: commctrl.h:581
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563

Referenced by CFn_WMInitDialog(), CFn_WMMeasureItem(), create_rebar(), CAddressBand::CreateGoButton(), ImageList_LoadImageA(), init_functions(), CStartButton::Initialize(), CToolsBand::SetSite(), show_frame(), 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);