4 * Copyright 1993 Alexandre Julliard
11 #include "wine/winbase16.h"
17 #include "sysmetrics.h"
18 #include "cursoricon.h"
19 #include "debugtools.h"
21 #include "wine/winuser16.h"
23 DECLARE_DEBUG_CHANNEL(bitmap
)
24 DECLARE_DEBUG_CHANNEL(resource
)
26 BITMAP_DRIVER
*BITMAP_Driver
= NULL
;
29 /***********************************************************************
30 * BITMAP_GetWidthBytes
32 * Return number of bytes taken by a scanline of 16-bit aligned Windows DDB
35 INT
BITMAP_GetWidthBytes( INT bmWidth
, INT bpp
)
40 return 2 * ((bmWidth
+15) >> 4);
43 bmWidth
*= 3; /* fall through */
45 return bmWidth
+ (bmWidth
& 1);
55 return 2 * ((bmWidth
+3) >> 2);
58 WARN_(bitmap
)("Unknown depth %d, please report.\n", bpp
);
63 /***********************************************************************
64 * CreateUserBitmap16 (GDI.407)
66 HBITMAP16 WINAPI
CreateUserBitmap16( INT16 width
, INT16 height
, UINT16 planes
,
67 UINT16 bpp
, LPCVOID bits
)
69 return CreateBitmap16( width
, height
, planes
, bpp
, bits
);
72 /***********************************************************************
73 * CreateUserDiscardableBitmap16 (GDI.409)
75 HBITMAP16 WINAPI
CreateUserDiscardableBitmap16( WORD dummy
,
76 INT16 width
, INT16 height
)
78 return CreateUserBitmap16( width
, height
, 1, MONITOR_GetDepth(&MONITOR_PrimaryMonitor
), NULL
);
82 /***********************************************************************
83 * CreateBitmap16 (GDI.48)
85 HBITMAP16 WINAPI
CreateBitmap16( INT16 width
, INT16 height
, UINT16 planes
,
86 UINT16 bpp
, LPCVOID bits
)
88 return CreateBitmap( width
, height
, planes
, bpp
, bits
);
92 /******************************************************************************
93 * CreateBitmap32 [GDI32.25] Creates a bitmap with the specified info
96 * width [I] bitmap width
97 * height [I] bitmap height
98 * planes [I] Number of color planes
99 * bpp [I] Number of bits to identify a color
100 * bits [I] Pointer to array containing color data
103 * Success: Handle to bitmap
106 HBITMAP WINAPI
CreateBitmap( INT width
, INT height
, UINT planes
,
107 UINT bpp
, LPCVOID bits
)
112 planes
= (BYTE
)planes
;
116 /* Check parameters */
117 if (!height
|| !width
) return 0;
119 FIXME_(bitmap
)("planes = %d\n", planes
);
122 if (height
< 0) height
= -height
;
123 if (width
< 0) width
= -width
;
125 /* Create the BITMAPOBJ */
126 hbitmap
= GDI_AllocObject( sizeof(BITMAPOBJ
), BITMAP_MAGIC
);
127 if (!hbitmap
) return 0;
129 TRACE_(bitmap
)("%dx%d, %d colors returning %08x\n", width
, height
,
130 1 << (planes
*bpp
), hbitmap
);
132 bmp
= (BITMAPOBJ
*) GDI_HEAP_LOCK( hbitmap
);
136 bmp
->bitmap
.bmType
= 0;
137 bmp
->bitmap
.bmWidth
= width
;
138 bmp
->bitmap
.bmHeight
= height
;
139 bmp
->bitmap
.bmPlanes
= planes
;
140 bmp
->bitmap
.bmBitsPixel
= bpp
;
141 bmp
->bitmap
.bmWidthBytes
= BITMAP_GetWidthBytes( width
, bpp
);
142 bmp
->bitmap
.bmBits
= NULL
;
144 bmp
->DDBitmap
= NULL
;
147 if (bits
) /* Set bitmap bits */
148 SetBitmapBits( hbitmap
, height
* bmp
->bitmap
.bmWidthBytes
,
150 GDI_HEAP_UNLOCK( hbitmap
);
155 /***********************************************************************
156 * CreateCompatibleBitmap16 (GDI.51)
158 HBITMAP16 WINAPI
CreateCompatibleBitmap16(HDC16 hdc
, INT16 width
, INT16 height
)
160 return CreateCompatibleBitmap( hdc
, width
, height
);
164 /******************************************************************************
165 * CreateCompatibleBitmap32 [GDI32.30] Creates a bitmap compatible with the DC
168 * hdc [I] Handle to device context
169 * width [I] Width of bitmap
170 * height [I] Height of bitmap
173 * Success: Handle to bitmap
176 HBITMAP WINAPI
CreateCompatibleBitmap( HDC hdc
, INT width
, INT height
)
181 TRACE_(bitmap
)("(%04x,%d,%d) = \n", hdc
, width
, height
);
182 if (!(dc
= DC_GetDCPtr( hdc
))) return 0;
183 if ((width
>= 0x10000) || (height
>= 0x10000)) {
184 FIXME_(bitmap
)("got bad width %d or height %d, please look for reason\n",
187 hbmpRet
= CreateBitmap( width
, height
, 1, dc
->w
.bitsPerPixel
, NULL
);
188 if(dc
->funcs
->pCreateBitmap
)
189 dc
->funcs
->pCreateBitmap( hbmpRet
);
191 TRACE_(bitmap
)("\t\t%04x\n", hbmpRet
);
192 GDI_HEAP_UNLOCK(hdc
);
197 /***********************************************************************
198 * CreateBitmapIndirect16 (GDI.49)
200 HBITMAP16 WINAPI
CreateBitmapIndirect16( const BITMAP16
* bmp
)
202 return CreateBitmap16( bmp
->bmWidth
, bmp
->bmHeight
, bmp
->bmPlanes
,
203 bmp
->bmBitsPixel
, PTR_SEG_TO_LIN( bmp
->bmBits
) );
207 /******************************************************************************
208 * CreateBitmapIndirect32 [GDI32.26] Creates a bitmap with the specifies info
211 * Success: Handle to bitmap
214 HBITMAP WINAPI
CreateBitmapIndirect(
215 const BITMAP
* bmp
) /* [in] Pointer to the bitmap data */
217 return CreateBitmap( bmp
->bmWidth
, bmp
->bmHeight
, bmp
->bmPlanes
,
218 bmp
->bmBitsPixel
, bmp
->bmBits
);
222 /***********************************************************************
223 * GetBitmapBits16 (GDI.74)
225 LONG WINAPI
GetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPVOID buffer
)
227 return GetBitmapBits( hbitmap
, count
, buffer
);
231 /***********************************************************************
232 * GetBitmapBits32 [GDI32.143] Copies bitmap bits of bitmap to buffer
235 * Success: Number of bytes copied
238 LONG WINAPI
GetBitmapBits(
239 HBITMAP hbitmap
, /* [in] Handle to bitmap */
240 LONG count
, /* [in] Number of bytes to copy */
241 LPVOID bits
) /* [out] Pointer to buffer to receive bits */
243 BITMAPOBJ
*bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
249 WARN_(bitmap
)("(%ld): Negative number of bytes passed???\n", count
);
253 /* Only get entire lines */
254 height
= count
/ bmp
->bitmap
.bmWidthBytes
;
255 if (height
> bmp
->bitmap
.bmHeight
) height
= bmp
->bitmap
.bmHeight
;
256 count
= height
* bmp
->bitmap
.bmWidthBytes
;
259 WARN_(bitmap
)("Less then one entire line requested\n");
260 GDI_HEAP_UNLOCK( hbitmap
);
265 TRACE_(bitmap
)("(%08x, %ld, %p) %dx%d %d colors fetched height: %ld\n",
266 hbitmap
, count
, bits
, bmp
->bitmap
.bmWidth
, bmp
->bitmap
.bmHeight
,
267 1 << bmp
->bitmap
.bmBitsPixel
, height
);
271 TRACE_(bitmap
)("Calling device specific BitmapBits\n");
272 if(bmp
->DDBitmap
->funcs
->pBitmapBits
)
273 ret
= bmp
->DDBitmap
->funcs
->pBitmapBits(hbitmap
, bits
, count
,
276 ERR_(bitmap
)("BitmapBits == NULL??\n");
282 if(!bmp
->bitmap
.bmBits
) {
283 WARN_(bitmap
)("Bitmap is empty\n");
286 memcpy(bits
, bmp
->bitmap
.bmBits
, count
);
292 GDI_HEAP_UNLOCK( hbitmap
);
297 /***********************************************************************
298 * SetBitmapBits16 (GDI.106)
300 LONG WINAPI
SetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPCVOID buffer
)
302 return SetBitmapBits( hbitmap
, count
, buffer
);
306 /******************************************************************************
307 * SetBitmapBits32 [GDI32.303] Sets bits of color data for a bitmap
310 * Success: Number of bytes used in setting the bitmap bits
313 LONG WINAPI
SetBitmapBits(
314 HBITMAP hbitmap
, /* [in] Handle to bitmap */
315 LONG count
, /* [in] Number of bytes in bitmap array */
316 LPCVOID bits
) /* [in] Address of array with bitmap bits */
318 BITMAPOBJ
*bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
324 WARN_(bitmap
)("(%ld): Negative number of bytes passed???\n", count
);
328 /* Only get entire lines */
329 height
= count
/ bmp
->bitmap
.bmWidthBytes
;
330 if (height
> bmp
->bitmap
.bmHeight
) height
= bmp
->bitmap
.bmHeight
;
331 count
= height
* bmp
->bitmap
.bmWidthBytes
;
333 TRACE_(bitmap
)("(%08x, %ld, %p) %dx%d %d colors fetched height: %ld\n",
334 hbitmap
, count
, bits
, bmp
->bitmap
.bmWidth
, bmp
->bitmap
.bmHeight
,
335 1 << bmp
->bitmap
.bmBitsPixel
, height
);
339 TRACE_(bitmap
)("Calling device specific BitmapBits\n");
340 if(bmp
->DDBitmap
->funcs
->pBitmapBits
)
341 ret
= bmp
->DDBitmap
->funcs
->pBitmapBits(hbitmap
, (void *) bits
,
344 ERR_(bitmap
)("BitmapBits == NULL??\n");
350 if(!bmp
->bitmap
.bmBits
) /* Alloc enough for entire bitmap */
351 bmp
->bitmap
.bmBits
= HeapAlloc( GetProcessHeap(), 0, count
);
352 if(!bmp
->bitmap
.bmBits
) {
353 WARN_(bitmap
)("Unable to allocate bit buffer\n");
356 memcpy(bmp
->bitmap
.bmBits
, bits
, count
);
361 GDI_HEAP_UNLOCK( hbitmap
);
365 /***********************************************************************
366 * LoadImage16 [USER.389]
369 HANDLE16 WINAPI
LoadImage16( HINSTANCE16 hinst
, LPCSTR name
, UINT16 type
,
370 INT16 desiredx
, INT16 desiredy
, UINT16 loadflags
)
372 LPCSTR nameStr
= HIWORD(name
)? PTR_SEG_TO_LIN(name
) : (LPCSTR
)name
;
373 return LoadImageA( hinst
, nameStr
, type
,
374 desiredx
, desiredy
, loadflags
);
377 /**********************************************************************
378 * LoadImageA (USER32.365)
380 * FIXME: implementation lacks some features, see LR_ defines in windows.h
383 HANDLE WINAPI
LoadImageA( HINSTANCE hinst
, LPCSTR name
, UINT type
,
384 INT desiredx
, INT desiredy
, UINT loadflags
)
389 if (HIWORD(name
)) u_name
= HEAP_strdupAtoW(GetProcessHeap(), 0, name
);
390 else u_name
=(LPWSTR
)name
;
391 res
= LoadImageW(hinst
, u_name
, type
, desiredx
, desiredy
, loadflags
);
392 if (HIWORD(name
)) HeapFree(GetProcessHeap(), 0, u_name
);
397 /******************************************************************************
398 * LoadImageW [USER32.366] Loads an icon, cursor, or bitmap
401 * hinst [I] Handle of instance that contains image
402 * name [I] Name of image
403 * type [I] Type of image
404 * desiredx [I] Desired width
405 * desiredy [I] Desired height
406 * loadflags [I] Load flags
409 * Success: Handle to newly loaded image
412 * FIXME: Implementation lacks some features, see LR_ defines in windows.h
414 HANDLE WINAPI
LoadImageW( HINSTANCE hinst
, LPCWSTR name
, UINT type
,
415 INT desiredx
, INT desiredy
, UINT loadflags
)
418 TRACE_(resource
)("(0x%04x,%p,%d,%d,%d,0x%08x)\n",
419 hinst
,name
,type
,desiredx
,desiredy
,loadflags
);
421 TRACE_(resource
)("(0x%04x,%p,%d,%d,%d,0x%08x)\n",
422 hinst
,name
,type
,desiredx
,desiredy
,loadflags
);
424 if (loadflags
& LR_DEFAULTSIZE
) {
425 if (type
== IMAGE_ICON
) {
426 if (!desiredx
) desiredx
= SYSMETRICS_CXICON
;
427 if (!desiredy
) desiredy
= SYSMETRICS_CYICON
;
428 } else if (type
== IMAGE_CURSOR
) {
429 if (!desiredx
) desiredx
= SYSMETRICS_CXCURSOR
;
430 if (!desiredy
) desiredy
= SYSMETRICS_CYCURSOR
;
433 if (loadflags
& LR_LOADFROMFILE
) loadflags
&= ~LR_SHARED
;
436 return BITMAP_Load( hinst
, name
, loadflags
);
441 UINT palEnts
= GetSystemPaletteEntries(hdc
, 0, 0, NULL
);
446 return CURSORICON_Load(hinst
, name
, desiredx
, desiredy
,
447 palEnts
, FALSE
, loadflags
);
451 return CURSORICON_Load(hinst
, name
, desiredx
, desiredy
,
458 /**********************************************************************
462 HBITMAP
BITMAP_CopyBitmap(HBITMAP hbitmap
)
464 BITMAPOBJ
*bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
472 res
= CreateBitmapIndirect(&bm
);
475 char *buf
= HeapAlloc( GetProcessHeap(), 0, bm
.bmWidthBytes
*
477 GetBitmapBits (hbitmap
, bm
.bmWidthBytes
* bm
.bmHeight
, buf
);
478 SetBitmapBits (res
, bm
.bmWidthBytes
* bm
.bmHeight
, buf
);
479 HeapFree( GetProcessHeap(), 0, buf
);
482 GDI_HEAP_UNLOCK( hbitmap
);
486 /******************************************************************************
487 * CopyImage16 [USER.390] Creates new image and copies attributes to it
490 HICON16 WINAPI
CopyImage16( HANDLE16 hnd
, UINT16 type
, INT16 desiredx
,
491 INT16 desiredy
, UINT16 flags
)
493 return (HICON16
)CopyImage((HANDLE
)hnd
, (UINT
)type
, (INT
)desiredx
,
494 (INT
)desiredy
, (UINT
)flags
);
497 /******************************************************************************
498 * CopyImage32 [USER32.61] Creates new image and copies attributes to it
501 * hnd [I] Handle to image to copy
502 * type [I] Type of image to copy
503 * desiredx [I] Desired width of new image
504 * desiredy [I] Desired height of new image
505 * flags [I] Copy flags
508 * Success: Handle to newly created image
511 * FIXME: implementation still lacks nearly all features, see LR_*
512 * defines in windows.h
514 HICON WINAPI
CopyImage( HANDLE hnd
, UINT type
, INT desiredx
,
515 INT desiredy
, UINT flags
)
520 return BITMAP_CopyBitmap(hnd
);
522 return CopyIcon(hnd
);
524 return CopyCursor(hnd
);
529 /**********************************************************************
532 HBITMAP
BITMAP_Load( HINSTANCE instance
,LPCWSTR name
, UINT loadflags
)
539 BITMAPINFO
*info
, *fix_info
=NULL
;
543 if (!(loadflags
& LR_LOADFROMFILE
)) {
544 if (!instance
) /* OEM bitmap */
549 if (HIWORD((int)name
)) return 0;
550 hdc
= CreateDCA( "DISPLAY", NULL
, NULL
, NULL
);
551 dc
= DC_GetDCPtr( hdc
);
552 if(dc
->funcs
->pLoadOEMResource
)
553 hbitmap
= dc
->funcs
->pLoadOEMResource( LOWORD((int)name
),
555 GDI_HEAP_UNLOCK( hdc
);
560 if (!(hRsrc
= FindResourceW( instance
, name
, RT_BITMAPW
))) return 0;
561 if (!(handle
= LoadResource( instance
, hRsrc
))) return 0;
563 if ((info
= (BITMAPINFO
*)LockResource( handle
)) == NULL
) return 0;
567 if (!(ptr
= (char *)VIRTUAL_MapFileW( name
))) return 0;
568 info
= (BITMAPINFO
*)(ptr
+ sizeof(BITMAPFILEHEADER
));
570 size
= DIB_BitmapInfoSize(info
, DIB_RGB_COLORS
);
571 if ((hFix
= GlobalAlloc(0, size
))) fix_info
=GlobalLock(hFix
);
575 memcpy(fix_info
, info
, size
);
576 pix
= *((LPBYTE
)info
+DIB_BitmapInfoSize(info
, DIB_RGB_COLORS
));
577 DIB_FixColorsToLoadflags(fix_info
, loadflags
, pix
);
578 if ((hdc
= GetDC(0)) != 0) {
579 char *bits
= (char *)info
+ size
;
580 if (loadflags
& LR_CREATEDIBSECTION
) {
582 hbitmap
= CreateDIBSection(hdc
, fix_info
, DIB_RGB_COLORS
, NULL
, 0, 0);
583 GetObjectA(hbitmap
, sizeof(DIBSECTION
), &dib
);
584 SetDIBits(hdc
, hbitmap
, 0, dib
.dsBm
.bmHeight
, bits
, info
,
588 hbitmap
= CreateDIBitmap( hdc
, &fix_info
->bmiHeader
, CBM_INIT
,
589 bits
, fix_info
, DIB_RGB_COLORS
);
596 if (loadflags
& LR_LOADFROMFILE
) UnmapViewOfFile( ptr
);
601 /******************************************************************************
602 * LoadBitmapW [USER32.358] Loads bitmap from the executable file
605 * Success: Handle to specified bitmap
608 HBITMAP WINAPI
LoadBitmapW(
609 HINSTANCE instance
, /* [in] Handle to application instance */
610 LPCWSTR name
) /* [in] Address of bitmap resource name */
612 return LoadImageW( instance
, name
, IMAGE_BITMAP
, 0, 0, 0 );
615 /**********************************************************************
616 * LoadBitmapA (USER32.357)
618 HBITMAP WINAPI
LoadBitmapA( HINSTANCE instance
, LPCSTR name
)
620 return LoadImageA( instance
, name
, IMAGE_BITMAP
, 0, 0, 0 );
623 /**********************************************************************
624 * LoadBitmap16 (USER.175)
626 HBITMAP16 WINAPI
LoadBitmap16( HINSTANCE16 instance
, SEGPTR name
)
628 LPCSTR nameStr
= HIWORD(name
)? PTR_SEG_TO_LIN(name
) : (LPCSTR
)name
;
629 return LoadBitmapA( instance
, nameStr
);
634 /***********************************************************************
635 * BITMAP_DeleteObject
637 BOOL
BITMAP_DeleteObject( HBITMAP16 hbitmap
, BITMAPOBJ
* bmp
)
639 if( bmp
->DDBitmap
) {
640 if( bmp
->DDBitmap
->funcs
->pDeleteObject
)
641 bmp
->DDBitmap
->funcs
->pDeleteObject( hbitmap
);
644 if( bmp
->bitmap
.bmBits
)
645 HeapFree( GetProcessHeap(), 0, bmp
->bitmap
.bmBits
);
647 DIB_DeleteDIBSection( bmp
);
649 return GDI_FreeObject( hbitmap
);
653 /***********************************************************************
656 INT16
BITMAP_GetObject16( BITMAPOBJ
* bmp
, INT16 count
, LPVOID buffer
)
660 if ( count
<= sizeof(BITMAP16
) )
662 BITMAP
*bmp32
= &bmp
->dib
->dsBm
;
664 bmp16
.bmType
= bmp32
->bmType
;
665 bmp16
.bmWidth
= bmp32
->bmWidth
;
666 bmp16
.bmHeight
= bmp32
->bmHeight
;
667 bmp16
.bmWidthBytes
= bmp32
->bmWidthBytes
;
668 bmp16
.bmPlanes
= bmp32
->bmPlanes
;
669 bmp16
.bmBitsPixel
= bmp32
->bmBitsPixel
;
670 bmp16
.bmBits
= (SEGPTR
)0;
671 memcpy( buffer
, &bmp16
, count
);
676 FIXME_(bitmap
)("not implemented for DIBs: count %d\n", count
);
683 bmp16
.bmType
= bmp
->bitmap
.bmType
;
684 bmp16
.bmWidth
= bmp
->bitmap
.bmWidth
;
685 bmp16
.bmHeight
= bmp
->bitmap
.bmHeight
;
686 bmp16
.bmWidthBytes
= bmp
->bitmap
.bmWidthBytes
;
687 bmp16
.bmPlanes
= bmp
->bitmap
.bmPlanes
;
688 bmp16
.bmBitsPixel
= bmp
->bitmap
.bmBitsPixel
;
689 bmp16
.bmBits
= (SEGPTR
)0;
690 if (count
> sizeof(bmp16
)) count
= sizeof(bmp16
);
691 memcpy( buffer
, &bmp16
, count
);
697 /***********************************************************************
700 INT
BITMAP_GetObject( BITMAPOBJ
* bmp
, INT count
, LPVOID buffer
)
704 if (count
< sizeof(DIBSECTION
))
706 if (count
> sizeof(BITMAP
)) count
= sizeof(BITMAP
);
710 if (count
> sizeof(DIBSECTION
)) count
= sizeof(DIBSECTION
);
713 memcpy( buffer
, bmp
->dib
, count
);
718 if (count
> sizeof(BITMAP
)) count
= sizeof(BITMAP
);
719 memcpy( buffer
, &bmp
->bitmap
, count
);
725 /***********************************************************************
726 * CreateDiscardableBitmap16 (GDI.156)
728 HBITMAP16 WINAPI
CreateDiscardableBitmap16( HDC16 hdc
, INT16 width
,
731 return CreateCompatibleBitmap16( hdc
, width
, height
);
735 /******************************************************************************
736 * CreateDiscardableBitmap32 [GDI32.38] Creates a discardable bitmap
739 * Success: Handle to bitmap
742 HBITMAP WINAPI
CreateDiscardableBitmap(
743 HDC hdc
, /* [in] Handle to device context */
744 INT width
, /* [in] Bitmap width */
745 INT height
) /* [in] Bitmap height */
747 return CreateCompatibleBitmap( hdc
, width
, height
);
751 /***********************************************************************
752 * GetBitmapDimensionEx16 (GDI.468)
755 * Can this call GetBitmapDimensionEx32?
757 BOOL16 WINAPI
GetBitmapDimensionEx16( HBITMAP16 hbitmap
, LPSIZE16 size
)
759 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
760 if (!bmp
) return FALSE
;
761 CONV_SIZE32TO16( &bmp
->size
, size
);
762 GDI_HEAP_UNLOCK( hbitmap
);
767 /******************************************************************************
768 * GetBitmapDimensionEx32 [GDI32.144] Retrieves dimensions of a bitmap
774 BOOL WINAPI
GetBitmapDimensionEx(
775 HBITMAP hbitmap
, /* [in] Handle to bitmap */
776 LPSIZE size
) /* [out] Address of struct receiving dimensions */
778 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
779 if (!bmp
) return FALSE
;
781 GDI_HEAP_UNLOCK( hbitmap
);
786 /***********************************************************************
787 * GetBitmapDimension (GDI.162)
789 DWORD WINAPI
GetBitmapDimension16( HBITMAP16 hbitmap
)
792 if (!GetBitmapDimensionEx16( hbitmap
, &size
)) return 0;
793 return MAKELONG( size
.cx
, size
.cy
);
797 /***********************************************************************
798 * SetBitmapDimensionEx16 (GDI.478)
800 BOOL16 WINAPI
SetBitmapDimensionEx16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
,
803 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
804 if (!bmp
) return FALSE
;
805 if (prevSize
) CONV_SIZE32TO16( &bmp
->size
, prevSize
);
808 GDI_HEAP_UNLOCK( hbitmap
);
813 /******************************************************************************
814 * SetBitmapDimensionEx32 [GDI32.304] Assignes dimensions to a bitmap
820 BOOL WINAPI
SetBitmapDimensionEx(
821 HBITMAP hbitmap
, /* [in] Handle to bitmap */
822 INT x
, /* [in] Bitmap width */
823 INT y
, /* [in] Bitmap height */
824 LPSIZE prevSize
) /* [out] Address of structure for orig dims */
826 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
827 if (!bmp
) return FALSE
;
828 if (prevSize
) *prevSize
= bmp
->size
;
831 GDI_HEAP_UNLOCK( hbitmap
);
836 /***********************************************************************
837 * SetBitmapDimension (GDI.163)
839 DWORD WINAPI
SetBitmapDimension16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
)
842 if (!SetBitmapDimensionEx16( hbitmap
, x
, y
, &size
)) return 0;
843 return MAKELONG( size
.cx
, size
.cy
);