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 hbmpRet
= CreateBitmap( width
, height
, 1, dc
->w
.bitsPerPixel
, NULL
);
187 if(dc
->funcs
->pCreateBitmap
)
188 dc
->funcs
->pCreateBitmap( hbmpRet
);
190 TRACE_(bitmap
)("\t\t%04x\n", hbmpRet
);
191 GDI_HEAP_UNLOCK(hdc
);
196 /***********************************************************************
197 * CreateBitmapIndirect16 (GDI.49)
199 HBITMAP16 WINAPI
CreateBitmapIndirect16( const BITMAP16
* bmp
)
201 return CreateBitmap16( bmp
->bmWidth
, bmp
->bmHeight
, bmp
->bmPlanes
,
202 bmp
->bmBitsPixel
, PTR_SEG_TO_LIN( bmp
->bmBits
) );
206 /******************************************************************************
207 * CreateBitmapIndirect32 [GDI32.26] Creates a bitmap with the specifies info
210 * Success: Handle to bitmap
213 HBITMAP WINAPI
CreateBitmapIndirect(
214 const BITMAP
* bmp
) /* [in] Pointer to the bitmap data */
216 return CreateBitmap( bmp
->bmWidth
, bmp
->bmHeight
, bmp
->bmPlanes
,
217 bmp
->bmBitsPixel
, bmp
->bmBits
);
221 /***********************************************************************
222 * GetBitmapBits16 (GDI.74)
224 LONG WINAPI
GetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPVOID buffer
)
226 return GetBitmapBits( hbitmap
, count
, buffer
);
230 /***********************************************************************
231 * GetBitmapBits32 [GDI32.143] Copies bitmap bits of bitmap to buffer
234 * Success: Number of bytes copied
237 LONG WINAPI
GetBitmapBits(
238 HBITMAP hbitmap
, /* [in] Handle to bitmap */
239 LONG count
, /* [in] Number of bytes to copy */
240 LPVOID bits
) /* [out] Pointer to buffer to receive bits */
242 BITMAPOBJ
*bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
247 /* If the bits vector is null, the function should return the read size */
249 return bmp
->bitmap
.bmWidthBytes
* bmp
->bitmap
.bmHeight
;
252 WARN_(bitmap
)("(%ld): Negative number of bytes passed???\n", count
);
256 /* Only get entire lines */
257 height
= count
/ bmp
->bitmap
.bmWidthBytes
;
258 if (height
> bmp
->bitmap
.bmHeight
) height
= bmp
->bitmap
.bmHeight
;
259 count
= height
* bmp
->bitmap
.bmWidthBytes
;
262 WARN_(bitmap
)("Less then one entire line requested\n");
263 GDI_HEAP_UNLOCK( hbitmap
);
268 TRACE_(bitmap
)("(%08x, %ld, %p) %dx%d %d colors fetched height: %ld\n",
269 hbitmap
, count
, bits
, bmp
->bitmap
.bmWidth
, bmp
->bitmap
.bmHeight
,
270 1 << bmp
->bitmap
.bmBitsPixel
, height
);
274 TRACE_(bitmap
)("Calling device specific BitmapBits\n");
275 if(bmp
->DDBitmap
->funcs
->pBitmapBits
)
276 ret
= bmp
->DDBitmap
->funcs
->pBitmapBits(hbitmap
, bits
, count
,
279 ERR_(bitmap
)("BitmapBits == NULL??\n");
285 if(!bmp
->bitmap
.bmBits
) {
286 WARN_(bitmap
)("Bitmap is empty\n");
289 memcpy(bits
, bmp
->bitmap
.bmBits
, count
);
295 GDI_HEAP_UNLOCK( hbitmap
);
300 /***********************************************************************
301 * SetBitmapBits16 (GDI.106)
303 LONG WINAPI
SetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPCVOID buffer
)
305 return SetBitmapBits( hbitmap
, count
, buffer
);
309 /******************************************************************************
310 * SetBitmapBits32 [GDI32.303] Sets bits of color data for a bitmap
313 * Success: Number of bytes used in setting the bitmap bits
316 LONG WINAPI
SetBitmapBits(
317 HBITMAP hbitmap
, /* [in] Handle to bitmap */
318 LONG count
, /* [in] Number of bytes in bitmap array */
319 LPCVOID bits
) /* [in] Address of array with bitmap bits */
321 BITMAPOBJ
*bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
324 if ((!bmp
) || (!bits
))
328 WARN_(bitmap
)("(%ld): Negative number of bytes passed???\n", count
);
332 /* Only get entire lines */
333 height
= count
/ bmp
->bitmap
.bmWidthBytes
;
334 if (height
> bmp
->bitmap
.bmHeight
) height
= bmp
->bitmap
.bmHeight
;
335 count
= height
* bmp
->bitmap
.bmWidthBytes
;
337 TRACE_(bitmap
)("(%08x, %ld, %p) %dx%d %d colors fetched height: %ld\n",
338 hbitmap
, count
, bits
, bmp
->bitmap
.bmWidth
, bmp
->bitmap
.bmHeight
,
339 1 << bmp
->bitmap
.bmBitsPixel
, height
);
343 TRACE_(bitmap
)("Calling device specific BitmapBits\n");
344 if(bmp
->DDBitmap
->funcs
->pBitmapBits
)
345 ret
= bmp
->DDBitmap
->funcs
->pBitmapBits(hbitmap
, (void *) bits
,
348 ERR_(bitmap
)("BitmapBits == NULL??\n");
354 if(!bmp
->bitmap
.bmBits
) /* Alloc enough for entire bitmap */
355 bmp
->bitmap
.bmBits
= HeapAlloc( GetProcessHeap(), 0, count
);
356 if(!bmp
->bitmap
.bmBits
) {
357 WARN_(bitmap
)("Unable to allocate bit buffer\n");
360 memcpy(bmp
->bitmap
.bmBits
, bits
, count
);
365 GDI_HEAP_UNLOCK( hbitmap
);
369 /***********************************************************************
370 * LoadImage16 [USER.389]
373 HANDLE16 WINAPI
LoadImage16( HINSTANCE16 hinst
, LPCSTR name
, UINT16 type
,
374 INT16 desiredx
, INT16 desiredy
, UINT16 loadflags
)
376 LPCSTR nameStr
= HIWORD(name
)? PTR_SEG_TO_LIN(name
) : (LPCSTR
)name
;
377 return LoadImageA( hinst
, nameStr
, type
,
378 desiredx
, desiredy
, loadflags
);
381 /**********************************************************************
382 * LoadImageA (USER32.365)
384 * FIXME: implementation lacks some features, see LR_ defines in windows.h
387 HANDLE WINAPI
LoadImageA( HINSTANCE hinst
, LPCSTR name
, UINT type
,
388 INT desiredx
, INT desiredy
, UINT loadflags
)
393 if (HIWORD(name
)) u_name
= HEAP_strdupAtoW(GetProcessHeap(), 0, name
);
394 else u_name
=(LPWSTR
)name
;
395 res
= LoadImageW(hinst
, u_name
, type
, desiredx
, desiredy
, loadflags
);
396 if (HIWORD(name
)) HeapFree(GetProcessHeap(), 0, u_name
);
401 /******************************************************************************
402 * LoadImageW [USER32.366] Loads an icon, cursor, or bitmap
405 * hinst [I] Handle of instance that contains image
406 * name [I] Name of image
407 * type [I] Type of image
408 * desiredx [I] Desired width
409 * desiredy [I] Desired height
410 * loadflags [I] Load flags
413 * Success: Handle to newly loaded image
416 * FIXME: Implementation lacks some features, see LR_ defines in windows.h
418 HANDLE WINAPI
LoadImageW( HINSTANCE hinst
, LPCWSTR name
, UINT type
,
419 INT desiredx
, INT desiredy
, UINT loadflags
)
422 TRACE_(resource
)("(0x%04x,%p,%d,%d,%d,0x%08x)\n",
423 hinst
,name
,type
,desiredx
,desiredy
,loadflags
);
425 TRACE_(resource
)("(0x%04x,%p,%d,%d,%d,0x%08x)\n",
426 hinst
,name
,type
,desiredx
,desiredy
,loadflags
);
428 if (loadflags
& LR_DEFAULTSIZE
) {
429 if (type
== IMAGE_ICON
) {
430 if (!desiredx
) desiredx
= GetSystemMetrics(SM_CXICON
);
431 if (!desiredy
) desiredy
= GetSystemMetrics(SM_CYICON
);
432 } else if (type
== IMAGE_CURSOR
) {
433 if (!desiredx
) desiredx
= GetSystemMetrics(SM_CXCURSOR
);
434 if (!desiredy
) desiredy
= GetSystemMetrics(SM_CYCURSOR
);
437 if (loadflags
& LR_LOADFROMFILE
) loadflags
&= ~LR_SHARED
;
440 return BITMAP_Load( hinst
, name
, loadflags
);
445 UINT palEnts
= GetSystemPaletteEntries(hdc
, 0, 0, NULL
);
450 return CURSORICON_Load(hinst
, name
, desiredx
, desiredy
,
451 palEnts
, FALSE
, loadflags
);
455 return CURSORICON_Load(hinst
, name
, desiredx
, desiredy
,
462 /**********************************************************************
466 HBITMAP
BITMAP_CopyBitmap(HBITMAP hbitmap
)
468 BITMAPOBJ
*bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
476 res
= CreateBitmapIndirect(&bm
);
479 char *buf
= HeapAlloc( GetProcessHeap(), 0, bm
.bmWidthBytes
*
481 GetBitmapBits (hbitmap
, bm
.bmWidthBytes
* bm
.bmHeight
, buf
);
482 SetBitmapBits (res
, bm
.bmWidthBytes
* bm
.bmHeight
, buf
);
483 HeapFree( GetProcessHeap(), 0, buf
);
486 GDI_HEAP_UNLOCK( hbitmap
);
490 /******************************************************************************
491 * CopyImage16 [USER.390] Creates new image and copies attributes to it
494 HICON16 WINAPI
CopyImage16( HANDLE16 hnd
, UINT16 type
, INT16 desiredx
,
495 INT16 desiredy
, UINT16 flags
)
497 return (HICON16
)CopyImage((HANDLE
)hnd
, (UINT
)type
, (INT
)desiredx
,
498 (INT
)desiredy
, (UINT
)flags
);
501 /******************************************************************************
502 * CopyImage32 [USER32.61] Creates new image and copies attributes to it
505 * hnd [I] Handle to image to copy
506 * type [I] Type of image to copy
507 * desiredx [I] Desired width of new image
508 * desiredy [I] Desired height of new image
509 * flags [I] Copy flags
512 * Success: Handle to newly created image
515 * FIXME: implementation still lacks nearly all features, see LR_*
516 * defines in windows.h
518 HICON WINAPI
CopyImage( HANDLE hnd
, UINT type
, INT desiredx
,
519 INT desiredy
, UINT flags
)
524 return BITMAP_CopyBitmap(hnd
);
526 return CopyIcon(hnd
);
528 return CopyCursor(hnd
);
533 /**********************************************************************
536 HBITMAP
BITMAP_Load( HINSTANCE instance
,LPCWSTR name
, UINT loadflags
)
543 BITMAPINFO
*info
, *fix_info
=NULL
;
547 if (!(loadflags
& LR_LOADFROMFILE
)) {
548 if (!instance
) /* OEM bitmap */
553 if (HIWORD((int)name
)) return 0;
554 hdc
= CreateDCA( "DISPLAY", NULL
, NULL
, NULL
);
555 dc
= DC_GetDCPtr( hdc
);
556 if(dc
->funcs
->pLoadOEMResource
)
557 hbitmap
= dc
->funcs
->pLoadOEMResource( LOWORD((int)name
),
559 GDI_HEAP_UNLOCK( hdc
);
564 if (!(hRsrc
= FindResourceW( instance
, name
, RT_BITMAPW
))) return 0;
565 if (!(handle
= LoadResource( instance
, hRsrc
))) return 0;
567 if ((info
= (BITMAPINFO
*)LockResource( handle
)) == NULL
) return 0;
571 if (!(ptr
= (char *)VIRTUAL_MapFileW( name
))) return 0;
572 info
= (BITMAPINFO
*)(ptr
+ sizeof(BITMAPFILEHEADER
));
574 size
= DIB_BitmapInfoSize(info
, DIB_RGB_COLORS
);
575 if ((hFix
= GlobalAlloc(0, size
))) fix_info
=GlobalLock(hFix
);
579 memcpy(fix_info
, info
, size
);
580 pix
= *((LPBYTE
)info
+DIB_BitmapInfoSize(info
, DIB_RGB_COLORS
));
581 DIB_FixColorsToLoadflags(fix_info
, loadflags
, pix
);
582 if ((hdc
= GetDC(0)) != 0) {
583 char *bits
= (char *)info
+ size
;
584 if (loadflags
& LR_CREATEDIBSECTION
) {
586 hbitmap
= CreateDIBSection(hdc
, fix_info
, DIB_RGB_COLORS
, NULL
, 0, 0);
587 GetObjectA(hbitmap
, sizeof(DIBSECTION
), &dib
);
588 SetDIBits(hdc
, hbitmap
, 0, dib
.dsBm
.bmHeight
, bits
, info
,
592 hbitmap
= CreateDIBitmap( hdc
, &fix_info
->bmiHeader
, CBM_INIT
,
593 bits
, fix_info
, DIB_RGB_COLORS
);
600 if (loadflags
& LR_LOADFROMFILE
) UnmapViewOfFile( ptr
);
605 /******************************************************************************
606 * LoadBitmapW [USER32.358] Loads bitmap from the executable file
609 * Success: Handle to specified bitmap
612 HBITMAP WINAPI
LoadBitmapW(
613 HINSTANCE instance
, /* [in] Handle to application instance */
614 LPCWSTR name
) /* [in] Address of bitmap resource name */
616 return LoadImageW( instance
, name
, IMAGE_BITMAP
, 0, 0, 0 );
619 /**********************************************************************
620 * LoadBitmapA (USER32.357)
622 HBITMAP WINAPI
LoadBitmapA( HINSTANCE instance
, LPCSTR name
)
624 return LoadImageA( instance
, name
, IMAGE_BITMAP
, 0, 0, 0 );
627 /**********************************************************************
628 * LoadBitmap16 (USER.175)
630 HBITMAP16 WINAPI
LoadBitmap16( HINSTANCE16 instance
, SEGPTR name
)
632 LPCSTR nameStr
= HIWORD(name
)? PTR_SEG_TO_LIN(name
) : (LPCSTR
)name
;
633 return LoadBitmapA( instance
, nameStr
);
638 /***********************************************************************
639 * BITMAP_DeleteObject
641 BOOL
BITMAP_DeleteObject( HBITMAP16 hbitmap
, BITMAPOBJ
* bmp
)
643 if( bmp
->DDBitmap
) {
644 if( bmp
->DDBitmap
->funcs
->pDeleteObject
)
645 bmp
->DDBitmap
->funcs
->pDeleteObject( hbitmap
);
648 if( bmp
->bitmap
.bmBits
)
649 HeapFree( GetProcessHeap(), 0, bmp
->bitmap
.bmBits
);
651 DIB_DeleteDIBSection( bmp
);
653 return GDI_FreeObject( hbitmap
);
657 /***********************************************************************
660 INT16
BITMAP_GetObject16( BITMAPOBJ
* bmp
, INT16 count
, LPVOID buffer
)
664 if ( count
<= sizeof(BITMAP16
) )
666 BITMAP
*bmp32
= &bmp
->dib
->dsBm
;
668 bmp16
.bmType
= bmp32
->bmType
;
669 bmp16
.bmWidth
= bmp32
->bmWidth
;
670 bmp16
.bmHeight
= bmp32
->bmHeight
;
671 bmp16
.bmWidthBytes
= bmp32
->bmWidthBytes
;
672 bmp16
.bmPlanes
= bmp32
->bmPlanes
;
673 bmp16
.bmBitsPixel
= bmp32
->bmBitsPixel
;
674 bmp16
.bmBits
= (SEGPTR
)0;
675 memcpy( buffer
, &bmp16
, count
);
680 FIXME_(bitmap
)("not implemented for DIBs: count %d\n", count
);
687 bmp16
.bmType
= bmp
->bitmap
.bmType
;
688 bmp16
.bmWidth
= bmp
->bitmap
.bmWidth
;
689 bmp16
.bmHeight
= bmp
->bitmap
.bmHeight
;
690 bmp16
.bmWidthBytes
= bmp
->bitmap
.bmWidthBytes
;
691 bmp16
.bmPlanes
= bmp
->bitmap
.bmPlanes
;
692 bmp16
.bmBitsPixel
= bmp
->bitmap
.bmBitsPixel
;
693 bmp16
.bmBits
= (SEGPTR
)0;
694 if (count
> sizeof(bmp16
)) count
= sizeof(bmp16
);
695 memcpy( buffer
, &bmp16
, count
);
701 /***********************************************************************
704 INT
BITMAP_GetObject( BITMAPOBJ
* bmp
, INT count
, LPVOID buffer
)
708 if (count
< sizeof(DIBSECTION
))
710 if (count
> sizeof(BITMAP
)) count
= sizeof(BITMAP
);
714 if (count
> sizeof(DIBSECTION
)) count
= sizeof(DIBSECTION
);
717 memcpy( buffer
, bmp
->dib
, count
);
722 if (count
> sizeof(BITMAP
)) count
= sizeof(BITMAP
);
723 memcpy( buffer
, &bmp
->bitmap
, count
);
729 /***********************************************************************
730 * CreateDiscardableBitmap16 (GDI.156)
732 HBITMAP16 WINAPI
CreateDiscardableBitmap16( HDC16 hdc
, INT16 width
,
735 return CreateCompatibleBitmap16( hdc
, width
, height
);
739 /******************************************************************************
740 * CreateDiscardableBitmap32 [GDI32.38] Creates a discardable bitmap
743 * Success: Handle to bitmap
746 HBITMAP WINAPI
CreateDiscardableBitmap(
747 HDC hdc
, /* [in] Handle to device context */
748 INT width
, /* [in] Bitmap width */
749 INT height
) /* [in] Bitmap height */
751 return CreateCompatibleBitmap( hdc
, width
, height
);
755 /***********************************************************************
756 * GetBitmapDimensionEx16 (GDI.468)
759 * Can this call GetBitmapDimensionEx32?
761 BOOL16 WINAPI
GetBitmapDimensionEx16( HBITMAP16 hbitmap
, LPSIZE16 size
)
763 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
764 if (!bmp
) return FALSE
;
765 CONV_SIZE32TO16( &bmp
->size
, size
);
766 GDI_HEAP_UNLOCK( hbitmap
);
771 /******************************************************************************
772 * GetBitmapDimensionEx32 [GDI32.144] Retrieves dimensions of a bitmap
778 BOOL WINAPI
GetBitmapDimensionEx(
779 HBITMAP hbitmap
, /* [in] Handle to bitmap */
780 LPSIZE size
) /* [out] Address of struct receiving dimensions */
782 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
783 if (!bmp
) return FALSE
;
785 GDI_HEAP_UNLOCK( hbitmap
);
790 /***********************************************************************
791 * GetBitmapDimension (GDI.162)
793 DWORD WINAPI
GetBitmapDimension16( HBITMAP16 hbitmap
)
796 if (!GetBitmapDimensionEx16( hbitmap
, &size
)) return 0;
797 return MAKELONG( size
.cx
, size
.cy
);
801 /***********************************************************************
802 * SetBitmapDimensionEx16 (GDI.478)
804 BOOL16 WINAPI
SetBitmapDimensionEx16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
,
807 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
808 if (!bmp
) return FALSE
;
809 if (prevSize
) CONV_SIZE32TO16( &bmp
->size
, prevSize
);
812 GDI_HEAP_UNLOCK( hbitmap
);
817 /******************************************************************************
818 * SetBitmapDimensionEx32 [GDI32.304] Assignes dimensions to a bitmap
824 BOOL WINAPI
SetBitmapDimensionEx(
825 HBITMAP hbitmap
, /* [in] Handle to bitmap */
826 INT x
, /* [in] Bitmap width */
827 INT y
, /* [in] Bitmap height */
828 LPSIZE prevSize
) /* [out] Address of structure for orig dims */
830 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
831 if (!bmp
) return FALSE
;
832 if (prevSize
) *prevSize
= bmp
->size
;
835 GDI_HEAP_UNLOCK( hbitmap
);
840 /***********************************************************************
841 * SetBitmapDimension (GDI.163)
843 DWORD WINAPI
SetBitmapDimension16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
)
846 if (!SetBitmapDimensionEx16( hbitmap
, x
, y
, &size
)) return 0;
847 return MAKELONG( size
.cx
, size
.cy
);