4 * Copyright 1993 Alexandre Julliard
11 #include "wine/winbase16.h"
17 #include "sysmetrics.h"
18 #include "cursoricon.h"
21 #include "wine/winuser16.h"
23 BITMAP_DRIVER
*BITMAP_Driver
= NULL
;
26 /***********************************************************************
27 * BITMAP_GetWidthBytes
29 * Return number of bytes taken by a scanline of 16-bit aligned Windows DDB
32 INT
BITMAP_GetWidthBytes( INT bmWidth
, INT bpp
)
37 return 2 * ((bmWidth
+15) >> 4);
40 bmWidth
*= 3; /* fall through */
42 return bmWidth
+ (bmWidth
& 1);
52 return 2 * ((bmWidth
+3) >> 2);
55 WARN(bitmap
,"Unknown depth %d, please report.\n", bpp
);
60 /***********************************************************************
61 * CreateUserBitmap16 (GDI.407)
63 HBITMAP16 WINAPI
CreateUserBitmap16( INT16 width
, INT16 height
, UINT16 planes
,
64 UINT16 bpp
, LPCVOID bits
)
66 return CreateBitmap16( width
, height
, planes
, bpp
, bits
);
69 /***********************************************************************
70 * CreateUserDiscardableBitmap16 (GDI.409)
72 HBITMAP16 WINAPI
CreateUserDiscardableBitmap16( WORD dummy
,
73 INT16 width
, INT16 height
)
75 return CreateUserBitmap16( width
, height
, 1, MONITOR_GetDepth(&MONITOR_PrimaryMonitor
), NULL
);
79 /***********************************************************************
80 * CreateBitmap16 (GDI.48)
82 HBITMAP16 WINAPI
CreateBitmap16( INT16 width
, INT16 height
, UINT16 planes
,
83 UINT16 bpp
, LPCVOID bits
)
85 return CreateBitmap( width
, height
, planes
, bpp
, bits
);
89 /******************************************************************************
90 * CreateBitmap32 [GDI32.25] Creates a bitmap with the specified info
93 * width [I] bitmap width
94 * height [I] bitmap height
95 * planes [I] Number of color planes
96 * bpp [I] Number of bits to identify a color
97 * bits [I] Pointer to array containing color data
100 * Success: Handle to bitmap
103 HBITMAP WINAPI
CreateBitmap( INT width
, INT height
, UINT planes
,
104 UINT bpp
, LPCVOID bits
)
109 planes
= (BYTE
)planes
;
113 /* Check parameters */
114 if (!height
|| !width
) return 0;
116 FIXME(bitmap
, "planes = %d\n", planes
);
119 if (height
< 0) height
= -height
;
120 if (width
< 0) width
= -width
;
122 /* Create the BITMAPOBJ */
123 hbitmap
= GDI_AllocObject( sizeof(BITMAPOBJ
), BITMAP_MAGIC
);
124 if (!hbitmap
) return 0;
126 TRACE(bitmap
, "%dx%d, %d colors returning %08x\n", width
, height
,
127 1 << (planes
*bpp
), hbitmap
);
129 bmp
= (BITMAPOBJ
*) GDI_HEAP_LOCK( hbitmap
);
133 bmp
->bitmap
.bmType
= 0;
134 bmp
->bitmap
.bmWidth
= width
;
135 bmp
->bitmap
.bmHeight
= height
;
136 bmp
->bitmap
.bmPlanes
= planes
;
137 bmp
->bitmap
.bmBitsPixel
= bpp
;
138 bmp
->bitmap
.bmWidthBytes
= BITMAP_GetWidthBytes( width
, bpp
);
139 bmp
->bitmap
.bmBits
= NULL
;
141 bmp
->DDBitmap
= NULL
;
144 if (bits
) /* Set bitmap bits */
145 SetBitmapBits( hbitmap
, height
* bmp
->bitmap
.bmWidthBytes
,
147 GDI_HEAP_UNLOCK( hbitmap
);
152 /***********************************************************************
153 * CreateCompatibleBitmap16 (GDI.51)
155 HBITMAP16 WINAPI
CreateCompatibleBitmap16(HDC16 hdc
, INT16 width
, INT16 height
)
157 return CreateCompatibleBitmap( hdc
, width
, height
);
161 /******************************************************************************
162 * CreateCompatibleBitmap32 [GDI32.30] Creates a bitmap compatible with the DC
165 * hdc [I] Handle to device context
166 * width [I] Width of bitmap
167 * height [I] Height of bitmap
170 * Success: Handle to bitmap
173 HBITMAP WINAPI
CreateCompatibleBitmap( HDC hdc
, INT width
, INT height
)
178 TRACE(bitmap
, "(%04x,%d,%d) = \n", hdc
, width
, height
);
179 if (!(dc
= DC_GetDCPtr( hdc
))) return 0;
180 if ((width
>= 0x10000) || (height
>= 0x10000)) {
181 FIXME(bitmap
,"got bad width %d or height %d, please look for reason\n",
184 hbmpRet
= CreateBitmap( width
, height
, 1, dc
->w
.bitsPerPixel
, NULL
);
185 if(dc
->funcs
->pCreateBitmap
)
186 dc
->funcs
->pCreateBitmap( hbmpRet
);
188 TRACE(bitmap
,"\t\t%04x\n", hbmpRet
);
189 GDI_HEAP_UNLOCK(hdc
);
194 /***********************************************************************
195 * CreateBitmapIndirect16 (GDI.49)
197 HBITMAP16 WINAPI
CreateBitmapIndirect16( const BITMAP16
* bmp
)
199 return CreateBitmap16( bmp
->bmWidth
, bmp
->bmHeight
, bmp
->bmPlanes
,
200 bmp
->bmBitsPixel
, PTR_SEG_TO_LIN( bmp
->bmBits
) );
204 /******************************************************************************
205 * CreateBitmapIndirect32 [GDI32.26] Creates a bitmap with the specifies info
208 * Success: Handle to bitmap
211 HBITMAP WINAPI
CreateBitmapIndirect(
212 const BITMAP
* bmp
) /* [in] Pointer to the bitmap data */
214 return CreateBitmap( bmp
->bmWidth
, bmp
->bmHeight
, bmp
->bmPlanes
,
215 bmp
->bmBitsPixel
, bmp
->bmBits
);
219 /***********************************************************************
220 * GetBitmapBits16 (GDI.74)
222 LONG WINAPI
GetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPVOID buffer
)
224 return GetBitmapBits( hbitmap
, count
, buffer
);
228 /***********************************************************************
229 * GetBitmapBits32 [GDI32.143] Copies bitmap bits of bitmap to buffer
232 * Success: Number of bytes copied
235 LONG WINAPI
GetBitmapBits(
236 HBITMAP hbitmap
, /* [in] Handle to bitmap */
237 LONG count
, /* [in] Number of bytes to copy */
238 LPVOID bits
) /* [out] Pointer to buffer to receive bits */
240 BITMAPOBJ
*bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
246 WARN(bitmap
, "(%ld): Negative number of bytes passed???\n", count
);
250 /* Only get entire lines */
251 height
= count
/ bmp
->bitmap
.bmWidthBytes
;
252 if (height
> bmp
->bitmap
.bmHeight
) height
= bmp
->bitmap
.bmHeight
;
253 count
= height
* bmp
->bitmap
.bmWidthBytes
;
256 WARN(bitmap
, "Less then one entire line requested\n");
257 GDI_HEAP_UNLOCK( hbitmap
);
262 TRACE(bitmap
, "(%08x, %ld, %p) %dx%d %d colors fetched height: %ld\n",
263 hbitmap
, count
, bits
, bmp
->bitmap
.bmWidth
, bmp
->bitmap
.bmHeight
,
264 1 << bmp
->bitmap
.bmBitsPixel
, height
);
268 TRACE(bitmap
, "Calling device specific BitmapBits\n");
269 if(bmp
->DDBitmap
->funcs
->pBitmapBits
)
270 ret
= bmp
->DDBitmap
->funcs
->pBitmapBits(hbitmap
, bits
, count
,
273 ERR(bitmap
, "BitmapBits == NULL??\n");
279 if(!bmp
->bitmap
.bmBits
) {
280 WARN(bitmap
, "Bitmap is empty\n");
283 memcpy(bits
, bmp
->bitmap
.bmBits
, count
);
289 GDI_HEAP_UNLOCK( hbitmap
);
294 /***********************************************************************
295 * SetBitmapBits16 (GDI.106)
297 LONG WINAPI
SetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPCVOID buffer
)
299 return SetBitmapBits( hbitmap
, count
, buffer
);
303 /******************************************************************************
304 * SetBitmapBits32 [GDI32.303] Sets bits of color data for a bitmap
307 * Success: Number of bytes used in setting the bitmap bits
310 LONG WINAPI
SetBitmapBits(
311 HBITMAP hbitmap
, /* [in] Handle to bitmap */
312 LONG count
, /* [in] Number of bytes in bitmap array */
313 LPCVOID bits
) /* [in] Address of array with bitmap bits */
315 BITMAPOBJ
*bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
321 WARN(bitmap
, "(%ld): Negative number of bytes passed???\n", count
);
325 /* Only get entire lines */
326 height
= count
/ bmp
->bitmap
.bmWidthBytes
;
327 if (height
> bmp
->bitmap
.bmHeight
) height
= bmp
->bitmap
.bmHeight
;
328 count
= height
* bmp
->bitmap
.bmWidthBytes
;
330 TRACE(bitmap
, "(%08x, %ld, %p) %dx%d %d colors fetched height: %ld\n",
331 hbitmap
, count
, bits
, bmp
->bitmap
.bmWidth
, bmp
->bitmap
.bmHeight
,
332 1 << bmp
->bitmap
.bmBitsPixel
, height
);
336 TRACE(bitmap
, "Calling device specific BitmapBits\n");
337 if(bmp
->DDBitmap
->funcs
->pBitmapBits
)
338 ret
= bmp
->DDBitmap
->funcs
->pBitmapBits(hbitmap
, (void *) bits
,
341 ERR(bitmap
, "BitmapBits == NULL??\n");
347 if(!bmp
->bitmap
.bmBits
) /* Alloc enough for entire bitmap */
348 bmp
->bitmap
.bmBits
= HeapAlloc( GetProcessHeap(), 0, count
);
349 if(!bmp
->bitmap
.bmBits
) {
350 WARN(bitmap
, "Unable to allocate bit buffer\n");
353 memcpy(bmp
->bitmap
.bmBits
, bits
, count
);
358 GDI_HEAP_UNLOCK( hbitmap
);
362 /***********************************************************************
363 * LoadImage16 [USER.389]
366 HANDLE16 WINAPI
LoadImage16( HINSTANCE16 hinst
, LPCSTR name
, UINT16 type
,
367 INT16 desiredx
, INT16 desiredy
, UINT16 loadflags
)
369 LPCSTR nameStr
= HIWORD(name
)? PTR_SEG_TO_LIN(name
) : (LPCSTR
)name
;
370 return LoadImageA( hinst
, nameStr
, type
,
371 desiredx
, desiredy
, loadflags
);
374 /**********************************************************************
375 * LoadImageA (USER32.365)
377 * FIXME: implementation lacks some features, see LR_ defines in windows.h
380 HANDLE WINAPI
LoadImageA( HINSTANCE hinst
, LPCSTR name
, UINT type
,
381 INT desiredx
, INT desiredy
, UINT loadflags
)
386 if (HIWORD(name
)) u_name
= HEAP_strdupAtoW(GetProcessHeap(), 0, name
);
387 else u_name
=(LPWSTR
)name
;
388 res
= LoadImageW(hinst
, u_name
, type
, desiredx
, desiredy
, loadflags
);
389 if (HIWORD(name
)) HeapFree(GetProcessHeap(), 0, u_name
);
394 /******************************************************************************
395 * LoadImageW [USER32.366] Loads an icon, cursor, or bitmap
398 * hinst [I] Handle of instance that contains image
399 * name [I] Name of image
400 * type [I] Type of image
401 * desiredx [I] Desired width
402 * desiredy [I] Desired height
403 * loadflags [I] Load flags
406 * Success: Handle to newly loaded image
409 * FIXME: Implementation lacks some features, see LR_ defines in windows.h
411 HANDLE WINAPI
LoadImageW( HINSTANCE hinst
, LPCWSTR name
, UINT type
,
412 INT desiredx
, INT desiredy
, UINT loadflags
)
415 TRACE(resource
,"(0x%04x,%p,%d,%d,%d,0x%08x)\n",
416 hinst
,name
,type
,desiredx
,desiredy
,loadflags
);
418 TRACE(resource
,"(0x%04x,%p,%d,%d,%d,0x%08x)\n",
419 hinst
,name
,type
,desiredx
,desiredy
,loadflags
);
421 if (loadflags
& LR_DEFAULTSIZE
) {
422 if (type
== IMAGE_ICON
) {
423 if (!desiredx
) desiredx
= SYSMETRICS_CXICON
;
424 if (!desiredy
) desiredy
= SYSMETRICS_CYICON
;
425 } else if (type
== IMAGE_CURSOR
) {
426 if (!desiredx
) desiredx
= SYSMETRICS_CXCURSOR
;
427 if (!desiredy
) desiredy
= SYSMETRICS_CYCURSOR
;
430 if (loadflags
& LR_LOADFROMFILE
) loadflags
&= ~LR_SHARED
;
433 return BITMAP_Load( hinst
, name
, loadflags
);
438 UINT palEnts
= GetSystemPaletteEntries(hdc
, 0, 0, NULL
);
441 return CURSORICON_Load(hinst
, name
, desiredx
, desiredy
,
442 MIN(16, palEnts
), FALSE
, loadflags
);
446 return CURSORICON_Load(hinst
, name
, desiredx
, desiredy
,
453 /**********************************************************************
457 HBITMAP
BITMAP_CopyBitmap(HBITMAP hbitmap
)
459 BITMAPOBJ
*bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
467 res
= CreateBitmapIndirect(&bm
);
470 char *buf
= HeapAlloc( GetProcessHeap(), 0, bm
.bmWidthBytes
*
472 GetBitmapBits (hbitmap
, bm
.bmWidthBytes
* bm
.bmHeight
, buf
);
473 SetBitmapBits (res
, bm
.bmWidthBytes
* bm
.bmHeight
, buf
);
474 HeapFree( GetProcessHeap(), 0, buf
);
477 GDI_HEAP_UNLOCK( hbitmap
);
481 /******************************************************************************
482 * CopyImage16 [USER.390] Creates new image and copies attributes to it
485 HICON16 WINAPI
CopyImage16( HANDLE16 hnd
, UINT16 type
, INT16 desiredx
,
486 INT16 desiredy
, UINT16 flags
)
488 return (HICON16
)CopyImage((HANDLE
)hnd
, (UINT
)type
, (INT
)desiredx
,
489 (INT
)desiredy
, (UINT
)flags
);
492 /******************************************************************************
493 * CopyImage32 [USER32.61] Creates new image and copies attributes to it
496 * hnd [I] Handle to image to copy
497 * type [I] Type of image to copy
498 * desiredx [I] Desired width of new image
499 * desiredy [I] Desired height of new image
500 * flags [I] Copy flags
503 * Success: Handle to newly created image
506 * FIXME: implementation still lacks nearly all features, see LR_*
507 * defines in windows.h
509 HICON WINAPI
CopyImage( HANDLE hnd
, UINT type
, INT desiredx
,
510 INT desiredy
, UINT flags
)
515 return BITMAP_CopyBitmap(hnd
);
517 return CopyIcon(hnd
);
519 return CopyCursor(hnd
);
524 /**********************************************************************
527 HBITMAP
BITMAP_Load( HINSTANCE instance
,LPCWSTR name
, UINT loadflags
)
534 BITMAPINFO
*info
, *fix_info
=NULL
;
538 if (!(loadflags
& LR_LOADFROMFILE
)) {
539 if (!instance
) /* OEM bitmap */
544 if (HIWORD((int)name
)) return 0;
545 hdc
= CreateDCA( "DISPLAY", NULL
, NULL
, NULL
);
546 dc
= DC_GetDCPtr( hdc
);
547 if(dc
->funcs
->pLoadOEMResource
)
548 hbitmap
= dc
->funcs
->pLoadOEMResource( LOWORD((int)name
),
550 GDI_HEAP_UNLOCK( hdc
);
555 if (!(hRsrc
= FindResourceW( instance
, name
, RT_BITMAPW
))) return 0;
556 if (!(handle
= LoadResource( instance
, hRsrc
))) return 0;
558 if ((info
= (BITMAPINFO
*)LockResource( handle
)) == NULL
) return 0;
562 if (!(ptr
= (char *)VIRTUAL_MapFileW( name
))) return 0;
563 info
= (BITMAPINFO
*)(ptr
+ sizeof(BITMAPFILEHEADER
));
565 size
= DIB_BitmapInfoSize(info
, DIB_RGB_COLORS
);
566 if ((hFix
= GlobalAlloc(0, size
))) fix_info
=GlobalLock(hFix
);
570 memcpy(fix_info
, info
, size
);
571 pix
= *((LPBYTE
)info
+DIB_BitmapInfoSize(info
, DIB_RGB_COLORS
));
572 DIB_FixColorsToLoadflags(fix_info
, loadflags
, pix
);
573 if ((hdc
= GetDC(0)) != 0) {
574 char *bits
= (char *)info
+ size
;
575 if (loadflags
& LR_CREATEDIBSECTION
) {
577 hbitmap
= CreateDIBSection(hdc
, fix_info
, DIB_RGB_COLORS
, NULL
, 0, 0);
578 GetObjectA(hbitmap
, sizeof(DIBSECTION
), &dib
);
579 SetDIBits(hdc
, hbitmap
, 0, dib
.dsBm
.bmHeight
, bits
, info
,
583 hbitmap
= CreateDIBitmap( hdc
, &fix_info
->bmiHeader
, CBM_INIT
,
584 bits
, fix_info
, DIB_RGB_COLORS
);
591 if (loadflags
& LR_LOADFROMFILE
) UnmapViewOfFile( ptr
);
596 /******************************************************************************
597 * LoadBitmapW [USER32.358] Loads bitmap from the executable file
600 * Success: Handle to specified bitmap
603 HBITMAP WINAPI
LoadBitmapW(
604 HINSTANCE instance
, /* [in] Handle to application instance */
605 LPCWSTR name
) /* [in] Address of bitmap resource name */
607 return LoadImageW( instance
, name
, IMAGE_BITMAP
, 0, 0, 0 );
610 /**********************************************************************
611 * LoadBitmapA (USER32.357)
613 HBITMAP WINAPI
LoadBitmapA( HINSTANCE instance
, LPCSTR name
)
615 return LoadImageA( instance
, name
, IMAGE_BITMAP
, 0, 0, 0 );
618 /**********************************************************************
619 * LoadBitmap16 (USER.175)
621 HBITMAP16 WINAPI
LoadBitmap16( HINSTANCE16 instance
, SEGPTR name
)
623 LPCSTR nameStr
= HIWORD(name
)? PTR_SEG_TO_LIN(name
) : (LPCSTR
)name
;
624 return LoadBitmapA( instance
, nameStr
);
629 /***********************************************************************
630 * BITMAP_DeleteObject
632 BOOL
BITMAP_DeleteObject( HBITMAP16 hbitmap
, BITMAPOBJ
* bmp
)
634 if( bmp
->DDBitmap
) {
635 if( bmp
->DDBitmap
->funcs
->pDeleteObject
)
636 bmp
->DDBitmap
->funcs
->pDeleteObject( hbitmap
);
639 if( bmp
->bitmap
.bmBits
)
640 HeapFree( GetProcessHeap(), 0, bmp
->bitmap
.bmBits
);
642 DIB_DeleteDIBSection( bmp
);
644 return GDI_FreeObject( hbitmap
);
648 /***********************************************************************
651 INT16
BITMAP_GetObject16( BITMAPOBJ
* bmp
, INT16 count
, LPVOID buffer
)
655 if ( count
<= sizeof(BITMAP16
) )
657 BITMAP
*bmp32
= &bmp
->dib
->dsBm
;
659 bmp16
.bmType
= bmp32
->bmType
;
660 bmp16
.bmWidth
= bmp32
->bmWidth
;
661 bmp16
.bmHeight
= bmp32
->bmHeight
;
662 bmp16
.bmWidthBytes
= bmp32
->bmWidthBytes
;
663 bmp16
.bmPlanes
= bmp32
->bmPlanes
;
664 bmp16
.bmBitsPixel
= bmp32
->bmBitsPixel
;
665 bmp16
.bmBits
= (SEGPTR
)0;
666 memcpy( buffer
, &bmp16
, count
);
671 FIXME(bitmap
, "not implemented for DIBs: count %d\n", count
);
678 bmp16
.bmType
= bmp
->bitmap
.bmType
;
679 bmp16
.bmWidth
= bmp
->bitmap
.bmWidth
;
680 bmp16
.bmHeight
= bmp
->bitmap
.bmHeight
;
681 bmp16
.bmWidthBytes
= bmp
->bitmap
.bmWidthBytes
;
682 bmp16
.bmPlanes
= bmp
->bitmap
.bmPlanes
;
683 bmp16
.bmBitsPixel
= bmp
->bitmap
.bmBitsPixel
;
684 bmp16
.bmBits
= (SEGPTR
)0;
685 if (count
> sizeof(bmp16
)) count
= sizeof(bmp16
);
686 memcpy( buffer
, &bmp16
, count
);
692 /***********************************************************************
695 INT
BITMAP_GetObject( BITMAPOBJ
* bmp
, INT count
, LPVOID buffer
)
699 if (count
< sizeof(DIBSECTION
))
701 if (count
> sizeof(BITMAP
)) count
= sizeof(BITMAP
);
705 if (count
> sizeof(DIBSECTION
)) count
= sizeof(DIBSECTION
);
708 memcpy( buffer
, bmp
->dib
, count
);
713 if (count
> sizeof(BITMAP
)) count
= sizeof(BITMAP
);
714 memcpy( buffer
, &bmp
->bitmap
, count
);
720 /***********************************************************************
721 * CreateDiscardableBitmap16 (GDI.156)
723 HBITMAP16 WINAPI
CreateDiscardableBitmap16( HDC16 hdc
, INT16 width
,
726 return CreateCompatibleBitmap16( hdc
, width
, height
);
730 /******************************************************************************
731 * CreateDiscardableBitmap32 [GDI32.38] Creates a discardable bitmap
734 * Success: Handle to bitmap
737 HBITMAP WINAPI
CreateDiscardableBitmap(
738 HDC hdc
, /* [in] Handle to device context */
739 INT width
, /* [in] Bitmap width */
740 INT height
) /* [in] Bitmap height */
742 return CreateCompatibleBitmap( hdc
, width
, height
);
746 /***********************************************************************
747 * GetBitmapDimensionEx16 (GDI.468)
750 * Can this call GetBitmapDimensionEx32?
752 BOOL16 WINAPI
GetBitmapDimensionEx16( HBITMAP16 hbitmap
, LPSIZE16 size
)
754 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
755 if (!bmp
) return FALSE
;
756 CONV_SIZE32TO16( &bmp
->size
, size
);
757 GDI_HEAP_UNLOCK( hbitmap
);
762 /******************************************************************************
763 * GetBitmapDimensionEx32 [GDI32.144] Retrieves dimensions of a bitmap
769 BOOL WINAPI
GetBitmapDimensionEx(
770 HBITMAP hbitmap
, /* [in] Handle to bitmap */
771 LPSIZE size
) /* [out] Address of struct receiving dimensions */
773 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
774 if (!bmp
) return FALSE
;
776 GDI_HEAP_UNLOCK( hbitmap
);
781 /***********************************************************************
782 * GetBitmapDimension (GDI.162)
784 DWORD WINAPI
GetBitmapDimension16( HBITMAP16 hbitmap
)
787 if (!GetBitmapDimensionEx16( hbitmap
, &size
)) return 0;
788 return MAKELONG( size
.cx
, size
.cy
);
792 /***********************************************************************
793 * SetBitmapDimensionEx16 (GDI.478)
795 BOOL16 WINAPI
SetBitmapDimensionEx16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
,
798 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
799 if (!bmp
) return FALSE
;
800 if (prevSize
) CONV_SIZE32TO16( &bmp
->size
, prevSize
);
803 GDI_HEAP_UNLOCK( hbitmap
);
808 /******************************************************************************
809 * SetBitmapDimensionEx32 [GDI32.304] Assignes dimensions to a bitmap
815 BOOL WINAPI
SetBitmapDimensionEx(
816 HBITMAP hbitmap
, /* [in] Handle to bitmap */
817 INT x
, /* [in] Bitmap width */
818 INT y
, /* [in] Bitmap height */
819 LPSIZE prevSize
) /* [out] Address of structure for orig dims */
821 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
822 if (!bmp
) return FALSE
;
823 if (prevSize
) *prevSize
= bmp
->size
;
826 GDI_HEAP_UNLOCK( hbitmap
);
831 /***********************************************************************
832 * SetBitmapDimension (GDI.163)
834 DWORD WINAPI
SetBitmapDimension16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
)
837 if (!SetBitmapDimensionEx16( hbitmap
, x
, y
, &size
)) return 0;
838 return MAKELONG( size
.cx
, size
.cy
);