ReactOS  0.4.13-dev-257-gfabbd7c
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 85 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 144 of file imagelist.c.

Typedef Documentation

◆ ILHEAD

Function Documentation

◆ _write_bitmap()

static BOOL _write_bitmap ( HBITMAP  hBitmap,
IStream pstm 
)
static

Definition at line 3095 of file imagelist.c.

3096 {
3097  LPBITMAPFILEHEADER bmfh;
3098  LPBITMAPINFOHEADER bmih;
3099  LPBYTE data = NULL, lpBits;
3100  BITMAP bm;
3101  INT bitCount, sizeImage, offBits, totalSize;
3102  HDC xdc;
3103  BOOL result = FALSE;
3104 
3105  if (!GetObjectW(hBitmap, sizeof(BITMAP), &bm))
3106  return FALSE;
3107 
3108  bitCount = bm.bmBitsPixel;
3109  sizeImage = get_dib_stride(bm.bmWidth, bitCount) * bm.bmHeight;
3110 
3111  totalSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
3112  if(bitCount <= 8)
3113  totalSize += (1 << bitCount) * sizeof(RGBQUAD);
3114  offBits = totalSize;
3115  totalSize += sizeImage;
3116 
3117  data = heap_alloc_zero(totalSize);
3118  bmfh = (LPBITMAPFILEHEADER)data;
3119  bmih = (LPBITMAPINFOHEADER)(data + sizeof(BITMAPFILEHEADER));
3120  lpBits = data + offBits;
3121 
3122  /* setup BITMAPFILEHEADER */
3123  bmfh->bfType = (('M' << 8) | 'B');
3124  bmfh->bfSize = offBits;
3125  bmfh->bfReserved1 = 0;
3126  bmfh->bfReserved2 = 0;
3127  bmfh->bfOffBits = offBits;
3128 
3129  /* setup BITMAPINFOHEADER */
3130  bmih->biSize = sizeof(BITMAPINFOHEADER);
3131  bmih->biWidth = bm.bmWidth;
3132  bmih->biHeight = bm.bmHeight;
3133  bmih->biPlanes = 1;
3134  bmih->biBitCount = bitCount;
3135  bmih->biCompression = BI_RGB;
3136  bmih->biSizeImage = sizeImage;
3137  bmih->biXPelsPerMeter = 0;
3138  bmih->biYPelsPerMeter = 0;
3139  bmih->biClrUsed = 0;
3140  bmih->biClrImportant = 0;
3141 
3142  xdc = GetDC(0);
3143  result = GetDIBits(xdc, hBitmap, 0, bm.bmHeight, lpBits, (BITMAPINFO *)bmih, DIB_RGB_COLORS) == bm.bmHeight;
3144  ReleaseDC(0, xdc);
3145  if (!result)
3146  goto failed;
3147 
3148  TRACE("width %u, height %u, planes %u, bpp %u\n",
3149  bmih->biWidth, bmih->biHeight,
3150  bmih->biPlanes, bmih->biBitCount);
3151 
3152  if(FAILED(IStream_Write(pstm, data, totalSize, NULL)))
3153  goto failed;
3154 
3155  result = TRUE;
3156 
3157 failed:
3158  heap_free(data);
3159 
3160  return result;
3161 }
#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:163
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:35
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 199 of file imagelist.c.

