4 * Copyright 1993 Alexandre Julliard
11 #include "wine/winbase16.h"
17 #include "cursoricon.h"
18 #include "debugtools.h"
20 #include "wine/winuser16.h"
22 DEFAULT_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("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("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("%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("(%04x,%d,%d) = \n", hdc
, width
, height
);
181 if (!(dc
= DC_GetDCPtr( hdc
))) return 0;
182 if ((width
>= 0x10000) || (height
>= 0x10000)) {
183 FIXME("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("\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("(%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("Less then one entire line requested\n");
267 GDI_HEAP_UNLOCK( hbitmap
);
272 TRACE("(%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("Calling device specific BitmapBits\n");
279 if(bmp
->DDBitmap
->funcs
->pBitmapBits
)
280 ret
= bmp
->DDBitmap
->funcs
->pBitmapBits(hbitmap
, bits
, count
,
283 ERR("BitmapBits == NULL??\n");
289 if(!bmp
->bitmap
.bmBits
) {
290 WARN("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("(%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("(%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("Calling device specific BitmapBits\n");
348 if(bmp
->DDBitmap
->funcs
->pBitmapBits
)
349 ret
= bmp
->DDBitmap
->funcs
->pBitmapBits(hbitmap
, (void *) bits
,
352 ERR("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("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 CURSORICON_ExtCopy(hnd
,type
, desiredx
, desiredy
, flags
);
532 /* Should call CURSORICON_ExtCopy but more testing
533 * needs to be done before we change this
535 return CopyCursor(hnd
);
540 /**********************************************************************
543 HBITMAP
BITMAP_Load( HINSTANCE instance
,LPCWSTR name
, UINT loadflags
)
550 BITMAPINFO
*info
, *fix_info
=NULL
;
554 if (!(loadflags
& LR_LOADFROMFILE
)) {
555 if (!instance
) /* OEM bitmap */
560 if (HIWORD((int)name
)) return 0;
561 hdc
= CreateDCA( "DISPLAY", NULL
, NULL
, NULL
);
562 dc
= DC_GetDCPtr( hdc
);
563 if(dc
->funcs
->pLoadOEMResource
)
564 hbitmap
= dc
->funcs
->pLoadOEMResource( LOWORD((int)name
),
566 GDI_HEAP_UNLOCK( hdc
);
571 if (!(hRsrc
= FindResourceW( instance
, name
, RT_BITMAPW
))) return 0;
572 if (!(handle
= LoadResource( instance
, hRsrc
))) return 0;
574 if ((info
= (BITMAPINFO
*)LockResource( handle
)) == NULL
) return 0;
578 if (!(ptr
= (char *)VIRTUAL_MapFileW( name
))) return 0;
579 info
= (BITMAPINFO
*)(ptr
+ sizeof(BITMAPFILEHEADER
));
581 size
= DIB_BitmapInfoSize(info
, DIB_RGB_COLORS
);
582 if ((hFix
= GlobalAlloc(0, size
))) fix_info
=GlobalLock(hFix
);
586 memcpy(fix_info
, info
, size
);
587 pix
= *((LPBYTE
)info
+DIB_BitmapInfoSize(info
, DIB_RGB_COLORS
));
588 DIB_FixColorsToLoadflags(fix_info
, loadflags
, pix
);
589 if ((hdc
= GetDC(0)) != 0) {
590 char *bits
= (char *)info
+ size
;
591 if (loadflags
& LR_CREATEDIBSECTION
) {
593 hbitmap
= CreateDIBSection(hdc
, fix_info
, DIB_RGB_COLORS
, NULL
, 0, 0);
594 GetObjectA(hbitmap
, sizeof(DIBSECTION
), &dib
);
595 SetDIBits(hdc
, hbitmap
, 0, dib
.dsBm
.bmHeight
, bits
, info
,
599 hbitmap
= CreateDIBitmap( hdc
, &fix_info
->bmiHeader
, CBM_INIT
,
600 bits
, fix_info
, DIB_RGB_COLORS
);
607 if (loadflags
& LR_LOADFROMFILE
) UnmapViewOfFile( ptr
);
612 /******************************************************************************
613 * LoadBitmapW [USER32.358] Loads bitmap from the executable file
616 * Success: Handle to specified bitmap
619 HBITMAP WINAPI
LoadBitmapW(
620 HINSTANCE instance
, /* [in] Handle to application instance */
621 LPCWSTR name
) /* [in] Address of bitmap resource name */
623 return LoadImageW( instance
, name
, IMAGE_BITMAP
, 0, 0, 0 );
626 /**********************************************************************
627 * LoadBitmapA (USER32.357)
629 HBITMAP WINAPI
LoadBitmapA( HINSTANCE instance
, LPCSTR name
)
631 return LoadImageA( instance
, name
, IMAGE_BITMAP
, 0, 0, 0 );
634 /**********************************************************************
635 * LoadBitmap16 (USER.175)
637 HBITMAP16 WINAPI
LoadBitmap16( HINSTANCE16 instance
, SEGPTR name
)
639 LPCSTR nameStr
= HIWORD(name
)? PTR_SEG_TO_LIN(name
) : (LPCSTR
)name
;
640 return LoadBitmapA( instance
, nameStr
);
645 /***********************************************************************
646 * BITMAP_DeleteObject
648 BOOL
BITMAP_DeleteObject( HBITMAP16 hbitmap
, BITMAPOBJ
* bmp
)
650 if( bmp
->DDBitmap
) {
651 if( bmp
->DDBitmap
->funcs
->pDeleteObject
)
652 bmp
->DDBitmap
->funcs
->pDeleteObject( hbitmap
);
655 if( bmp
->bitmap
.bmBits
)
656 HeapFree( GetProcessHeap(), 0, bmp
->bitmap
.bmBits
);
658 DIB_DeleteDIBSection( bmp
);
660 return GDI_FreeObject( hbitmap
);
664 /***********************************************************************
667 INT16
BITMAP_GetObject16( BITMAPOBJ
* bmp
, INT16 count
, LPVOID buffer
)
671 if ( count
<= sizeof(BITMAP16
) )
673 BITMAP
*bmp32
= &bmp
->dib
->dsBm
;
675 bmp16
.bmType
= bmp32
->bmType
;
676 bmp16
.bmWidth
= bmp32
->bmWidth
;
677 bmp16
.bmHeight
= bmp32
->bmHeight
;
678 bmp16
.bmWidthBytes
= bmp32
->bmWidthBytes
;
679 bmp16
.bmPlanes
= bmp32
->bmPlanes
;
680 bmp16
.bmBitsPixel
= bmp32
->bmBitsPixel
;
681 bmp16
.bmBits
= (SEGPTR
)0;
682 memcpy( buffer
, &bmp16
, count
);
687 FIXME("not implemented for DIBs: count %d\n", count
);
694 bmp16
.bmType
= bmp
->bitmap
.bmType
;
695 bmp16
.bmWidth
= bmp
->bitmap
.bmWidth
;
696 bmp16
.bmHeight
= bmp
->bitmap
.bmHeight
;
697 bmp16
.bmWidthBytes
= bmp
->bitmap
.bmWidthBytes
;
698 bmp16
.bmPlanes
= bmp
->bitmap
.bmPlanes
;
699 bmp16
.bmBitsPixel
= bmp
->bitmap
.bmBitsPixel
;
700 bmp16
.bmBits
= (SEGPTR
)0;
701 if (count
> sizeof(bmp16
)) count
= sizeof(bmp16
);
702 memcpy( buffer
, &bmp16
, count
);
708 /***********************************************************************
711 INT
BITMAP_GetObject( BITMAPOBJ
* bmp
, INT count
, LPVOID buffer
)
715 if (count
< sizeof(DIBSECTION
))
717 if (count
> sizeof(BITMAP
)) count
= sizeof(BITMAP
);
721 if (count
> sizeof(DIBSECTION
)) count
= sizeof(DIBSECTION
);
724 memcpy( buffer
, bmp
->dib
, count
);
729 if (count
> sizeof(BITMAP
)) count
= sizeof(BITMAP
);
730 memcpy( buffer
, &bmp
->bitmap
, count
);
736 /***********************************************************************
737 * CreateDiscardableBitmap16 (GDI.156)
739 HBITMAP16 WINAPI
CreateDiscardableBitmap16( HDC16 hdc
, INT16 width
,
742 return CreateCompatibleBitmap16( hdc
, width
, height
);
746 /******************************************************************************
747 * CreateDiscardableBitmap32 [GDI32.38] Creates a discardable bitmap
750 * Success: Handle to bitmap
753 HBITMAP WINAPI
CreateDiscardableBitmap(
754 HDC hdc
, /* [in] Handle to device context */
755 INT width
, /* [in] Bitmap width */
756 INT height
) /* [in] Bitmap height */
758 return CreateCompatibleBitmap( hdc
, width
, height
);
762 /***********************************************************************
763 * GetBitmapDimensionEx16 (GDI.468)
766 * Can this call GetBitmapDimensionEx32?
768 BOOL16 WINAPI
GetBitmapDimensionEx16( HBITMAP16 hbitmap
, LPSIZE16 size
)
770 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
771 if (!bmp
) return FALSE
;
772 CONV_SIZE32TO16( &bmp
->size
, size
);
773 GDI_HEAP_UNLOCK( hbitmap
);
778 /******************************************************************************
779 * GetBitmapDimensionEx32 [GDI32.144] Retrieves dimensions of a bitmap
785 BOOL WINAPI
GetBitmapDimensionEx(
786 HBITMAP hbitmap
, /* [in] Handle to bitmap */
787 LPSIZE size
) /* [out] Address of struct receiving dimensions */
789 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
790 if (!bmp
) return FALSE
;
792 GDI_HEAP_UNLOCK( hbitmap
);
797 /***********************************************************************
798 * GetBitmapDimension (GDI.162)
800 DWORD WINAPI
GetBitmapDimension16( HBITMAP16 hbitmap
)
803 if (!GetBitmapDimensionEx16( hbitmap
, &size
)) return 0;
804 return MAKELONG( size
.cx
, size
.cy
);
808 /***********************************************************************
809 * SetBitmapDimensionEx16 (GDI.478)
811 BOOL16 WINAPI
SetBitmapDimensionEx16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
,
814 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
815 if (!bmp
) return FALSE
;
816 if (prevSize
) CONV_SIZE32TO16( &bmp
->size
, prevSize
);
819 GDI_HEAP_UNLOCK( hbitmap
);
824 /******************************************************************************
825 * SetBitmapDimensionEx32 [GDI32.304] Assignes dimensions to a bitmap
831 BOOL WINAPI
SetBitmapDimensionEx(
832 HBITMAP hbitmap
, /* [in] Handle to bitmap */
833 INT x
, /* [in] Bitmap width */
834 INT y
, /* [in] Bitmap height */
835 LPSIZE prevSize
) /* [out] Address of structure for orig dims */
837 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
838 if (!bmp
) return FALSE
;
839 if (prevSize
) *prevSize
= bmp
->size
;
842 GDI_HEAP_UNLOCK( hbitmap
);
847 /***********************************************************************
848 * SetBitmapDimension (GDI.163)
850 DWORD WINAPI
SetBitmapDimension16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
)
853 if (!SetBitmapDimensionEx16( hbitmap
, x
, y
, &size
)) return 0;
854 return MAKELONG( size
.cx
, size
.cy
);