4 * Copyright 1993 Alexandre Julliard
11 #include "wine/winbase16.h"
17 #include "cursoricon.h"
18 #include "debugtools.h"
20 #include "wine/winuser16.h"
22 DECLARE_DEBUG_CHANNEL(bitmap)
23 DECLARE_DEBUG_CHANNEL(resource)
25 BITMAP_DRIVER *BITMAP_Driver = NULL;
28 /***********************************************************************
29 * BITMAP_GetWidthBytes
31 * Return number of bytes taken by a scanline of 16-bit aligned Windows DDB
34 INT BITMAP_GetWidthBytes( INT bmWidth, INT bpp )
39 return 2 * ((bmWidth+15) >> 4);
42 bmWidth *= 3; /* fall through */
44 return bmWidth + (bmWidth & 1);
54 return 2 * ((bmWidth+3) >> 2);
57 WARN_(bitmap)("Unknown depth %d, please report.\n", bpp );
62 /***********************************************************************
63 * CreateUserBitmap16 (GDI.407)
65 HBITMAP16 WINAPI CreateUserBitmap16( INT16 width, INT16 height, UINT16 planes,
66 UINT16 bpp, LPCVOID bits )
68 return CreateBitmap16( width, height, planes, bpp, bits );
71 /***********************************************************************
72 * CreateUserDiscardableBitmap16 (GDI.409)
74 HBITMAP16 WINAPI CreateUserDiscardableBitmap16( WORD dummy,
75 INT16 width, INT16 height )
77 return CreateUserBitmap16( width, height, 1, MONITOR_GetDepth(&MONITOR_PrimaryMonitor), NULL );
81 /***********************************************************************
82 * CreateBitmap16 (GDI.48)
84 HBITMAP16 WINAPI CreateBitmap16( INT16 width, INT16 height, UINT16 planes,
85 UINT16 bpp, LPCVOID bits )
87 return CreateBitmap( width, height, planes, bpp, bits );
91 /******************************************************************************
92 * CreateBitmap32 [GDI32.25] Creates a bitmap with the specified info
95 * width [I] bitmap width
96 * height [I] bitmap height
97 * planes [I] Number of color planes
98 * bpp [I] Number of bits to identify a color
99 * bits [I] Pointer to array containing color data
102 * Success: Handle to bitmap
105 HBITMAP WINAPI CreateBitmap( INT width, INT height, UINT planes,
106 UINT bpp, LPCVOID bits )
111 planes = (BYTE)planes;
115 /* Check parameters */
116 if (!height || !width) return 0;
118 FIXME_(bitmap)("planes = %d\n", planes);
121 if (height < 0) height = -height;
122 if (width < 0) width = -width;
124 /* Create the BITMAPOBJ */
125 hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC );
126 if (!hbitmap) return 0;
128 TRACE_(bitmap)("%dx%d, %d colors returning %08x\n", width, height,
129 1 << (planes*bpp), hbitmap);
131 bmp = (BITMAPOBJ *) GDI_HEAP_LOCK( hbitmap );
135 bmp->bitmap.bmType = 0;
136 bmp->bitmap.bmWidth = width;
137 bmp->bitmap.bmHeight = height;
138 bmp->bitmap.bmPlanes = planes;
139 bmp->bitmap.bmBitsPixel = bpp;
140 bmp->bitmap.bmWidthBytes = BITMAP_GetWidthBytes( width, bpp );
141 bmp->bitmap.bmBits = NULL;
143 bmp->DDBitmap = NULL;
146 if (bits) /* Set bitmap bits */
147 SetBitmapBits( hbitmap, height * bmp->bitmap.bmWidthBytes,
149 GDI_HEAP_UNLOCK( hbitmap );
154 /***********************************************************************
155 * CreateCompatibleBitmap16 (GDI.51)
157 HBITMAP16 WINAPI CreateCompatibleBitmap16(HDC16 hdc, INT16 width, INT16 height)
159 return CreateCompatibleBitmap( hdc, width, height );
163 /******************************************************************************
164 * CreateCompatibleBitmap32 [GDI32.30] Creates a bitmap compatible with the DC
167 * hdc [I] Handle to device context
168 * width [I] Width of bitmap
169 * height [I] Height of bitmap
172 * Success: Handle to bitmap
175 HBITMAP WINAPI CreateCompatibleBitmap( HDC hdc, INT width, INT height)
180 TRACE_(bitmap)("(%04x,%d,%d) = \n", hdc, width, height );
181 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
182 if ((width >= 0x10000) || (height >= 0x10000)) {
183 FIXME_(bitmap)("got bad width %d or height %d, please look for reason\n",
186 /* MS doc says if width or height is 0, return 1-by-1 pixel, monochrome bitmap */
187 if (!width || !height)
188 hbmpRet = CreateBitmap( 1, 1, 1, 1, NULL );
190 hbmpRet = CreateBitmap( width, height, 1, dc->w.bitsPerPixel, NULL );
191 if(dc->funcs->pCreateBitmap)
192 dc->funcs->pCreateBitmap( hbmpRet );
194 TRACE_(bitmap)("\t\t%04x\n", hbmpRet);
195 GDI_HEAP_UNLOCK(hdc);
200 /***********************************************************************
201 * CreateBitmapIndirect16 (GDI.49)
203 HBITMAP16 WINAPI CreateBitmapIndirect16( const BITMAP16 * bmp )
205 return CreateBitmap16( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
206 bmp->bmBitsPixel, PTR_SEG_TO_LIN( bmp->bmBits ) );
210 /******************************************************************************
211 * CreateBitmapIndirect32 [GDI32.26] Creates a bitmap with the specifies info
214 * Success: Handle to bitmap
217 HBITMAP WINAPI CreateBitmapIndirect(
218 const BITMAP * bmp) /* [in] Pointer to the bitmap data */
220 return CreateBitmap( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
221 bmp->bmBitsPixel, bmp->bmBits );
225 /***********************************************************************
226 * GetBitmapBits16 (GDI.74)
228 LONG WINAPI GetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPVOID buffer )
230 return GetBitmapBits( hbitmap, count, buffer );
234 /***********************************************************************
235 * GetBitmapBits32 [GDI32.143] Copies bitmap bits of bitmap to buffer
238 * Success: Number of bytes copied
241 LONG WINAPI GetBitmapBits(
242 HBITMAP hbitmap, /* [in] Handle to bitmap */
243 LONG count, /* [in] Number of bytes to copy */
244 LPVOID bits) /* [out] Pointer to buffer to receive bits */
246 BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
251 /* If the bits vector is null, the function should return the read size */
253 return bmp->bitmap.bmWidthBytes * bmp->bitmap.bmHeight;
256 WARN_(bitmap)("(%ld): Negative number of bytes passed???\n", count );
260 /* Only get entire lines */
261 height = count / bmp->bitmap.bmWidthBytes;
262 if (height > bmp->bitmap.bmHeight) height = bmp->bitmap.bmHeight;
263 count = height * bmp->bitmap.bmWidthBytes;
266 WARN_(bitmap)("Less then one entire line requested\n");
267 GDI_HEAP_UNLOCK( hbitmap );
272 TRACE_(bitmap)("(%08x, %ld, %p) %dx%d %d colors fetched height: %ld\n",
273 hbitmap, count, bits, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
274 1 << bmp->bitmap.bmBitsPixel, height );
278 TRACE_(bitmap)("Calling device specific BitmapBits\n");
279 if(bmp->DDBitmap->funcs->pBitmapBits)
280 ret = bmp->DDBitmap->funcs->pBitmapBits(hbitmap, bits, count,
283 ERR_(bitmap)("BitmapBits == NULL??\n");
289 if(!bmp->bitmap.bmBits) {
290 WARN_(bitmap)("Bitmap is empty\n");
293 memcpy(bits, bmp->bitmap.bmBits, count);
299 GDI_HEAP_UNLOCK( hbitmap );
304 /***********************************************************************
305 * SetBitmapBits16 (GDI.106)
307 LONG WINAPI SetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPCVOID buffer )
309 return SetBitmapBits( hbitmap, count, buffer );
313 /******************************************************************************
314 * SetBitmapBits32 [GDI32.303] Sets bits of color data for a bitmap
317 * Success: Number of bytes used in setting the bitmap bits
320 LONG WINAPI SetBitmapBits(
321 HBITMAP hbitmap, /* [in] Handle to bitmap */
322 LONG count, /* [in] Number of bytes in bitmap array */
323 LPCVOID bits) /* [in] Address of array with bitmap bits */
325 BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
328 if ((!bmp) || (!bits))
332 WARN_(bitmap)("(%ld): Negative number of bytes passed???\n", count );
336 /* Only get entire lines */
337 height = count / bmp->bitmap.bmWidthBytes;
338 if (height > bmp->bitmap.bmHeight) height = bmp->bitmap.bmHeight;
339 count = height * bmp->bitmap.bmWidthBytes;
341 TRACE_(bitmap)("(%08x, %ld, %p) %dx%d %d colors fetched height: %ld\n",
342 hbitmap, count, bits, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
343 1 << bmp->bitmap.bmBitsPixel, height );
347 TRACE_(bitmap)("Calling device specific BitmapBits\n");
348 if(bmp->DDBitmap->funcs->pBitmapBits)
349 ret = bmp->DDBitmap->funcs->pBitmapBits(hbitmap, (void *) bits,
352 ERR_(bitmap)("BitmapBits == NULL??\n");
358 if(!bmp->bitmap.bmBits) /* Alloc enough for entire bitmap */
359 bmp->bitmap.bmBits = HeapAlloc( GetProcessHeap(), 0, count );
360 if(!bmp->bitmap.bmBits) {
361 WARN_(bitmap)("Unable to allocate bit buffer\n");
364 memcpy(bmp->bitmap.bmBits, bits, count);
369 GDI_HEAP_UNLOCK( hbitmap );
373 /***********************************************************************
374 * LoadImage16 [USER.389]
377 HANDLE16 WINAPI LoadImage16( HINSTANCE16 hinst, LPCSTR name, UINT16 type,
378 INT16 desiredx, INT16 desiredy, UINT16 loadflags)
380 LPCSTR nameStr = HIWORD(name)? PTR_SEG_TO_LIN(name) : (LPCSTR)name;
381 return LoadImageA( hinst, nameStr, type,
382 desiredx, desiredy, loadflags );
385 /**********************************************************************
386 * LoadImageA (USER32.365)
388 * FIXME: implementation lacks some features, see LR_ defines in windows.h
391 HANDLE WINAPI LoadImageA( HINSTANCE hinst, LPCSTR name, UINT type,
392 INT desiredx, INT desiredy, UINT loadflags)
397 if (HIWORD(name)) u_name = HEAP_strdupAtoW(GetProcessHeap(), 0, name);
398 else u_name=(LPWSTR)name;
399 res = LoadImageW(hinst, u_name, type, desiredx, desiredy, loadflags);
400 if (HIWORD(name)) HeapFree(GetProcessHeap(), 0, u_name);
405 /******************************************************************************
406 * LoadImageW [USER32.366] Loads an icon, cursor, or bitmap
409 * hinst [I] Handle of instance that contains image
410 * name [I] Name of image
411 * type [I] Type of image
412 * desiredx [I] Desired width
413 * desiredy [I] Desired height
414 * loadflags [I] Load flags
417 * Success: Handle to newly loaded image
420 * FIXME: Implementation lacks some features, see LR_ defines in windows.h
422 HANDLE WINAPI LoadImageW( HINSTANCE hinst, LPCWSTR name, UINT type,
423 INT desiredx, INT desiredy, UINT loadflags )
426 TRACE_(resource)("(0x%04x,%p,%d,%d,%d,0x%08x)\n",
427 hinst,name,type,desiredx,desiredy,loadflags);
429 TRACE_(resource)("(0x%04x,%p,%d,%d,%d,0x%08x)\n",
430 hinst,name,type,desiredx,desiredy,loadflags);
432 if (loadflags & LR_DEFAULTSIZE) {
433 if (type == IMAGE_ICON) {
434 if (!desiredx) desiredx = GetSystemMetrics(SM_CXICON);
435 if (!desiredy) desiredy = GetSystemMetrics(SM_CYICON);
436 } else if (type == IMAGE_CURSOR) {
437 if (!desiredx) desiredx = GetSystemMetrics(SM_CXCURSOR);
438 if (!desiredy) desiredy = GetSystemMetrics(SM_CYCURSOR);
441 if (loadflags & LR_LOADFROMFILE) loadflags &= ~LR_SHARED;
444 return BITMAP_Load( hinst, name, loadflags );
449 UINT palEnts = GetSystemPaletteEntries(hdc, 0, 0, NULL);
454 return CURSORICON_Load(hinst, name, desiredx, desiredy,
455 palEnts, FALSE, loadflags);
459 return CURSORICON_Load(hinst, name, desiredx, desiredy,
466 /**********************************************************************
470 HBITMAP BITMAP_CopyBitmap(HBITMAP hbitmap)
472 BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
480 res = CreateBitmapIndirect(&bm);
483 char *buf = HeapAlloc( GetProcessHeap(), 0, bm.bmWidthBytes *
485 GetBitmapBits (hbitmap, bm.bmWidthBytes * bm.bmHeight, buf);
486 SetBitmapBits (res, bm.bmWidthBytes * bm.bmHeight, buf);
487 HeapFree( GetProcessHeap(), 0, buf );
490 GDI_HEAP_UNLOCK( hbitmap );
494 /******************************************************************************
495 * CopyImage16 [USER.390] Creates new image and copies attributes to it
498 HICON16 WINAPI CopyImage16( HANDLE16 hnd, UINT16 type, INT16 desiredx,
499 INT16 desiredy, UINT16 flags )
501 return (HICON16)CopyImage((HANDLE)hnd, (UINT)type, (INT)desiredx,
502 (INT)desiredy, (UINT)flags);
505 /******************************************************************************
506 * CopyImage32 [USER32.61] Creates new image and copies attributes to it
509 * hnd [I] Handle to image to copy
510 * type [I] Type of image to copy
511 * desiredx [I] Desired width of new image
512 * desiredy [I] Desired height of new image
513 * flags [I] Copy flags
516 * Success: Handle to newly created image
519 * FIXME: implementation still lacks nearly all features, see LR_*
520 * defines in windows.h
522 HICON WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx,
523 INT desiredy, UINT flags )
528 return BITMAP_CopyBitmap(hnd);
530 return CopyIcon(hnd);
532 return CopyCursor(hnd);
537 /**********************************************************************
540 HBITMAP BITMAP_Load( HINSTANCE instance,LPCWSTR name, UINT loadflags )
547 BITMAPINFO *info, *fix_info=NULL;
551 if (!(loadflags & LR_LOADFROMFILE)) {
552 if (!instance) /* OEM bitmap */
557 if (HIWORD((int)name)) return 0;
558 hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
559 dc = DC_GetDCPtr( hdc );
560 if(dc->funcs->pLoadOEMResource)
561 hbitmap = dc->funcs->pLoadOEMResource( LOWORD((int)name),
563 GDI_HEAP_UNLOCK( hdc );
568 if (!(hRsrc = FindResourceW( instance, name, RT_BITMAPW ))) return 0;
569 if (!(handle = LoadResource( instance, hRsrc ))) return 0;
571 if ((info = (BITMAPINFO *)LockResource( handle )) == NULL) return 0;
575 if (!(ptr = (char *)VIRTUAL_MapFileW( name ))) return 0;
576 info = (BITMAPINFO *)(ptr + sizeof(BITMAPFILEHEADER));
578 size = DIB_BitmapInfoSize(info, DIB_RGB_COLORS);
579 if ((hFix = GlobalAlloc(0, size))) fix_info=GlobalLock(hFix);
583 memcpy(fix_info, info, size);
584 pix = *((LPBYTE)info+DIB_BitmapInfoSize(info, DIB_RGB_COLORS));
585 DIB_FixColorsToLoadflags(fix_info, loadflags, pix);
586 if ((hdc = GetDC(0)) != 0) {
587 char *bits = (char *)info + size;
588 if (loadflags & LR_CREATEDIBSECTION) {
590 hbitmap = CreateDIBSection(hdc, fix_info, DIB_RGB_COLORS, NULL, 0, 0);
591 GetObjectA(hbitmap, sizeof(DIBSECTION), &dib);
592 SetDIBits(hdc, hbitmap, 0, dib.dsBm.bmHeight, bits, info,
596 hbitmap = CreateDIBitmap( hdc, &fix_info->bmiHeader, CBM_INIT,
597 bits, fix_info, DIB_RGB_COLORS );
604 if (loadflags & LR_LOADFROMFILE) UnmapViewOfFile( ptr );
609 /******************************************************************************
610 * LoadBitmapW [USER32.358] Loads bitmap from the executable file
613 * Success: Handle to specified bitmap
616 HBITMAP WINAPI LoadBitmapW(
617 HINSTANCE instance, /* [in] Handle to application instance */
618 LPCWSTR name) /* [in] Address of bitmap resource name */
620 return LoadImageW( instance, name, IMAGE_BITMAP, 0, 0, 0 );
623 /**********************************************************************
624 * LoadBitmapA (USER32.357)
626 HBITMAP WINAPI LoadBitmapA( HINSTANCE instance, LPCSTR name )
628 return LoadImageA( instance, name, IMAGE_BITMAP, 0, 0, 0 );
631 /**********************************************************************
632 * LoadBitmap16 (USER.175)
634 HBITMAP16 WINAPI LoadBitmap16( HINSTANCE16 instance, SEGPTR name )
636 LPCSTR nameStr = HIWORD(name)? PTR_SEG_TO_LIN(name) : (LPCSTR)name;
637 return LoadBitmapA( instance, nameStr );
642 /***********************************************************************
643 * BITMAP_DeleteObject
645 BOOL BITMAP_DeleteObject( HBITMAP16 hbitmap, BITMAPOBJ * bmp )
647 if( bmp->DDBitmap ) {
648 if( bmp->DDBitmap->funcs->pDeleteObject )
649 bmp->DDBitmap->funcs->pDeleteObject( hbitmap );
652 if( bmp->bitmap.bmBits )
653 HeapFree( GetProcessHeap(), 0, bmp->bitmap.bmBits );
655 DIB_DeleteDIBSection( bmp );
657 return GDI_FreeObject( hbitmap );
661 /***********************************************************************
664 INT16 BITMAP_GetObject16( BITMAPOBJ * bmp, INT16 count, LPVOID buffer )
668 if ( count <= sizeof(BITMAP16) )
670 BITMAP *bmp32 = &bmp->dib->dsBm;
672 bmp16.bmType = bmp32->bmType;
673 bmp16.bmWidth = bmp32->bmWidth;
674 bmp16.bmHeight = bmp32->bmHeight;
675 bmp16.bmWidthBytes = bmp32->bmWidthBytes;
676 bmp16.bmPlanes = bmp32->bmPlanes;
677 bmp16.bmBitsPixel = bmp32->bmBitsPixel;
678 bmp16.bmBits = (SEGPTR)0;
679 memcpy( buffer, &bmp16, count );
684 FIXME_(bitmap)("not implemented for DIBs: count %d\n", count);
691 bmp16.bmType = bmp->bitmap.bmType;
692 bmp16.bmWidth = bmp->bitmap.bmWidth;
693 bmp16.bmHeight = bmp->bitmap.bmHeight;
694 bmp16.bmWidthBytes = bmp->bitmap.bmWidthBytes;
695 bmp16.bmPlanes = bmp->bitmap.bmPlanes;
696 bmp16.bmBitsPixel = bmp->bitmap.bmBitsPixel;
697 bmp16.bmBits = (SEGPTR)0;
698 if (count > sizeof(bmp16)) count = sizeof(bmp16);
699 memcpy( buffer, &bmp16, count );
705 /***********************************************************************
708 INT BITMAP_GetObject( BITMAPOBJ * bmp, INT count, LPVOID buffer )
712 if (count < sizeof(DIBSECTION))
714 if (count > sizeof(BITMAP)) count = sizeof(BITMAP);
718 if (count > sizeof(DIBSECTION)) count = sizeof(DIBSECTION);
721 memcpy( buffer, bmp->dib, count );
726 if (count > sizeof(BITMAP)) count = sizeof(BITMAP);
727 memcpy( buffer, &bmp->bitmap, count );
733 /***********************************************************************
734 * CreateDiscardableBitmap16 (GDI.156)
736 HBITMAP16 WINAPI CreateDiscardableBitmap16( HDC16 hdc, INT16 width,
739 return CreateCompatibleBitmap16( hdc, width, height );
743 /******************************************************************************
744 * CreateDiscardableBitmap32 [GDI32.38] Creates a discardable bitmap
747 * Success: Handle to bitmap
750 HBITMAP WINAPI CreateDiscardableBitmap(
751 HDC hdc, /* [in] Handle to device context */
752 INT width, /* [in] Bitmap width */
753 INT height) /* [in] Bitmap height */
755 return CreateCompatibleBitmap( hdc, width, height );
759 /***********************************************************************
760 * GetBitmapDimensionEx16 (GDI.468)
763 * Can this call GetBitmapDimensionEx32?
765 BOOL16 WINAPI GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size )
767 BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
768 if (!bmp) return FALSE;
769 CONV_SIZE32TO16( &bmp->size, size );
770 GDI_HEAP_UNLOCK( hbitmap );
775 /******************************************************************************
776 * GetBitmapDimensionEx32 [GDI32.144] Retrieves dimensions of a bitmap
782 BOOL WINAPI GetBitmapDimensionEx(
783 HBITMAP hbitmap, /* [in] Handle to bitmap */
784 LPSIZE size) /* [out] Address of struct receiving dimensions */
786 BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
787 if (!bmp) return FALSE;
789 GDI_HEAP_UNLOCK( hbitmap );
794 /***********************************************************************
795 * GetBitmapDimension (GDI.162)
797 DWORD WINAPI GetBitmapDimension16( HBITMAP16 hbitmap )
800 if (!GetBitmapDimensionEx16( hbitmap, &size )) return 0;
801 return MAKELONG( size.cx, size.cy );
805 /***********************************************************************
806 * SetBitmapDimensionEx16 (GDI.478)
808 BOOL16 WINAPI SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y,
811 BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
812 if (!bmp) return FALSE;
813 if (prevSize) CONV_SIZE32TO16( &bmp->size, prevSize );
816 GDI_HEAP_UNLOCK( hbitmap );
821 /******************************************************************************
822 * SetBitmapDimensionEx32 [GDI32.304] Assignes dimensions to a bitmap
828 BOOL WINAPI SetBitmapDimensionEx(
829 HBITMAP hbitmap, /* [in] Handle to bitmap */
830 INT x, /* [in] Bitmap width */
831 INT y, /* [in] Bitmap height */
832 LPSIZE prevSize) /* [out] Address of structure for orig dims */
834 BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
835 if (!bmp) return FALSE;
836 if (prevSize) *prevSize = bmp->size;
839 GDI_HEAP_UNLOCK( hbitmap );
844 /***********************************************************************
845 * SetBitmapDimension (GDI.163)
847 DWORD WINAPI SetBitmapDimension16( HBITMAP16 hbitmap, INT16 x, INT16 y )
850 if (!SetBitmapDimensionEx16( hbitmap, x, y, &size )) return 0;
851 return MAKELONG( size.cx, size.cy );