201 {
202  int i, j, n;
203  POINT pt;
204  int stride = info->bmiHeader.biWidth;
205  int mask_stride = (info->bmiHeader.biWidth + 31) / 32 * 4;
206 
207  for (n = 0; n < count; n++)
208  {
209  BOOL has_alpha = FALSE;
210 
212 
213  /* check if bitmap has an alpha channel */
214  for (i = 0; i < height && !has_alpha; i++)
215  for (j = n * width; j < (n + 1) * width; j++)
216  if ((has_alpha = ((bits[i * stride + j] & 0xff000000) != 0))) break;
217 
218  if (!has_alpha) /* generate alpha channel from the mask */
219  {
220  for (i = 0; i < height; i++)
221  for (j = n * width; j < (n + 1) * width; j++)
222  if (!mask_info || !((mask_bits[i * mask_stride + j / 8] << (j % 8)) & 0x80))
223  bits[i * stride + j] |= 0xff000000;
224  else
225  bits[i * stride + j] = 0;
226  }
227  else
228  {
229  himl->has_alpha[pos + n] = 1;
230 
231  if (mask_info && himl->hbmMask) /* generate the mask from the alpha channel */
232  {
233  for (i = 0; i < height; i++)
234  for (j = n * width; j < (n + 1) * width; j++)
235  if ((bits[i * stride + j] >> 24) > 25) /* more than 10% alpha */
236  mask_bits[i * mask_stride + j / 8] &= ~(0x80 >> (j % 8));
237  else
238  mask_bits[i * mask_stride + j / 8] |= 0x80 >> (j % 8);
239  }
240  }
241  StretchDIBits( himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy,
243  if (mask_info)
244  StretchDIBits( himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy,
245  n * width, 0, width, height, mask_bits, mask_info, DIB_RGB_COLORS, SRCCOPY );
246  }
247 }
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:151
#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:79
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:69
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:71
HDC hdcImage
Definition: imagelist.c:70
#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 250 of file imagelist.c.

252 {
253  BOOL ret = FALSE;
254  BITMAP bm;
255  BITMAPINFO *info, *mask_info = NULL;
256  DWORD *bits = NULL;
257  BYTE *mask_bits = NULL;
258  DWORD mask_width;
259 
260  if (!GetObjectW( hbmImage, sizeof(bm), &bm )) return FALSE;
261 
262  /* if either the imagelist or the source bitmap don't have an alpha channel, bail out now */
263  if (!himl->has_alpha) return FALSE;
264  if (bm.bmBitsPixel != 32) return FALSE;
265 
266  SelectObject( hdc, hbmImage );
267  mask_width = (bm.bmWidth + 31) / 32 * 4;
268 
269  if (!(info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done;
270  info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
271  info->bmiHeader.biWidth = bm.bmWidth;
272  info->bmiHeader.biHeight = -height;
273  info->bmiHeader.biPlanes = 1;
274  info->bmiHeader.biBitCount = 32;
275  info->bmiHeader.biCompression = BI_RGB;
276  info->bmiHeader.biSizeImage = bm.bmWidth * height * 4;
277  info->bmiHeader.biXPelsPerMeter = 0;
278  info->bmiHeader.biYPelsPerMeter = 0;
279  info->bmiHeader.biClrUsed = 0;
280  info->bmiHeader.biClrImportant = 0;
281  if (!(bits = heap_alloc( info->bmiHeader.biSizeImage ))) goto done;
282  if (!GetDIBits( hdc, hbmImage, 0, height, bits, info, DIB_RGB_COLORS )) goto done;
283 
284  if (hbmMask)
285  {
286  if (!(mask_info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[2] ))))
287  goto done;
288  mask_info->bmiHeader = info->bmiHeader;
289  mask_info->bmiHeader.biBitCount = 1;
290  mask_info->bmiHeader.biSizeImage = mask_width * height;
291  if (!(mask_bits = heap_alloc_zero( mask_info->bmiHeader.biSizeImage )))
292  goto done;
293  if (!GetDIBits( hdc, hbmMask, 0, height, mask_bits, mask_info, DIB_RGB_COLORS )) goto done;
294  }
295 
296  add_dib_bits( himl, pos, count, width, height, info, mask_info, bits, mask_bits );
297  ret = TRUE;
298 
299 done:
300  heap_free( info );
301  heap_free( mask_info );
302  heap_free( bits );
303  heap_free( mask_bits );
304  return ret;
305 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1454
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:79
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:199
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:35
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 1254 of file imagelist.c.

1258 {
1259  BOOL ret = FALSE;
1260  HDC hdc;
1261  HBITMAP bmp = 0, mask = 0;
1262  BITMAPINFO *info;
1263  void *bits, *mask_bits;
1264  unsigned int *ptr;
1265  int i, j;
1266 
1267  if (!(hdc = CreateCompatibleDC( 0 ))) return FALSE;
1268  if (!(info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done;
1269  info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1270  info->bmiHeader.biWidth = cx;
1271  info->bmiHeader.biHeight = cy;
1272  info->bmiHeader.biPlanes = 1;
1273  info->bmiHeader.biBitCount = 32;
1274  info->bmiHeader.biCompression = BI_RGB;
1275  info->bmiHeader.biSizeImage = cx * cy * 4;
1276  info->bmiHeader.biXPelsPerMeter = 0;
1277  info->bmiHeader.biYPelsPerMeter = 0;
1278  info->bmiHeader.biClrUsed = 0;
1279  info->bmiHeader.biClrImportant = 0;
1280 #ifdef __REACTOS__
1281  if (!(bmp = CreateDIBSection( srce_dc, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
1282 #else
1283  if (!(bmp = CreateDIBSection( himl->hdcImage, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
1284 #endif
1285  SelectObject( hdc, bmp );
1286 #ifdef __REACTOS__
1287  BitBlt( hdc, 0, 0, cx, cy, srce_dc, src_x, src_y, SRCCOPY );
1288 #else
1289  BitBlt( hdc, 0, 0, cx, cy, himl->hdcImage, src_x, src_y, SRCCOPY );
1290 #endif
1291 
1292  if (blend_col != CLR_NONE)
1293  {
1294  BYTE r = GetRValue( blend_col );
1295  BYTE g = GetGValue( blend_col );
1296  BYTE b = GetBValue( blend_col );
1297 
1298  if (style & ILD_BLEND25)
1299  {
1300  for (i = 0, ptr = bits; i < cx * cy; i++, ptr++)
1301  *ptr = ((*ptr & 0xff000000) |
1302  ((((*ptr & 0x00ff0000) * 3 + (r << 16)) / 4) & 0x00ff0000) |
1303  ((((*ptr & 0x0000ff00) * 3 + (g << 8)) / 4) & 0x0000ff00) |
1304  ((((*ptr & 0x000000ff) * 3 + (b << 0)) / 4) & 0x000000ff));
1305  }
1306  else if (style & ILD_BLEND50)
1307  {
1308  for (i = 0, ptr = bits; i < cx * cy; i++, ptr++)
1309  *ptr = ((*ptr & 0xff000000) |
1310  ((((*ptr & 0x00ff0000) + (r << 16)) / 2) & 0x00ff0000) |
1311  ((((*ptr & 0x0000ff00) + (g << 8)) / 2) & 0x0000ff00) |
1312  ((((*ptr & 0x000000ff) + (b << 0)) / 2) & 0x000000ff));
1313  }
1314  }
1315 
1316  if (himl->has_alpha) /* we already have an alpha channel in this case */
1317  {
1318  /* pre-multiply by the alpha channel */
1319  for (i = 0, ptr = bits; i < cx * cy; i++, ptr++)
1320  {
1321  DWORD alpha = *ptr >> 24;
1322  *ptr = ((*ptr & 0xff000000) |
1323  (((*ptr & 0x00ff0000) * alpha / 255) & 0x00ff0000) |
1324  (((*ptr & 0x0000ff00) * alpha / 255) & 0x0000ff00) |
1325  (((*ptr & 0x000000ff) * alpha / 255)));
1326  }
1327  }
1328  else if (himl->hbmMask)
1329  {
1330  unsigned int width_bytes = (cx + 31) / 32 * 4;
1331  /* generate alpha channel from the mask */
1332  info->bmiHeader.biBitCount = 1;
1333  info->bmiHeader.biSizeImage = width_bytes * cy;
1334  info->bmiColors[0].rgbRed = 0;
1335  info->bmiColors[0].rgbGreen = 0;
1336  info->bmiColors[0].rgbBlue = 0;
1337  info->bmiColors[0].rgbReserved = 0;
1338  info->bmiColors[1].rgbRed = 0xff;
1339  info->bmiColors[1].rgbGreen = 0xff;
1340  info->bmiColors[1].rgbBlue = 0xff;
1341  info->bmiColors[1].rgbReserved = 0;
1342  if (!(mask = CreateDIBSection( himl->hdcMask, info, DIB_RGB_COLORS, &mask_bits, 0, 0 )))
1343  goto done;
1344  SelectObject( hdc, mask );
1345  BitBlt( hdc, 0, 0, cx, cy, himl->hdcMask, src_x, src_y, SRCCOPY );
1346  SelectObject( hdc, bmp );
1347  for (i = 0, ptr = bits; i < cy; i++)
1348  for (j = 0; j < cx; j++, ptr++)
1349  if ((((BYTE *)mask_bits)[i * width_bytes + j / 8] << (j % 8)) & 0x80) *ptr = 0;
1350  else *ptr |= 0xff000000;
1351  }
1352 
1353  ret = GdiAlphaBlend( dest_dc, dest_x, dest_y, cx, cy, hdc, 0, 0, cx, cy, func );
1354 
1355 done:
1356  DeleteDC( hdc );
1357  if (bmp) DeleteObject( bmp );
1358  if (mask) DeleteObject( mask );
1359  heap_free( info );
1360  return ret;
1361 }
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:2913
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:79
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:416
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define ILD_BLEND25
Definition: commctrl.h:407
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:2914
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:570
HBITMAP hbmMask
Definition: imagelist.c:69
#define CLR_NONE
Definition: commctrl.h:304
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
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:846
HDC hdc
Definition: main.c:9
unsigned char BYTE
Definition: mem.h:68
#define ILD_BLEND50
Definition: commctrl.h:408
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
HDC hdcMask
Definition: imagelist.c:71
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
_Out_opt_ int * cx
Definition: commctrl.h:570
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
HDC hdcImage
Definition: imagelist.c:70
#define GetBValue(rgb)
Definition: wingdi.h:2915
#define DIB_RGB_COLORS
Definition: wingdi.h:366
Arabic default style
Definition: afstyles.h:93
#define BI_RGB
Definition: precomp.h:35
#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 168 of file imagelist.c.

169 {
170  return get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount )
171  * abs( info->bmiHeader.biHeight );
172 }
#define abs(i)
Definition: fconv.c:206
static int get_dib_stride(int width, int bpp)
Definition: imagelist.c:163

Referenced by MFDRV_StretchBlt(), and read_bitmap().

◆ get_dib_stride()

static int get_dib_stride ( int  width,
int  bpp 
)
inlinestatic

Definition at line 163 of file imagelist.c.

164 {
165  return ((width * bpp + 31) >> 3) & ~3;
166 }
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 3908 of file imagelist.c.

3909 {
3910  TRACE("(%p,%s,%p)\n", himl, debugstr_guid(riid), ppv);
3911  return IImageList2_QueryInterface((IImageList2 *) himl, riid, ppv);
3912 }
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 413 of file imagelist.c.

414 {
415  HDC hdcBitmap, hdcTemp = 0;
416  INT nFirstIndex, nImageCount, i;
417  BITMAP bmp;
418  POINT pt;
419 
420  TRACE("himl=%p hbmimage=%p hbmmask=%p\n", himl, hbmImage, hbmMask);
421  if (!is_valid(himl))
422  return -1;
423 
424  if (!GetObjectW(hbmImage, sizeof(BITMAP), &bmp))
425  return -1;
426 
427  TRACE("himl %p, cCurImage %d, cMaxImage %d, cGrow %d, cx %d, cy %d\n",
429 
430  nImageCount = bmp.bmWidth / himl->cx;
431 
432  TRACE("%p has %d images (%d x %d) bpp %d\n", hbmImage, nImageCount, bmp.bmWidth, bmp.bmHeight,
433  bmp.bmBitsPixel);
434 
436 
438 
439  SelectObject(hdcBitmap, hbmImage);
440 
441  if (add_with_alpha( himl, hdcBitmap, himl->cCurImage, nImageCount,
442  himl->cx, min( himl->cy, bmp.bmHeight), hbmImage, hbmMask ))
443  goto done;
444 
445  if (himl->hbmMask)
446  {
447  hdcTemp = CreateCompatibleDC(0);
448  SelectObject(hdcTemp, hbmMask);
449  }
450 
451  if (himl->uBitsPixel <= 8 && bmp.bmBitsPixel <= 8 &&
452  !himl->color_table_set && himl->cCurImage == 0)
453  {
454  RGBQUAD colors[256];
455  UINT num = GetDIBColorTable( hdcBitmap, 0, 1 << bmp.bmBitsPixel, colors );
456  if (num) ImageList_SetColorTable( himl, 0, num, colors );
457  }
458 
459  for (i=0; i<nImageCount; i++)
460  {
462 
463  /* Copy result to the imagelist
464  */
465  BitBlt( himl->hdcImage, pt.x, pt.y, himl->cx, bmp.bmHeight,
466  hdcBitmap, i*himl->cx, 0, SRCCOPY );
467 
468  if (!himl->hbmMask)
469  continue;
470 
471  BitBlt( himl->hdcMask, pt.x, pt.y, himl->cx, bmp.bmHeight,
472  hdcTemp, i*himl->cx, 0, SRCCOPY );
473 
474  /* Remove the background from the image
475  */
476  BitBlt( himl->hdcImage, pt.x, pt.y, himl->cx, bmp.bmHeight,
477  himl->hdcMask, pt.x, pt.y, 0x220326 ); /* NOTSRCAND */
478  }
479  if (hdcTemp) DeleteDC(hdcTemp);
480 
481 done:
483 
484  nFirstIndex = himl->cCurImage;
485  himl->cCurImage += nImageCount;
486 
487  return nFirstIndex;
488 }
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:151
HDC hdcBitmap
Definition: solcreate.cpp:11
#define pt(x, y)
Definition: drawing.c:79
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
INT cMaxImage
Definition: imagelist.c:58
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:416
UINT uBitsPixel
Definition: imagelist.c:78
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:69
UINT WINAPI GetDIBColorTable(HDC hDC, UINT iStartIndex, UINT cEntries, RGBQUAD *pColors)
Definition: palette.c:123
INT cCurImage
Definition: imagelist.c:57
#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:250
BOOL color_table_set
Definition: imagelist.c:80
UINT WINAPI ImageList_SetColorTable(HIMAGELIST himl, UINT uStartIndex, UINT cEntries, const RGBQUAD *prgb)
Definition: imagelist.c:3301
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:71
static void IMAGELIST_InternalExpandBitmaps(HIMAGELIST himl, INT nImageCount)
Definition: imagelist.c:326
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
HDC hdcImage
Definition: imagelist.c:70
INT cGrow
Definition: imagelist.c:59
#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 528 of file imagelist.c.

529 {
530  HDC hdcMask, hdcBitmap;
531  INT ret;
532  BITMAP bmp;
533  HBITMAP hMaskBitmap;
534  COLORREF bkColor;
535 
536  TRACE("himl=%p hbitmap=%p clrmask=%x\n", himl, hBitmap, clrMask);
537  if (!is_valid(himl))
538  return -1;
539 
540  if (!GetObjectW(hBitmap, sizeof(BITMAP), &bmp))
541  return -1;
542 
545 
546  /* Create a temp Mask so we can remove the background of the Image */
547  hdcMask = CreateCompatibleDC(0);
548  hMaskBitmap = CreateBitmap(bmp.bmWidth, bmp.bmHeight, 1, 1, NULL);
549  SelectObject(hdcMask, hMaskBitmap);
550 
551  /* create monochrome image to the mask bitmap */
552  bkColor = (clrMask != CLR_DEFAULT) ? clrMask : GetPixel (hdcBitmap, 0, 0);
553  SetBkColor (hdcBitmap, bkColor);
554  BitBlt (hdcMask, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcBitmap, 0, 0, SRCCOPY);
555 
556  /*
557  * Remove the background from the image
558  *
559  * WINDOWS BUG ALERT!!!!!!
560  * The statement below should not be done in common practice
561  * but this is how ImageList_AddMasked works in Windows.
562  * It overwrites the original bitmap passed, this was discovered
563  * by using the same bitmap to iterate the different styles
564  * on windows where it failed (BUT ImageList_Add is OK)
565  * This is here in case some apps rely on this bug
566  *
567  * Blt mode 0x220326 is NOTSRCAND
568  */
569  if (bmp.bmBitsPixel > 8) /* NOTSRCAND can't work with palettes */
570  {
571  SetBkColor(hdcBitmap, RGB(255,255,255));
572  BitBlt(hdcBitmap, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcMask, 0, 0, 0x220326);
573  }
574 
576  DeleteDC(hdcMask);
577 
578  ret = ImageList_Add( himl, hBitmap, hMaskBitmap );
579 
580  DeleteObject(hMaskBitmap);
581  return ret;
582 }
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:413
HDC hdcBitmap
Definition: solcreate.cpp:11
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
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:416
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:285
#define RGB(r, g, b)
Definition: wingdi.h:2918
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:305
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 603 of file imagelist.c.

605 {
606  INT cx, cy;
607  POINT src, dst;
608 
609  TRACE("(himlTrack=%p iTrack=%d dx=%d dy=%d)\n", himlTrack, iTrack,
610  dxHotspot, dyHotspot);
611 
612  if (!is_valid(himlTrack))
613  return FALSE;
614 
615  if (iTrack >= himlTrack->cCurImage)
616  return FALSE;
617 
618  if (InternalDrag.himl)
619  return FALSE;
620 
621  cx = himlTrack->cx;
622  cy = himlTrack->cy;
623 
625  if (InternalDrag.himl == NULL) {
626  WARN("Error creating drag image list!\n");
627  return FALSE;
628  }
629 
630  InternalDrag.dxHotspot = dxHotspot;
631  InternalDrag.dyHotspot = dyHotspot;
632 
633  /* copy image */
635  imagelist_point_from_index(himlTrack, iTrack, &src);
636  BitBlt(InternalDrag.himl->hdcImage, dst.x, dst.y, cx, cy, himlTrack->hdcImage, src.x, src.y,
637  SRCCOPY);
638  BitBlt(InternalDrag.himl->hdcMask, dst.x, dst.y, cx, cy, himlTrack->hdcMask, src.x, src.y,
639  SRCCOPY);
640 
642 
643  return TRUE;
644 }
#define TRUE
Definition: types.h:120
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:151
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
#define WARN(fmt,...)
Definition: debug.h:111
static INTERNALDRAG InternalDrag
Definition: imagelist.c:122
UINT flags
Definition: imagelist.c:63
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:416
int32_t INT
Definition: typedefs.h:56
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:769
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
smooth NULL
Definition: ftsmooth.c:416
INT cCurImage
Definition: imagelist.c:57
#define TRACE(s)
Definition: solgame.cpp:4
HIMAGELIST himl
Definition: imagelist.c:108
GLenum src
Definition: glext.h:6340
HDC hdcMask
Definition: imagelist.c:71
GLenum GLenum dst
Definition: glext.h:6340
_Out_opt_ int * cx
Definition: commctrl.h:570
HDC hdcImage
Definition: imagelist.c:70
HIMAGELIST himlNoCursor
Definition: imagelist.c:109
#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 3324 of file imagelist.c.

3325 {
3326  TRACE("(%s,%p,%s,%p)\n", debugstr_guid(rclsid), punkOuter, debugstr_guid(riid), ppv);
3327 
3328  if (!IsEqualCLSID(&CLSID_ImageList, rclsid))
3329  return E_NOINTERFACE;
3330 
3331  return ImageListImpl_CreateInstance(punkOuter, riid, ppv);
3332 }
#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:3914
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:91

Referenced by init_functions().

◆ ImageList_Copy()

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

Definition at line 671 of file imagelist.c.

673 {
674  POINT ptSrc, ptDst;
675 
676  TRACE("himlDst=%p iDst=%d himlSrc=%p iSrc=%d\n", himlDst, iDst, himlSrc, iSrc);
677 
678  if (!is_valid(himlSrc) || !is_valid(himlDst))
679  return FALSE;
680  if ((iDst < 0) || (iDst >= himlDst->cCurImage))
681  return FALSE;
682  if ((iSrc < 0) || (iSrc >= himlSrc->cCurImage))
683  return FALSE;
684 
685  imagelist_point_from_index( himlDst, iDst, &ptDst );
686  imagelist_point_from_index( himlSrc, iSrc, &ptSrc );
687 
688  if (uFlags & ILCF_SWAP) {
689  /* swap */
690  HDC hdcBmp;
691  HBITMAP hbmTempImage, hbmTempMask;
692 
693  hdcBmp = CreateCompatibleDC (0);
694 
695  /* create temporary bitmaps */
696  hbmTempImage = CreateBitmap (himlSrc->cx, himlSrc->cy, 1,
697  himlSrc->uBitsPixel, NULL);
698  hbmTempMask = CreateBitmap (himlSrc->cx, himlSrc->cy, 1,
699  1, NULL);
700 
701  /* copy (and stretch) destination to temporary bitmaps.(save) */
702  /* image */
703  SelectObject (hdcBmp, hbmTempImage);
704  StretchBlt (hdcBmp, 0, 0, himlSrc->cx, himlSrc->cy,
705  himlDst->hdcImage, ptDst.x, ptDst.y, himlDst->cx, himlDst->cy,
706  SRCCOPY);
707  /* mask */
708  SelectObject (hdcBmp, hbmTempMask);
709  StretchBlt (hdcBmp, 0, 0, himlSrc->cx, himlSrc->cy,
710  himlDst->hdcMask, ptDst.x, ptDst.y, himlDst->cx, himlDst->cy,
711  SRCCOPY);
712 
713  /* copy (and stretch) source to destination */
714  /* image */
715  StretchBlt (himlDst->hdcImage, ptDst.x, ptDst.y, himlDst->cx, himlDst->cy,
716  himlSrc->hdcImage, ptSrc.x, ptSrc.y, himlSrc->cx, himlSrc->cy,
717  SRCCOPY);
718  /* mask */
719  StretchBlt (himlDst->hdcMask, ptDst.x, ptDst.y, himlDst->cx, himlDst->cy,
720  himlSrc->hdcMask, ptSrc.x, ptSrc.y, himlSrc->cx, himlSrc->cy,
721  SRCCOPY);
722 
723  /* copy (without stretching) temporary bitmaps to source (restore) */
724  /* mask */
725  BitBlt (himlSrc->hdcMask, ptSrc.x, ptSrc.y, himlSrc->cx, himlSrc->cy,
726  hdcBmp, 0, 0, SRCCOPY);
727 
728  /* image */
729  BitBlt (himlSrc->hdcImage, ptSrc.x, ptSrc.y, himlSrc->cx, himlSrc->cy,
730  hdcBmp, 0, 0, SRCCOPY);
731  /* delete temporary bitmaps */
732  DeleteObject (hbmTempMask);
733  DeleteObject (hbmTempImage);
734  DeleteDC(hdcBmp);
735  }
736  else {
737  /* copy image */
738  StretchBlt (himlDst->hdcImage, ptDst.x, ptDst.y, himlDst->cx, himlDst->cy,
739  himlSrc->hdcImage, ptSrc.x, ptSrc.y, himlSrc->cx, himlSrc->cy,
740  SRCCOPY);
741 
742  /* copy mask */
743  StretchBlt (himlDst->hdcMask, ptDst.x, ptDst.y, himlDst->cx, himlDst->cy,
744  himlSrc->hdcMask, ptSrc.x, ptSrc.y, himlSrc->cx, himlSrc->cy,
745  SRCCOPY);
746  }
747 
748  return TRUE;
749 }
#define ILCF_SWAP
Definition: commctrl.h:496
#define TRUE
Definition: types.h:120
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:151
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
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:60
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:416
UINT uBitsPixel
Definition: imagelist.c:78
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:57
#define TRACE(s)
Definition: solgame.cpp:4
static HBITMAP
Definition: imagelist.c:69
BOOL WINAPI DeleteDC(_In_ HDC)
HDC hdcMask
Definition: imagelist.c:71
HDC hdcImage
Definition: imagelist.c:70
#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 180 of file imagelist.c.

182 {
183  POINT ptSrc, ptDest;
184  SIZE sz;
185  UINT i;
186 
187  for ( i=0; i<TILE_COUNT; i++ )
188  {
189  imagelist_point_from_index( himl, src+i, &ptSrc );
190  imagelist_point_from_index( himl, dest+i, &ptDest );
191  sz.cx = himl->cx;
192  sz.cy = himl->cy * imagelist_height( count - i );
193 
194  BitBlt( hdcDest, ptDest.x, ptDest.y, sz.cx, sz.cy,
195  hdcSrc, ptSrc.x, ptSrc.y, SRCCOPY );
196  }
197 }
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:151
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:146
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:416
#define TILE_COUNT
Definition: imagelist.c:144
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:319
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:320
#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 769 of file imagelist.c.

771 {
773  INT nCount;
774  HBITMAP hbmTemp;
775  UINT ilc = (flags & 0xFE);
776  static const WORD aBitBlend25[] =
777  {0xAA, 0x00, 0x55, 0x00, 0xAA, 0x00, 0x55, 0x00};
778 
779  static const WORD aBitBlend50[] =
780  {0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA};
781 
782  TRACE("(%d %d 0x%x %d %d)\n", cx, cy, flags, cInitial, cGrow);
783 
784  if (cx < 0 || cy < 0) return NULL;
785  if (!((flags&ILC_COLORDDB) == ILC_COLORDDB) && (cx == 0 || cy == 0)) return NULL;
786 
787  /* Create the IImageList interface for the image list */
788  if (FAILED(ImageListImpl_CreateInstance(NULL, &IID_IImageList, (void **)&himl)))
789  return NULL;
790 
791  cGrow = (WORD)((max( cGrow, 1 ) + 3) & ~3);
792 
793  if (cGrow > 256)
794  {
795  /* Windows doesn't limit the size here, but X11 doesn't let us allocate such huge bitmaps */
796  WARN( "grow %d too large, limiting to 256\n", cGrow );
797  cGrow = 256;
798  }
799 
800  himl->cx = cx;
801  himl->cy = cy;
802  himl->flags = flags;
803  himl->cMaxImage = cInitial + 1;
804  himl->cInitial = cInitial;
805  himl->cGrow = cGrow;
807  himl->clrBk = CLR_NONE;
809 
810  /* initialize overlay mask indices */
811  for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
812  himl->nOvlIdx[nCount] = -1;
813 
814  /* Create Image & Mask DCs */
816  if (!himl->hdcImage)
817  goto cleanup;
818  if (himl->flags & ILC_MASK){
820  if (!himl->hdcMask)
821  goto cleanup;
822  }
823 
824  /* Default to ILC_COLOR4 if none of the ILC_COLOR* flags are specified */
825  if (ilc == ILC_COLOR)
826  {
827  ilc = ILC_COLOR4;
828  himl->flags |= ILC_COLOR4;
829  }
830 
831  if (ilc >= ILC_COLOR4 && ilc <= ILC_COLOR32)
832  himl->uBitsPixel = ilc;
833  else
835 
836  if (himl->cMaxImage > 0) {
839  } else
840  himl->hbmImage = 0;
841 
842  if ((himl->cMaxImage > 0) && (himl->flags & ILC_MASK)) {
843  SIZE sz;
844 
846  himl->hbmMask = CreateBitmap (sz.cx, sz.cy, 1, 1, NULL);
847  if (himl->hbmMask == 0) {
848  ERR("Error creating mask bitmap!\n");
849  goto cleanup;
850  }
852  }
853  else
854  himl->hbmMask = 0;
855 
856  if (ilc == ILC_COLOR32)
857  himl->has_alpha = heap_alloc_zero( himl->cMaxImage );
858  else
859  himl->has_alpha = NULL;
860 
861  /* create blending brushes */
862  hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend25);
863  himl->hbrBlend25 = CreatePatternBrush (hbmTemp);
864  DeleteObject (hbmTemp);
865 
866  hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend50);
867  himl->hbrBlend50 = CreatePatternBrush (hbmTemp);
868  DeleteObject (hbmTemp);
869 
870  TRACE("created imagelist %p\n", himl);
871  return himl;
872 
873 cleanup:
875  return NULL;
876 }
#define BITSPIXEL
Definition: wingdi.h:719
#define max(a, b)
Definition: svc.c:63
INT cMaxImage
Definition: imagelist.c:58
INT nOvlIdx[MAX_OVERLAYIMAGE]
Definition: imagelist.c:72
#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:79
UINT flags
Definition: imagelist.c:63
HIMAGELIST himl
UINT uBitsPixel
Definition: imagelist.c:78
int32_t INT
Definition: typedefs.h:56
#define ILC_COLOR4
Definition: commctrl.h:339
HBITMAP hbmImage
Definition: imagelist.c:68
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:893
#define ILC_COLOR32
Definition: commctrl.h:343
static void imagelist_get_bitmap_size(HIMAGELIST himl, UINT count, SIZE *sz)
Definition: imagelist.c:157
static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count)
Definition: imagelist.c:3224
HBRUSH hbrBlend50
Definition: imagelist.c:76
#define ILC_COLOR
Definition: commctrl.h:337
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
INT cInitial
Definition: imagelist.c:77
HBITMAP hbmMask
Definition: imagelist.c:69
#define CLR_NONE
Definition: commctrl.h:304
HBRUSH WINAPI CreatePatternBrush(_In_ HBITMAP)
#define TRACE(s)
Definition: solgame.cpp:4
COLORREF clrFg
Definition: imagelist.c:64
BOOL color_table_set
Definition: imagelist.c:80
COLORREF clrBk
Definition: imagelist.c:65
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:3914
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define ILC_MASK
Definition: commctrl.h:336
HBRUSH hbrBlend25
Definition: imagelist.c:75
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:338
HDC hdcMask
Definition: imagelist.c:71
unsigned int UINT
Definition: ndis.h:50
#define CLR_DEFAULT
Definition: commctrl.h:305
_Out_opt_ int * cx
Definition: commctrl.h:570
HDC hdcImage
Definition: imagelist.c:70
char * cleanup(char *str)
Definition: wpickclick.c:99
INT cGrow
Definition: imagelist.c:59
LONG cy
Definition: windef.h:320
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 3224 of file imagelist.c.

3225 {
3226  HBITMAP hbmNewBitmap;
3227  UINT ilc = (himl->flags & 0xFE);
3228  SIZE sz;
3229 
3231 
3232  if ((ilc >= ILC_COLOR4 && ilc <= ILC_COLOR32) || ilc == ILC_COLOR)
3233  {
3234  char buffer[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
3235  BITMAPINFO *bmi = (BITMAPINFO *)buffer;
3236 
3237  TRACE("Creating DIBSection %d x %d, %d Bits per Pixel\n",
3238  sz.cx, sz.cy, himl->uBitsPixel);
3239 
3240  memset( buffer, 0, sizeof(buffer) );
3241  bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
3242  bmi->bmiHeader.biWidth = sz.cx;
3243  bmi->bmiHeader.biHeight = sz.cy;
3244  bmi->bmiHeader.biPlanes = 1;
3247 
3248  if (himl->uBitsPixel <= ILC_COLOR8)
3249  {
3250  if (!himl->color_table_set)
3251  {
3252  /* retrieve the default color map */
3253  HBITMAP tmp = CreateBitmap( 1, 1, 1, 1, NULL );
3254  GetDIBits( hdc, tmp, 0, 0, NULL, bmi, DIB_RGB_COLORS );
3255  DeleteObject( tmp );
3256  if (ilc == ILC_COLOR4)
3257  {
3258  RGBQUAD tmp;
3259  tmp = bmi->bmiColors[7];
3260  bmi->bmiColors[7] = bmi->bmiColors[8];
3261  bmi->bmiColors[8] = tmp;
3262  }
3263  }
3264  else
3265  {
3267  }
3268  }
3269  hbmNewBitmap = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, NULL, 0, 0);
3270  }
3271  else /*if (ilc == ILC_COLORDDB)*/
3272  {
3273  TRACE("Creating Bitmap: %d Bits per Pixel\n", himl->uBitsPixel);
3274 
3275  hbmNewBitmap = CreateBitmap (sz.cx, sz.cy, 1, himl->uBitsPixel, NULL);
3276  }
3277  TRACE("returning %p\n", hbmNewBitmap);
3278  return hbmNewBitmap;
3279 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1454
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:63
HIMAGELIST himl
UINT uBitsPixel
Definition: imagelist.c:78
#define ILC_COLOR4
Definition: commctrl.h:339
#define ILC_COLOR32
Definition: commctrl.h:343
static void imagelist_get_bitmap_size(HIMAGELIST himl, UINT count, SIZE *sz)
Definition: imagelist.c:157
#define ILC_COLOR
Definition: commctrl.h:337
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
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:1455
BOOL color_table_set
Definition: imagelist.c:80
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:70
#define ILC_COLOR8
Definition: commctrl.h:340
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define memset(x, y, z)
Definition: compat.h:39
LONG cy
Definition: windef.h:320
#define BI_RGB
Definition: precomp.h:35
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 893 of file imagelist.c.

894 {
895  if (!is_valid(himl))
896  return FALSE;
897 
898  IImageList_Release((IImageList *) himl);
899  return TRUE;
900 }
#define TRUE
Definition: types.h:120
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
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(), OnDestroySettingsPage(), 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 923 of file imagelist.c.

924 {
925  TRACE("(hwnd=%p x=%d y=%d)\n", hwndLock, x, y);
926 
927  if (!is_valid(InternalDrag.himl))
928  return FALSE;
929 
930  if (hwndLock)
931  InternalDrag.hwnd = hwndLock;
932  else
934 
935  InternalDrag.x = x;
936  InternalDrag.y = y;
937 
938  /* draw the drag image and save the background */
940 }
#define TRUE
Definition: types.h:120
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
static INTERNALDRAG InternalDrag
Definition: imagelist.c:122
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
BOOL WINAPI ImageList_DragShowNolock(BOOL bShow)
Definition: imagelist.c:1118
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
#define TRACE(s)
Definition: solgame.cpp:4
HIMAGELIST himl
Definition: imagelist.c:108
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 957 of file imagelist.c.

958 {
959  /* As we don't save drag info in the window this can lead to problems if
960  an app does not supply the same window as DragEnter */
961  /* if (hwndLock)
962  InternalDrag.hwnd = hwndLock;
963  else
964  InternalDrag.hwnd = GetDesktopWindow (); */
965  if(!hwndLock)
966  hwndLock = GetDesktopWindow();
967  if(InternalDrag.hwnd != hwndLock)
968  FIXME("DragLeave hWnd != DragEnter hWnd\n");
969 
971 
972  return TRUE;
973 }
#define TRUE
Definition: types.h:120
static INTERNALDRAG InternalDrag
Definition: imagelist.c:122
BOOL WINAPI ImageList_DragShowNolock(BOOL bShow)
Definition: imagelist.c:1118
#define FIXME(fmt,...)
Definition: debug.h:110
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622

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

◆ ImageList_DragMove()

BOOL WINAPI ImageList_DragMove ( INT  x,
INT  y 
)

Definition at line 1035 of file imagelist.c.

1036 {
1037  TRACE("(x=%d y=%d)\n", x, y);
1038 
1039  if (!is_valid(InternalDrag.himl))
1040  return FALSE;
1041 
1042  /* draw/update the drag image */
1043  if (InternalDrag.bShow) {
1044  HDC hdcDrag;
1045  HDC hdcOffScreen;
1046  HDC hdcBg;
1047  HBITMAP hbmOffScreen;
1048  INT origNewX, origNewY;
1049  INT origOldX, origOldY;
1050  INT origRegX, origRegY;
1051  INT sizeRegX, sizeRegY;
1052 
1053 
1054  /* calculate the update region */
1055  origNewX = x - InternalDrag.dxHotspot;
1056  origNewY = y - InternalDrag.dyHotspot;
1057  origOldX = InternalDrag.x - InternalDrag.dxHotspot;
1058  origOldY = InternalDrag.y - InternalDrag.dyHotspot;
1059  origRegX = min(origNewX, origOldX);
1060  origRegY = min(origNewY, origOldY);
1061  sizeRegX = InternalDrag.himl->cx + abs(x - InternalDrag.x);
1062  sizeRegY = InternalDrag.himl->cy + abs(y - InternalDrag.y);
1063 
1064  hdcDrag = GetDCEx(InternalDrag.hwnd, 0,
1066  hdcOffScreen = CreateCompatibleDC(hdcDrag);
1067  hdcBg = CreateCompatibleDC(hdcDrag);
1068 
1069  hbmOffScreen = CreateCompatibleBitmap(hdcDrag, sizeRegX, sizeRegY);
1070  SelectObject(hdcOffScreen, hbmOffScreen);
1072 
1073  /* get the actual background of the update region */
1074  BitBlt(hdcOffScreen, 0, 0, sizeRegX, sizeRegY, hdcDrag,
1075  origRegX, origRegY, SRCCOPY);
1076  /* erase the old image */
1077  BitBlt(hdcOffScreen, origOldX - origRegX, origOldY - origRegY,
1078  InternalDrag.himl->cx, InternalDrag.himl->cy, hdcBg, 0, 0,
1079  SRCCOPY);
1080  /* save the background */
1081  BitBlt(hdcBg, 0, 0, InternalDrag.himl->cx, InternalDrag.himl->cy,
1082  hdcOffScreen, origNewX - origRegX, origNewY - origRegY, SRCCOPY);
1083  /* draw the image */
1084  ImageList_InternalDragDraw(hdcOffScreen, origNewX - origRegX,
1085  origNewY - origRegY);
1086  /* draw the update region to the screen */
1087  BitBlt(hdcDrag, origRegX, origRegY, sizeRegX, sizeRegY,
1088  hdcOffScreen, 0, 0, SRCCOPY);
1089 
1090  DeleteDC(hdcBg);
1091  DeleteDC(hdcOffScreen);
1092  DeleteObject(hbmOffScreen);
1093  ReleaseDC(InternalDrag.hwnd, hdcDrag);
1094  }
1095 
1096  /* update the image position */
1097  InternalDrag.x = x;
1098  InternalDrag.y = y;
1099 
1100  return TRUE;
1101 }
#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:3877
HBITMAP hbmBg
Definition: imagelist.c:119
static INTERNALDRAG InternalDrag
Definition: imagelist.c:122
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:416
int32_t INT
Definition: typedefs.h:56
#define DCX_WINDOW
Definition: winuser.h:2074
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define DCX_LOCKWINDOWUPDATE
Definition: winuser.h:2081
#define TRACE(s)
Definition: solgame.cpp:4
HIMAGELIST himl
Definition: imagelist.c:108
static HBITMAP
Definition: imagelist.c:69
#define DCX_CACHE
Definition: winuser.h:2075
BOOL WINAPI DeleteDC(_In_ HDC)
static void ImageList_InternalDragDraw(HDC hdc, INT x, INT y)
Definition: imagelist.c:997
#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 1118 of file imagelist.c.

1119 {
1120  HDC hdcDrag;
1121  HDC hdcBg;
1122  INT x, y;
1123 
1124  if (!is_valid(InternalDrag.himl))
1125  return FALSE;
1126 
1127  TRACE("bShow=0x%X!\n", bShow);
1128 
1129  /* DragImage is already visible/hidden */
1130  if ((InternalDrag.bShow && bShow) || (!InternalDrag.bShow && !bShow)) {
1131  return FALSE;
1132  }
1133 
1134  /* position of the origin of the DragImage */
1137 
1138  hdcDrag = GetDCEx (InternalDrag.hwnd, 0,
1140  if (!hdcDrag) {
1141  return FALSE;
1142  }
1143 
1144  hdcBg = CreateCompatibleDC(hdcDrag);
1145  if (!InternalDrag.hbmBg) {
1148  }
1150 
1151  if (bShow) {
1152  /* save the background */
1153  BitBlt(hdcBg, 0, 0, InternalDrag.himl->cx, InternalDrag.himl->cy,
1154  hdcDrag, x, y, SRCCOPY);
1155  /* show the image */
1156  ImageList_InternalDragDraw(hdcDrag, x, y);
1157  } else {
1158  /* hide the image */
1159  BitBlt(hdcDrag, x, y, InternalDrag.himl->cx, InternalDrag.himl->cy,
1160  hdcBg, 0, 0, SRCCOPY);
1161  }
1162 
1164 
1165  DeleteDC(hdcBg);
1166  ReleaseDC (InternalDrag.hwnd, hdcDrag);
1167  return TRUE;
1168 }
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:3877
HBITMAP hbmBg
Definition: imagelist.c:119
static INTERNALDRAG InternalDrag
Definition: imagelist.c:122
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:416
int32_t INT
Definition: typedefs.h:56
#define DCX_WINDOW
Definition: winuser.h:2074
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define DCX_LOCKWINDOWUPDATE
Definition: winuser.h:2081
#define TRACE(s)
Definition: solgame.cpp:4
HIMAGELIST himl
Definition: imagelist.c:108
#define DCX_CACHE
Definition: winuser.h:2075
BOOL WINAPI DeleteDC(_In_ HDC)
static void ImageList_InternalDragDraw(HDC hdc, INT x, INT y)
Definition: imagelist.c:997
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 1193 of file imagelist.c.

1194 {
1195  return ImageList_DrawEx (himl, i, hdc, x, y, 0, 0,
1196  CLR_DEFAULT, CLR_DEFAULT, fStyle);
1197 }
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:305
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:1229

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 1229 of file imagelist.c.

1232 {
1233  IMAGELISTDRAWPARAMS imldp;
1234 
1235  ZeroMemory (&imldp, sizeof(imldp));
1236  imldp.cbSize = sizeof(imldp);
1237  imldp.himl = himl;
1238  imldp.i = i;
1239  imldp.hdcDst = hdc,
1240  imldp.x = x;
1241  imldp.y = y;
1242  imldp.cx = dx;
1243  imldp.cy = dy;
1244  imldp.rgbBk = rgbBk;
1245  imldp.rgbFg = rgbFg;
1246  imldp.fStyle = fStyle;
1247 
1248  return ImageList_DrawIndirect (&imldp);
1249 }
GLint dy
Definition: linetemp.h:97
#define ZeroMemory
Definition: winbase.h:1635
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:1439
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 1439 of file imagelist.c.

1440 {
1441  INT cx, cy, nOvlIdx;
1442  DWORD fState, dwRop;
1443  UINT fStyle;
1444  COLORREF oldImageBk, oldImageFg;
1445  HDC hImageDC, hImageListDC, hMaskListDC;
1446  HBITMAP hImageBmp, hOldImageBmp, hBlendMaskBmp;
1447  BOOL bIsTransparent, bBlend, bResult = FALSE, bMask;
1448  HIMAGELIST himl;
1449  HBRUSH hOldBrush;
1450  POINT pt;
1451  BOOL has_alpha;
1452 #ifdef __REACTOS__
1453  HDC hdcSaturated = NULL;
1454 #endif
1455 
1456  if (!pimldp || !(himl = pimldp->himl)) return FALSE;
1457  if (!is_valid(himl)) return FALSE;
1458  if ((pimldp->i < 0) || (pimldp->i >= himl->cCurImage)) return FALSE;
1459 
1460  imagelist_point_from_index( himl, pimldp->i, &pt );
1461  pt.x += pimldp->xBitmap;
1462  pt.y += pimldp->yBitmap;
1463 
1464  fState = pimldp->cbSize < sizeof(IMAGELISTDRAWPARAMS) ? ILS_NORMAL : pimldp->fState;
1465  fStyle = pimldp->fStyle & ~ILD_OVERLAYMASK;
1466  cx = (pimldp->cx == 0) ? himl->cx : pimldp->cx;
1467  cy = (pimldp->cy == 0) ? himl->cy : pimldp->cy;
1468 
1469  bIsTransparent = (fStyle & ILD_TRANSPARENT);
1470  if( pimldp->rgbBk == CLR_NONE )
1471  bIsTransparent = TRUE;
1472  if( ( pimldp->rgbBk == CLR_DEFAULT ) && ( himl->clrBk == CLR_NONE ) )
1473  bIsTransparent = TRUE;
1474  bMask = (himl->flags & ILC_MASK) && (fStyle & ILD_MASK) ;
1475  bBlend = (fStyle & (ILD_BLEND25 | ILD_BLEND50) ) && !bMask;
1476 
1477  TRACE("himl(%p) hbmMask(%p) iImage(%d) x(%d) y(%d) cx(%d) cy(%d)\n",
1478  himl, himl->hbmMask, pimldp->i, pimldp->x, pimldp->y, cx, cy);
1479 
1480  /* we will use these DCs to access the images and masks in the ImageList */
1481  hImageListDC = himl->hdcImage;
1482  hMaskListDC = himl->hdcMask;
1483 
1484  /* these will accumulate the image and mask for the image we're drawing */
1485  hImageDC = CreateCompatibleDC( pimldp->hdcDst );
1486  hImageBmp = CreateCompatibleBitmap( pimldp->hdcDst, cx, cy );
1487  hBlendMaskBmp = bBlend ? CreateBitmap(cx, cy, 1, 1, NULL) : 0;
1488 
1489  /* Create a compatible DC. */
1490  if (!hImageListDC || !hImageDC || !hImageBmp ||
1491  (bBlend && !hBlendMaskBmp) || (himl->hbmMask && !hMaskListDC))
1492  goto cleanup;
1493 
1494  hOldImageBmp = SelectObject(hImageDC, hImageBmp);
1495 
1496  /*
1497  * To obtain a transparent look, background color should be set
1498  * to white and foreground color to black when blitting the
1499  * monochrome mask.
1500  */
1501  oldImageFg = SetTextColor( hImageDC, RGB( 0, 0, 0 ) );
1502  oldImageBk = SetBkColor( hImageDC, RGB( 0xff, 0xff, 0xff ) );
1503 
1504 #ifdef __REACTOS__
1505  /*
1506  * If the ILS_SATURATE bit is enabled we should multiply the
1507  * RGB colors of the original image by the contents of rgbFg.
1508  */
1509  if (fState & ILS_SATURATE)
1510  {
1511  hdcSaturated = saturate_image(himl, pimldp->hdcDst, pimldp->x, pimldp->y,
1512  pt.x, pt.y, cx, cy, pimldp->rgbFg);
1513 
1514  hImageListDC = hdcSaturated;
1515  /* shitty way of getting subroutines to blit at the right place (top left corner),
1516  as our modified imagelist only contains a single image for performance reasons */
1517  pt.x = 0;
1518  pt.y = 0;
1519  }
1520 #endif
1521 
1522  has_alpha = (himl->has_alpha && himl->has_alpha[pimldp->i]);
1523  if (!bMask && (has_alpha || (fState & ILS_ALPHA)))
1524  {
1525  COLORREF colour, blend_col = CLR_NONE;
1527 
1528  if (bBlend)
1529  {
1530  blend_col = pimldp->rgbFg;
1531  if (blend_col == CLR_DEFAULT) blend_col = GetSysColor( COLOR_HIGHLIGHT );
1532  else if (blend_col == CLR_NONE) blend_col = GetTextColor( pimldp->hdcDst );
1533  }
1534 
1535  func.BlendOp = AC_SRC_OVER;
1536  func.BlendFlags = 0;
1537  func.SourceConstantAlpha = (fState & ILS_ALPHA) ? pimldp->Frame : 255;
1538  func.AlphaFormat = AC_SRC_ALPHA;
1539 
1540  if (bIsTransparent)
1541  {
1542 #ifdef __REACTOS__
1543  bResult = alpha_blend_image( himl, hImageListDC, pimldp->hdcDst, pimldp->x, pimldp->y,
1544 #else
1545  bResult = alpha_blend_image( himl, pimldp->hdcDst, pimldp->x, pimldp->y,
1546 #endif
1547  pt.x, pt.y, cx, cy, func, fStyle, blend_col );
1548  goto end;
1549  }
1550  colour = pimldp->rgbBk;
1551  if (colour == CLR_DEFAULT) colour = himl->clrBk;
1552  if (colour == CLR_NONE) colour = GetBkColor( pimldp->hdcDst );
1553 
1554  hOldBrush = SelectObject (hImageDC, CreateSolidBrush (colour));
1555  PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY );
1556 #ifdef __REACTOS__
1557  alpha_blend_image( himl, hImageListDC, hImageDC, 0, 0, pt.x, pt.y, cx, cy, func, fStyle, blend_col );
1558 #else
1559  alpha_blend_image( himl, hImageDC, 0, 0, pt.x, pt.y, cx, cy, func, fStyle, blend_col );
1560 #endif
1561  DeleteObject (SelectObject (hImageDC, hOldBrush));
1562  bResult = BitBlt( pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, SRCCOPY );
1563  goto end;
1564  }
1565 
1566  /*
1567  * Draw the initial image
1568  */
1569  if( bMask ) {
1570  if (himl->hbmMask) {
1571  hOldBrush = SelectObject (hImageDC, CreateSolidBrush (GetTextColor(pimldp->hdcDst)));
1572  PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY );
1573  BitBlt(hImageDC, 0, 0, cx, cy, hMaskListDC, pt.x, pt.y, SRCPAINT);
1574  DeleteObject (SelectObject (hImageDC, hOldBrush));
1575  if( bIsTransparent )
1576  {
1577  BitBlt ( pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, SRCAND);
1578  bResult = TRUE;
1579  goto end;
1580  }
1581  } else {
1582  hOldBrush = SelectObject (hImageDC, GetStockObject(BLACK_BRUSH));
1583  PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY);
1584  SelectObject(hImageDC, hOldBrush);
1585  }
1586  } else {
1587  /* blend the image with the needed solid background */
1588  COLORREF colour = RGB(0,0,0);
1589 
1590  if( !bIsTransparent )
1591  {
1592  colour = pimldp->rgbBk;
1593  if( colour == CLR_DEFAULT )
1594  colour = himl->clrBk;
1595  if( colour == CLR_NONE )
1596  colour = GetBkColor(pimldp->hdcDst);
1597  }
1598 
1599  hOldBrush = SelectObject (hImageDC, CreateSolidBrush (colour));
1600  PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY );
1601  if (himl->hbmMask)
1602  {
1603  BitBlt( hImageDC, 0, 0, cx, cy, hMaskListDC, pt.x, pt.y, SRCAND );
1604  BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, pt.x, pt.y, SRCPAINT );
1605  }
1606  else
1607  BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, pt.x, pt.y, SRCCOPY);
1608  DeleteObject (SelectObject (hImageDC, hOldBrush));
1609  }
1610 
1611  /* Time for blending, if required */
1612  if (bBlend) {
1613  HBRUSH hBlendBrush;
1614  COLORREF clrBlend = pimldp->rgbFg;
1615  HDC hBlendMaskDC = hImageListDC;
1616  HBITMAP hOldBitmap;
1617 
1618  /* Create the blend Mask */
1619  hOldBitmap = SelectObject(hBlendMaskDC, hBlendMaskBmp);
1620  hBlendBrush = fStyle & ILD_BLEND50 ? himl->hbrBlend50 : himl->hbrBlend25;
1621  hOldBrush = SelectObject(hBlendMaskDC, hBlendBrush);
1622  PatBlt(hBlendMaskDC, 0, 0, cx, cy, PATCOPY);
1623  SelectObject(hBlendMaskDC, hOldBrush);
1624 
1625  /* Modify the blend mask if an Image Mask exist */
1626  if(himl->hbmMask) {
1627  BitBlt(hBlendMaskDC, 0, 0, cx, cy, hMaskListDC, pt.x, pt.y, 0x220326); /* NOTSRCAND */
1628  BitBlt(hBlendMaskDC, 0, 0, cx, cy, hBlendMaskDC, 0, 0, NOTSRCCOPY);
1629  }
1630 
1631  /* now apply blend to the current image given the BlendMask */
1632  if (clrBlend == CLR_DEFAULT) clrBlend = GetSysColor (COLOR_HIGHLIGHT);
1633  else if (clrBlend == CLR_NONE) clrBlend = GetTextColor (pimldp->hdcDst);
1634  hOldBrush = SelectObject (hImageDC, CreateSolidBrush(clrBlend));
1635  BitBlt (hImageDC, 0, 0, cx, cy, hBlendMaskDC, 0, 0, 0xB8074A); /* PSDPxax */
1636  DeleteObject(SelectObject(hImageDC, hOldBrush));
1637  SelectObject(hBlendMaskDC, hOldBitmap);
1638  }
1639 
1640  /* Now do the overlay image, if any */
1641  nOvlIdx = (pimldp->fStyle & ILD_OVERLAYMASK) >> 8;
1642  if ( (nOvlIdx >= 1) && (nOvlIdx <= MAX_OVERLAYIMAGE)) {
1643  nOvlIdx = himl->nOvlIdx[nOvlIdx - 1];
1644  if ((nOvlIdx >= 0) && (nOvlIdx < himl->cCurImage)) {
1645  POINT ptOvl;
1646  imagelist_point_from_index( himl, nOvlIdx, &ptOvl );
1647  ptOvl.x += pimldp->xBitmap;
1648  if (himl->hbmMask && !(fStyle & ILD_IMAGE))
1649  BitBlt (hImageDC, 0, 0, cx, cy, hMaskListDC, ptOvl.x, ptOvl.y, SRCAND);
1650  BitBlt (hImageDC, 0, 0, cx, cy, hImageListDC, ptOvl.x, ptOvl.y, SRCPAINT);
1651  }
1652  }
1653 
1654 #ifndef __REACTOS__
1655  if (fState & ILS_SATURATE) FIXME("ILS_SATURATE: unimplemented!\n");
1656 #endif
1657  if (fState & ILS_GLOW) FIXME("ILS_GLOW: unimplemented!\n");
1658  if (fState & ILS_SHADOW) FIXME("ILS_SHADOW: unimplemented!\n");
1659 
1660  if (fStyle & ILD_PRESERVEALPHA) FIXME("ILD_PRESERVEALPHA: unimplemented!\n");
1661  if (fStyle & ILD_SCALE) FIXME("ILD_SCALE: unimplemented!\n");
1662  if (fStyle & ILD_DPISCALE) FIXME("ILD_DPISCALE: unimplemented!\n");
1663 
1664  /* now copy the image to the screen */
1665  dwRop = SRCCOPY;
1666  if (himl->hbmMask && bIsTransparent ) {
1667  COLORREF oldDstFg = SetTextColor(pimldp->hdcDst, RGB( 0, 0, 0 ) );
1668  COLORREF oldDstBk = SetBkColor(pimldp->hdcDst, RGB( 0xff, 0xff, 0xff ));
1669  BitBlt (pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hMaskListDC, pt.x, pt.y, SRCAND);
1670  SetBkColor(pimldp->hdcDst, oldDstBk);
1671  SetTextColor(pimldp->hdcDst, oldDstFg);
1672  dwRop = SRCPAINT;
1673  }
1674  if (fStyle & ILD_ROP) dwRop = pimldp->dwRop;
1675  BitBlt (pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, dwRop);
1676 
1677  bResult = TRUE;
1678 end:
1679  /* cleanup the mess */
1680  SetBkColor(hImageDC, oldImageBk);
1681  SetTextColor(hImageDC, oldImageFg);
1682  SelectObject(hImageDC, hOldImageBmp);
1683 cleanup:
1684 #ifdef __REACTOS__
1685  if (hdcSaturated)
1686  DeleteDC(hdcSaturated);
1687 #endif
1688  DeleteObject(hBlendMaskBmp);
1689  DeleteObject(hImageBmp);
1690  DeleteDC(hImageDC);
1691 
1692  return bResult;
1693 }
#define SRCPAINT
Definition: wingdi.h:333
HGDIOBJ WINAPI GetStockObject(_In_ int)
GLenum func
Definition: glext.h:6028
#define ILS_ALPHA
Definition: commctrl.h:424
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:954
#define TRUE
Definition: types.h:120
#define ILS_SHADOW
Definition: commctrl.h:422
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:151
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:423
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
INT nOvlIdx[MAX_OVERLAYIMAGE]
Definition: imagelist.c:72
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define ILS_GLOW
Definition: commctrl.h:421
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
char * has_alpha
Definition: imagelist.c:79
GLuint GLuint end
Definition: gl.h:1545
#define AC_SRC_ALPHA
Definition: alphablend.c:9
UINT flags
Definition: imagelist.c:63
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:416
int32_t INT
Definition: typedefs.h:56
DWORD WINAPI GetSysColor(_In_ int)
#define ILD_BLEND25
Definition: commctrl.h:407
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:76
#define FIXME(fmt,...)
Definition: debug.h:110
#define ILD_DPISCALE
Definition: commctrl.h:413
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:829
smooth NULL
Definition: ftsmooth.c:416
#define NOTSRCCOPY
Definition: wingdi.h:324
HBITMAP hbmMask
Definition: imagelist.c:69
#define CLR_NONE
Definition: commctrl.h:304
INT cCurImage
Definition: imagelist.c:57
#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:411
DWORD COLORREF
Definition: windef.h:285
#define ILD_SCALE
Definition: commctrl.h:412
#define RGB(r, g, b)
Definition: wingdi.h:2918
COLORREF clrBk
Definition: imagelist.c:65
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ILD_ROP
Definition: commctrl.h:406
#define ILD_IMAGE
Definition: commctrl.h:405
#define AC_SRC_OVER
Definition: wingdi.h:1351
#define ILD_OVERLAYMASK
Definition: commctrl.h:409
#define ILC_MASK
Definition: commctrl.h:336
HBRUSH hbrBlend25
Definition: imagelist.c:75
#define ILD_BLEND50
Definition: commctrl.h:408
static HBITMAP
Definition: imagelist.c:69
#define PATCOPY
Definition: wingdi.h:334
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:886
#define ILD_TRANSPARENT
Definition: commctrl.h:403
#define MAX_OVERLAYIMAGE
Definition: imagelist.c:52
BOOL WINAPI DeleteDC(_In_ HDC)
HDC hdcMask
Definition: imagelist.c:71
#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:1254
#define CLR_DEFAULT
Definition: commctrl.h:305
_Out_opt_ int * cx
Definition: commctrl.h:570
HDC hdcImage
Definition: imagelist.c:70
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ILS_NORMAL
Definition: commctrl.h:420
struct _IMAGELISTDRAWPARAMS IMAGELISTDRAWPARAMS
#define ILD_MASK
Definition: commctrl.h:404
#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 1710 of file imagelist.c.

1711 {
1712  HIMAGELIST himlDst;
1713 
1714  if (!is_valid(himlSrc)) {
1715  ERR("Invalid image list handle!\n");
1716  return NULL;
1717  }
1718 
1719  himlDst = ImageList_Create (himlSrc->cx, himlSrc->cy, himlSrc->flags,
1720  himlSrc->cCurImage, himlSrc->cGrow);
1721 
1722  if (himlDst)
1723  {
1724  SIZE sz;
1725 
1726  imagelist_get_bitmap_size(himlSrc, himlSrc->cCurImage, &sz);
1727  BitBlt (himlDst->hdcImage, 0, 0, sz.cx, sz.cy,
1728  himlSrc->hdcImage, 0, 0, SRCCOPY);
1729 
1730  if (himlDst->hbmMask)
1731  BitBlt (himlDst->hdcMask, 0, 0, sz.cx, sz.cy,
1732  himlSrc->hdcMask, 0, 0, SRCCOPY);
1733 
1734  himlDst->cCurImage = himlSrc->cCurImage;
1735  if (himlSrc->has_alpha && himlDst->has_alpha)
1736  memcpy( himlDst->has_alpha, himlSrc->has_alpha, himlDst->cCurImage );
1737  }
1738  return himlDst;
1739 }
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
char * has_alpha
Definition: imagelist.c:79
UINT flags
Definition: imagelist.c:63
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:416
static void imagelist_get_bitmap_size(HIMAGELIST himl, UINT count, SIZE *sz)
Definition: imagelist.c:157
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:769
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
HBITMAP hbmMask
Definition: imagelist.c:69
INT cCurImage
Definition: imagelist.c:57
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:109
HDC hdcMask
Definition: imagelist.c:71
HDC hdcImage
Definition: imagelist.c:70
INT cGrow
Definition: imagelist.c:59
LONG cy
Definition: windef.h:320
#define SRCCOPY
Definition: wingdi.h:332

Referenced by ImageListImpl_Clone(), and SHGetImageList().

◆ ImageList_EndDrag()

VOID WINAPI ImageList_EndDrag ( void  )

Definition at line 1756 of file imagelist.c.

1757 {
1758  /* cleanup the InternalDrag struct */
1759  InternalDrag.hwnd = 0;
1764  InternalDrag.x= 0;
1765  InternalDrag.y= 0;
1766  InternalDrag.dxHotspot = 0;
1767  InternalDrag.dyHotspot = 0;
1770  InternalDrag.hbmBg = 0;
1771 }
HBITMAP hbmBg
Definition: imagelist.c:119
static INTERNALDRAG InternalDrag
Definition: imagelist.c:122
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:893
HIMAGELIST himl
Definition: imagelist.c:108
HIMAGELIST himlNoCursor
Definition: imagelist.c:109

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 157 of file imagelist.c.

158 {
159  sz->cx = himl->cx * TILE_COUNT;
160  sz->cy = imagelist_height( count ) * himl->cy;
161 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
static UINT imagelist_height(UINT count)
Definition: imagelist.c:146
HIMAGELIST himl
#define TILE_COUNT
Definition: imagelist.c:144
LONG cx
Definition: windef.h:319
LONG cy
Definition: windef.h:320

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 1788 of file imagelist.c.

1789 {
1790  return himl ? himl->clrBk : CLR_NONE;
1791 }
HIMAGELIST himl
#define CLR_NONE
Definition: commctrl.h:304
COLORREF clrBk
Definition: imagelist.c:65

Referenced by ImageListImpl_GetBkColor().

◆ ImageList_GetDragImage()

HIMAGELIST WINAPI ImageList_GetDragImage ( POINT ppt,
POINT pptHotspot 
)

Definition at line 1809 of file imagelist.c.

1810 {
1811  if (is_valid(InternalDrag.himl)) {
1812  if (ppt) {
1813  ppt->x = InternalDrag.x;
1814  ppt->y = InternalDrag.y;
1815  }
1816  if (pptHotspot) {
1819  }
1820  return (InternalDrag.himl);
1821  }
1822 
1823  return NULL;
1824 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
static INTERNALDRAG InternalDrag
Definition: imagelist.c:122
smooth NULL
Definition: ftsmooth.c:416
HIMAGELIST himl
Definition: imagelist.c:108
_Out_opt_ POINT * pptHotspot
Definition: commctrl.h:539

Referenced by ImageListImpl_GetDragImage(), and init_functions().

◆ ImageList_GetFlags()

DWORD WINAPI ImageList_GetFlags ( HIMAGELIST  himl)

Definition at line 1843 of file imagelist.c.

1844 {
1845  TRACE("%p\n", himl);
1846 
1847  return is_valid(himl) ? himl->flags : 0;
1848 }
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
UINT flags
Definition: imagelist.c:63
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 1867 of file imagelist.c.

1868 {
1869  ICONINFO ii;
1870  HICON hIcon;
1871  HBITMAP hOldDstBitmap;
1872  HDC hdcDst;
1873  POINT pt;
1874 
1875  TRACE("%p %d %d\n", himl, i, fStyle);
1876  if (!is_valid(himl) || (i < 0) || (i >= himl->cCurImage)) return NULL;
1877 
1878  ii.fIcon = TRUE;
1879  ii.xHotspot = 0;
1880  ii.yHotspot = 0;
1881 
1882  /* create colour bitmap */
1883  hdcDst = GetDC(0);
1885  ReleaseDC(0, hdcDst);
1886 
1888 
1890 
1891  /* draw mask*/
1892  ii.hbmMask = CreateBitmap (himl->cx, himl->cy, 1, 1, NULL);
1893  hOldDstBitmap = SelectObject (hdcDst, ii.hbmMask);
1894  if (himl->hbmMask) {
1895  BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
1896  himl->hdcMask, pt.x, pt.y, SRCCOPY);
1897  }
1898  else
1899  PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS);
1900 
1901  /* draw image*/
1903  BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
1904  himl->hdcImage, pt.x, pt.y, SRCCOPY);
1905 
1906  /*
1907  * CreateIconIndirect requires us to deselect the bitmaps from
1908  * the DCs before calling
1909  */
1910  SelectObject(hdcDst, hOldDstBitmap);
1911 
1912  hIcon = CreateIconIndirect (&ii);
1913 
1914  DeleteObject (ii.hbmMask);
1915  DeleteObject (ii.hbmColor);
1916  DeleteDC (hdcDst);
1917 
1918  return hIcon;
1919 }
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:151
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:3877
DWORD yHotspot
Definition: winuser.h:3078
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:416
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:3079
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hbmColor
Definition: winuser.h:3080
HBITMAP hbmMask
Definition: imagelist.c:69
INT cCurImage
Definition: imagelist.c:57
BOOL fIcon
Definition: winuser.h:3076
#define TRACE(s)
Definition: solgame.cpp:4
DWORD xHotspot
Definition: winuser.h:3077
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:71
HDC hdcImage
Definition: imagelist.c:70
#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 1992 of file imagelist.c.

1993 {
1994  POINT pt;
1995 
1996  if (!is_valid(himl) || (pImageInfo == NULL))
1997  return FALSE;
1998  if ((i < 0) || (i >= himl->cCurImage))
1999  return FALSE;
2000 
2003 
2005  pImageInfo->rcImage.top = pt.y;
2006  pImageInfo->rcImage.bottom = pt.y + himl->cy;
2007  pImageInfo->rcImage.left = pt.x;
2008  pImageInfo->rcImage.right = pt.x + himl->cx;
2009 
2010  return TRUE;
2011 }
HBITMAP hbmImage
#define TRUE
Definition: types.h:120
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:151
#define pt(x, y)
Definition: drawing.c:79
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
HIMAGELIST himl
HBITMAP hbmImage
Definition: imagelist.c:68
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:69
INT cCurImage
Definition: imagelist.c:57
_In_ int _Out_ IMAGEINFO * pImageInfo
Definition: commctrl.h:588
HBITMAP hbmMask
LONG bottom
Definition: windef.h:294

Referenced by COMBOEX_AdjustEditPos(), COMBOEX_DrawItem(), COMBOEX_ReSize(), 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 2033 of file imagelist.c.

2034 {
2035  POINT pt;
2036 
2037  if (!is_valid(himl) || (lpRect == NULL))
2038  return FALSE;
2039  if ((i < 0) || (i >= himl->cCurImage))
2040  return FALSE;
2041 
2043  lpRect->left = pt.x;
2044  lpRect->top = pt.y;
2045  lpRect->right = pt.x + himl->cx;
2046  lpRect->bottom = pt.y + himl->cy;
2047 
2048  return TRUE;
2049 }
#define TRUE
Definition: types.h:120
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:151
#define pt(x, y)
Definition: drawing.c:79
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
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
smooth NULL
Definition: ftsmooth.c:416
INT cCurImage
Definition: imagelist.c:57
LONG bottom
Definition: windef.h:294

◆ imagelist_height()

static UINT imagelist_height ( UINT  count)
inlinestatic

Definition at line 146 of file imagelist.c.

147 {
148  return ((count + TILE_COUNT - 1)/TILE_COUNT);
149 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define TILE_COUNT
Definition: imagelist.c:144

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 997 of file imagelist.c.

998 {
999  IMAGELISTDRAWPARAMS imldp;
1000 
1001  ZeroMemory (&imldp, sizeof(imldp));
1002  imldp.cbSize = sizeof(imldp);
1003  imldp.himl = InternalDrag.himl;
1004  imldp.i = 0;
1005  imldp.hdcDst = hdc,
1006  imldp.x = x;
1007  imldp.y = y;
1008  imldp.rgbBk = CLR_DEFAULT;
1009  imldp.rgbFg = CLR_DEFAULT;
1010  imldp.fStyle = ILD_NORMAL;
1011  imldp.fState = ILS_ALPHA;
1012  imldp.Frame = 192;
1013  ImageList_DrawIndirect (&imldp);
1014 }
#define ILS_ALPHA
Definition: commctrl.h:424
static INTERNALDRAG InternalDrag
Definition: imagelist.c:122
#define ZeroMemory
Definition: winbase.h:1635
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
BOOL WINAPI ImageList_DrawIndirect(IMAGELISTDRAWPARAMS *pimldp)
Definition: imagelist.c:1439
HIMAGELIST himl
Definition: imagelist.c:108
HDC hdc
Definition: main.c:9
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define CLR_DEFAULT
Definition: commctrl.h:305
#define ILD_NORMAL
Definition: commctrl.h:402

Referenced by ImageList_DragMove(), and ImageList_DragShowNolock().

◆ IMAGELIST_InternalExpandBitmaps()

static void IMAGELIST_InternalExpandBitmaps ( HIMAGELIST  himl,
INT  nImageCount 
)
static

Definition at line 326 of file imagelist.c.

327 {
328  HDC hdcBitmap;
329  HBITMAP hbmNewBitmap, hbmNull;
330  INT nNewCount;
331  SIZE sz;
332 
333  TRACE("%p has allocated %d, max %d, grow %d images\n", himl, himl->cCurImage, himl->cMaxImage, himl->cGrow);
334 
335  if (himl->cCurImage + nImageCount < himl->cMaxImage)
336  return;
337 
338  nNewCount = himl->cMaxImage + max(nImageCount, himl->cGrow) + 1;
339 
340  imagelist_get_bitmap_size(himl, nNewCount, &sz);
341 
342  TRACE("Create expanded bitmaps : himl=%p x=%d y=%d count=%d\n", himl, sz.cx, sz.cy, nNewCount);
344 
345  hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount);
346 
347  if (hbmNewBitmap == 0)
348  ERR("creating new image bitmap (x=%d y=%d)!\n", sz.cx, sz.cy);
349 
350  if (himl->cCurImage)
351  {
352  hbmNull = SelectObject (hdcBitmap, hbmNewBitmap);
353  BitBlt (hdcBitmap, 0, 0, sz.cx, sz.cy,
354  himl->hdcImage, 0, 0, SRCCOPY);
355  SelectObject (hdcBitmap, hbmNull);
356  }
357  SelectObject (himl->hdcImage, hbmNewBitmap);
359  himl->hbmImage = hbmNewBitmap;
360 
361  if (himl->flags & ILC_MASK)
362  {
363  hbmNewBitmap = CreateBitmap (sz.cx, sz.cy, 1, 1, NULL);
364 
365  if (hbmNewBitmap == 0)
366  ERR("creating new mask bitmap!\n");
367 
368  if(himl->cCurImage)
369  {
370  hbmNull = SelectObject (hdcBitmap, hbmNewBitmap);
371  BitBlt (hdcBitmap, 0, 0, sz.cx, sz.cy,
372  himl->hdcMask, 0, 0, SRCCOPY);
373  SelectObject (hdcBitmap, hbmNull);
374  }
375  SelectObject (himl->hdcMask, hbmNewBitmap);
377  himl->hbmMask = hbmNewBitmap;
378  }
379 
380  if (himl->has_alpha)
381  {
382  char *new_alpha = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, himl->has_alpha, nNewCount );
383  if (new_alpha) himl->has_alpha = new_alpha;
384  else
385  {
387  himl->has_alpha = NULL;
388  }
389  }
390 
391  himl->cMaxImage = nNewCount;
392 
394 }
#define max(a, b)
Definition: svc.c:63
HDC hdcBitmap
Definition: solcreate.cpp:11
INT cMaxImage
Definition: imagelist.c:58
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:79
UINT flags
Definition: imagelist.c:63
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:416
int32_t INT
Definition: typedefs.h:56
HBITMAP hbmImage
Definition: imagelist.c:68
static void imagelist_get_bitmap_size(HIMAGELIST himl, UINT count, SIZE *sz)
Definition: imagelist.c:157
static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count)
Definition: imagelist.c:3224
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
HBITMAP hbmMask
Definition: imagelist.c:69
INT cCurImage
Definition: imagelist.c:57
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#define ILC_MASK
Definition: commctrl.h:336
static HBITMAP
Definition: imagelist.c:69
#define ERR(fmt,...)
Definition: debug.h:109
BOOL WINAPI DeleteDC(_In_ HDC)
#define HeapReAlloc
Definition: compat.h:393
HDC hdcMask
Definition: imagelist.c:71
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HDC hdcImage
Definition: imagelist.c:70
INT cGrow
Definition: imagelist.c:59
LONG cy
Definition: windef.h:320
#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 2062 of file imagelist.c.

2064 {
2065  HIMAGELIST himl;
2066  LPWSTR lpbmpW;
2067  DWORD len;
2068 
2069  if (IS_INTRESOURCE(lpbmp))
2070  return ImageList_LoadImageW(hi, (LPCWSTR)lpbmp, cx, cGrow, clrMask,
2071  uType, uFlags);
2072 
2073  len = MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, NULL, 0);
2074  lpbmpW = heap_alloc(len * sizeof(WCHAR));
2075  MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, lpbmpW, len);
2076 
2077  himl = ImageList_LoadImageW(hi, lpbmpW, cx, cGrow, clrMask, uType, uFlags);
2078  heap_free (lpbmpW);
2079  return himl;
2080 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CP_ACP
Definition: compat.h:99
UINT uFlags
Definition: api.c:60
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:2106
_Out_opt_ int * cx
Definition: commctrl.h:570
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 2106 of file imagelist.c.

2108 {
2109  HIMAGELIST himl = NULL;
2110  HANDLE handle;
2111  INT nImageCount;
2112 
2113  handle = LoadImageW (hi, lpbmp, uType, 0, 0, uFlags);
2114  if (!handle) {
2115  WARN("Couldn't load image\n");
2116  return NULL;
2117  }
2118 
2119  if (uType == IMAGE_BITMAP) {
2120  DIBSECTION dib;
2121  UINT color;
2122 
2123  if (GetObjectW (handle, sizeof(dib), &dib) == sizeof(BITMAP)) color = ILC_COLOR;
2124  else color = dib.dsBm.bmBitsPixel;
2125 
2126  /* To match windows behavior, if cx is set to zero and
2127  the flag DI_DEFAULTSIZE is specified, cx becomes the
2128  system metric value for icons. If the flag is not specified
2129  the function sets the size to the height of the bitmap */
2130  if (cx == 0)
2131  {
2132  if (uFlags & DI_DEFAULTSIZE)
2134  else
2135  cx = dib.dsBm.bmHeight;
2136  }
2137 
2138  nImageCount = dib.dsBm.bmWidth / cx;
2139 
2140  if (clrMask != CLR_NONE) color |= ILC_MASK;
2141  himl = ImageList_Create (cx, dib.dsBm.bmHeight, color, nImageCount, cGrow);
2142  if (!himl) {
2143  DeleteObject (handle);
2144  return NULL;
2145  }
2146  ImageList_AddMasked (himl, handle, clrMask);
2147  }
2148  else if ((uType == IMAGE_ICON) || (uType == IMAGE_CURSOR)) {
2149  ICONINFO ii;
2150  BITMAP bmp;
2151 
2152  GetIconInfo (handle, &ii);
2153  GetObjectW (ii.hbmColor, sizeof(BITMAP), &bmp);
2154  himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight,
2155  ILC_MASK | ILC_COLOR, 1, cGrow);
2156  if (!himl) {
2157  DeleteObject (ii.hbmColor);
2158  DeleteObject (ii.hbmMask);
2159  DeleteObject (handle);
2160  return NULL;
2161  }
2162  ImageList_Add (himl, ii.hbmColor, ii.hbmMask);
2163  DeleteObject (ii.hbmColor);
2164  DeleteObject (ii.hbmMask);
2165  }
2166 
2167  DeleteObject (handle);
2168 
2169  return himl;
2170 }
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:413
#define IMAGE_CURSOR
Definition: winuser.h:213
#define WARN(fmt,...)
Definition: debug.h:111
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT uFlags
Definition: api.c:60
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:769
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:3079
#define ILC_COLOR
Definition: commctrl.h:337
#define SM_CXICON
Definition: winuser.h:962
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hbmColor
Definition: winuser.h:3080
#define DI_DEFAULTSIZE
Definition: wingdi.h:69
#define CLR_NONE
Definition: commctrl.h:304
int WINAPI GetSystemMetrics(_In_ int)
BITMAP bmp
Definition: alphablend.c:62
#define ILC_MASK
Definition: commctrl.h:336
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:570
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:528

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 2198 of file imagelist.c.

2200 {
2201  HIMAGELIST himlDst = NULL;
2202  INT cxDst, cyDst;
2203  INT xOff1, yOff1, xOff2, yOff2;
2204  POINT pt1, pt2;
2205  INT newFlags;
2206 
2207  TRACE("(himl1=%p i1=%d himl2=%p i2=%d dx=%d dy=%d)\n", himl1, i1, himl2,
2208  i2, dx, dy);
2209 
2210  if (!is_valid(himl1) || !is_valid(himl2))
2211  return NULL;
2212 
2213  if (dx > 0) {
2214  cxDst = max (himl1->cx, dx + himl2->cx);
2215  xOff1 = 0;
2216  xOff2 = dx;
2217  }
2218  else if (dx < 0) {
2219  cxDst = max (himl2->cx, himl1->cx - dx);
2220  xOff1 = -dx;
2221  xOff2 = 0;
2222  }
2223  else {
2224  cxDst = max (himl1->cx, himl2->cx);
2225  xOff1 = 0;
2226  xOff2 = 0;
2227  }
2228 
2229  if (dy > 0) {
2230  cyDst = max (himl1->cy, dy + himl2->cy);
2231  yOff1 = 0;
2232  yOff2 = dy;
2233  }
2234  else if (dy < 0) {
2235  cyDst = max (himl2->cy, himl1->cy - dy);
2236  yOff1 = -dy;
2237  yOff2 = 0;
2238  }
2239  else {
2240  cyDst = max (himl1->cy, himl2->cy);
2241  yOff1 = 0;
2242  yOff2 = 0;
2243  }
2244 
2245  newFlags = (himl1->flags > himl2->flags ? himl1->flags : himl2->flags) & ILC_COLORDDB;
2246  if (newFlags == ILC_COLORDDB && (himl1->flags & ILC_COLORDDB) == ILC_COLOR16)
2247  newFlags = ILC_COLOR16; /* this is what native (at least v5) does, don't know why */
2248  himlDst = ImageList_Create (cxDst, cyDst, ILC_MASK | newFlags, 1, 1);
2249 
2250  if (himlDst)
2251  {
2252  imagelist_point_from_index( himl1, i1, &pt1 );
2253  imagelist_point_from_index( himl2, i2, &pt2 );
2254 
2255  /* copy image */
2256  BitBlt (himlDst->hdcImage, 0, 0, cxDst, cyDst, himl1->hdcImage, 0, 0, BLACKNESS);
2257  if (i1 >= 0 && i1 < himl1->cCurImage)
2258  BitBlt (himlDst->hdcImage, xOff1, yOff1, himl1->cx, himl1->cy, himl1->hdcImage, pt1.x, pt1.y, SRCCOPY);
2259  if (i2 >= 0 && i2 < himl2->cCurImage)
2260  {
2261  if (himl2->flags & ILC_MASK)
2262  {
2263  BitBlt (himlDst->hdcImage, xOff2, yOff2, himl2->cx, himl2->cy, himl2->hdcMask , pt2.x, pt2.y, SRCAND);
2264  BitBlt (himlDst->hdcImage, xOff2, yOff2, himl2->cx, himl2->cy, himl2->hdcImage, pt2.x, pt2.y, SRCPAINT);
2265  }
2266  else
2267  BitBlt (himlDst->hdcImage, xOff2, yOff2, himl2->cx, himl2->cy, himl2->hdcImage, pt2.x, pt2.y, SRCCOPY);
2268  }
2269 
2270  /* copy mask */
2271  BitBlt (himlDst->hdcMask, 0, 0, cxDst, cyDst, himl1->hdcMask, 0, 0, WHITENESS);
2272  if (i1 >= 0 && i1 < himl1->cCurImage)
2273  BitBlt (himlDst->hdcMask, xOff1, yOff1, himl1->cx, himl1->cy, himl1->hdcMask, pt1.x, pt1.y, SRCCOPY);
2274  if (i2 >= 0 && i2 < himl2->cCurImage)
2275  BitBlt (himlDst->hdcMask, xOff2, yOff2, himl2->cx, himl2->cy, himl2->hdcMask, pt2.x, pt2.y, SRCAND);
2276 
2277  himlDst->cCurImage = 1;
2278  }
2279 
2280  return himlDst;
2281 }
#define SRCPAINT
Definition: wingdi.h:333
#define ILC_COLOR16
Definition: commctrl.h:341
#define max(a, b)
Definition: svc.c:63
static void imagelist_point_from_index(HIMAGELIST himl, UINT index, LPPOINT pt)
Definition: imagelist.c:151
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
static BOOL is_valid(HIMAGELIST himl)
Definition: imagelist.c:3877
GLint dy
Definition: linetemp.h:97
UINT flags
Definition: imagelist.c:63
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:416
int32_t INT
Definition: typedefs.h:56
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:769
smooth NULL
Definition: ftsmooth.c:416
INT cCurImage
Definition: imagelist.c:57
#define TRACE(s)
Definition: solgame.cpp:4