2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 IN OPTIONAL LPBYTE pBits
)
38 /* NOTE: Windows also doesn't store nr. of planes separately! */
39 BitsPixel
= BITMAP_GetRealBitsPixel(BitsPixel
* Planes
);
41 /* Check parameters */
42 if (BitsPixel
== 0 || Width
<= 0 || Width
>= 0x8000000 || Height
== 0)
44 DPRINT1("Width = %d, Height = %d BitsPixel = %d\n",
45 Width
, Height
, BitsPixel
);
46 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
50 WidthBytes
= BITMAP_GetWidthBytes(Width
, BitsPixel
);
53 Size
.cy
= abs(Height
);
55 /* Make sure that cjBits will not overflow */
56 if ((ULONGLONG
)WidthBytes
* Size
.cy
>= 0x100000000ULL
)
58 DPRINT1("Width = %d, Height = %d BitsPixel = %d\n",
59 Width
, Height
, BitsPixel
);
60 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
64 /* Create the bitmap object. */
65 hBitmap
= IntCreateBitmap(Size
, WidthBytes
,
66 BitmapFormat(BitsPixel
, BI_RGB
),
67 (Height
< 0 ? BMF_TOPDOWN
: 0) |
68 (NULL
== pBits
? 0 : BMF_NOZEROINIT
), NULL
);
71 DPRINT("IntGdiCreateBitmap: returned 0\n");
75 psurfBmp
= SURFACE_LockSurface(hBitmap
);
78 GreDeleteObject(hBitmap
);
82 psurfBmp
->flFlags
= BITMAPOBJ_IS_APIBITMAP
;
83 psurfBmp
->hDC
= NULL
; // Fixme
87 IntSetBitmapBits(psurfBmp
, psurfBmp
->SurfObj
.cjBits
, pBits
);
90 /* Find a suitable palette for this bitmap
91 * Increment internal objects share count
92 * so we can call PALETTE_ShareUnlockPalette
93 * or GDIOBJ_IncrementShareCount safely */
97 psurfBmp
->ppal
= &gpalMono
;
98 GDIOBJ_IncrementShareCount((POBJ
)&gpalMono
);
102 psurfBmp
->ppal
= PALETTE_ShareLockPalette(StockObjects
[DEFAULT_PALETTE
]);
105 psurfBmp
->ppal
= &gpalRGB555
;
106 GDIOBJ_IncrementShareCount((POBJ
)&gpalRGB555
);
109 psurfBmp
->ppal
= &gpalRGB565
;
110 GDIOBJ_IncrementShareCount((POBJ
)&gpalRGB565
);
113 psurfBmp
->ppal
= &gpalRGB
;
114 GDIOBJ_IncrementShareCount((POBJ
)&gpalRGB
);
117 DPRINT1("Could not determine palette for bit depth %u.\n", BitsPixel
);
121 SURFACE_UnlockSurface(psurfBmp
);
123 DPRINT("IntGdiCreateBitmap : %dx%d, %d BPP colors, topdown %d, returning %08x\n",
124 Size
.cx
, Size
.cy
, BitsPixel
, (Height
< 0 ? 1 : 0), hBitmap
);
136 IN OPTIONAL LPBYTE pUnsafeBits
)
141 UINT cjBits
= BITMAP_GetWidthBytes(Width
, BitsPixel
) * abs(Height
);
143 // FIXME: Use MmSecureVirtualMemory
146 ProbeForRead(pUnsafeBits
, cjBits
, 1);
148 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
157 return IntGdiCreateBitmap(Width
, Height
, Planes
, BitsPixel
, pUnsafeBits
);
161 IntCreateCompatibleBitmap(
168 /* MS doc says if width or height is 0, return 1-by-1 pixel, monochrome bitmap */
169 if (0 == Width
|| 0 == Height
)
171 Bmp
= NtGdiGetStockObject(DEFAULT_BITMAP
);
175 if (Dc
->dctype
!= DC_TYPE_MEMORY
)
180 size
.cx
= abs(Width
);
181 size
.cy
= abs(Height
);
183 Bmp
= IntCreateBitmap(size
,
184 BITMAP_GetWidthBytes(Width
, Dc
->ppdev
->gdiinfo
.cBitsPixel
),
185 Dc
->ppdev
->pSurface
->SurfObj
.iBitmapFormat
,
189 psurf
= SURFACE_LockSurface(Bmp
);
192 psurf
->ppal
= PALETTE_ShareLockPalette(Dc
->ppdev
->devinfo
.hpalDefault
);
194 psurf
->flFlags
= BITMAPOBJ_IS_APIBITMAP
;
195 psurf
->hDC
= NULL
; // Fixme
196 SURFACE_UnlockSurface(psurf
);
202 PSURFACE psurf
= Dc
->dclevel
.pSurface
;
203 Count
= BITMAP_GetObject(psurf
, sizeof(dibs
), &dibs
);
207 if (Count
== sizeof(BITMAP
))
211 size
.cx
= abs(Width
);
212 size
.cy
= abs(Height
);
213 Bmp
= IntCreateBitmap(size
,
214 BITMAP_GetWidthBytes(Width
, dibs
.dsBm
.bmBitsPixel
),
215 psurf
->SurfObj
.iBitmapFormat
,
218 psurfBmp
= SURFACE_LockSurface(Bmp
);
221 psurfBmp
->ppal
= psurf
->ppal
;
222 GDIOBJ_IncrementShareCount((POBJ
)psurf
->ppal
);
224 psurfBmp
->flFlags
= BITMAPOBJ_IS_APIBITMAP
;
225 psurfBmp
->hDC
= NULL
; // Fixme
226 SURFACE_UnlockSurface(psurfBmp
);
230 /* A DIB section is selected in the DC */
234 /* Allocate memory for a BITMAPINFOHEADER structure and a
235 color table. The maximum number of colors in a color table
236 is 256 which corresponds to a bitmap with depth 8.
237 Bitmaps with higher depths don't have color tables. */
238 bi
= ExAllocatePoolWithTag(PagedPool
,
239 sizeof(BITMAPINFOHEADER
) +
240 256 * sizeof(RGBQUAD
),
245 bi
->bmiHeader
.biSize
= sizeof(bi
->bmiHeader
);
246 bi
->bmiHeader
.biWidth
= Width
;
247 bi
->bmiHeader
.biHeight
= Height
;
248 bi
->bmiHeader
.biPlanes
= dibs
.dsBmih
.biPlanes
;
249 bi
->bmiHeader
.biBitCount
= dibs
.dsBmih
.biBitCount
;
250 bi
->bmiHeader
.biCompression
= dibs
.dsBmih
.biCompression
;
251 bi
->bmiHeader
.biSizeImage
= 0;
252 bi
->bmiHeader
.biXPelsPerMeter
= dibs
.dsBmih
.biXPelsPerMeter
;
253 bi
->bmiHeader
.biYPelsPerMeter
= dibs
.dsBmih
.biYPelsPerMeter
;
254 bi
->bmiHeader
.biClrUsed
= dibs
.dsBmih
.biClrUsed
;
255 bi
->bmiHeader
.biClrImportant
= dibs
.dsBmih
.biClrImportant
;
257 if (bi
->bmiHeader
.biCompression
== BI_BITFIELDS
)
259 /* Copy the color masks */
260 RtlCopyMemory(bi
->bmiColors
, dibs
.dsBitfields
, 3 * sizeof(DWORD
));
262 else if (bi
->bmiHeader
.biBitCount
<= 8)
264 /* Copy the color table */
270 ExFreePoolWithTag(bi
, TAG_TEMP
);
271 SetLastWin32Error(ERROR_INVALID_HANDLE
);
275 PalGDI
= PALETTE_LockPalette(psurf
->ppal
->BaseObject
.hHmgr
);
278 Index
< 256 && Index
< PalGDI
->NumColors
;
281 bi
->bmiColors
[Index
].rgbRed
= PalGDI
->IndexedColors
[Index
].peRed
;
282 bi
->bmiColors
[Index
].rgbGreen
= PalGDI
->IndexedColors
[Index
].peGreen
;
283 bi
->bmiColors
[Index
].rgbBlue
= PalGDI
->IndexedColors
[Index
].peBlue
;
284 bi
->bmiColors
[Index
].rgbReserved
= 0;
286 PALETTE_UnlockPalette(PalGDI
);
289 Bmp
= DIB_CreateDIBSection(Dc
,
297 ExFreePoolWithTag(bi
, TAG_TEMP
);
308 NtGdiCreateCompatibleBitmap(
316 if (Width
<= 0 || Height
<= 0 || (Width
* Height
) > 0x3FFFFFFF)
318 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
323 return IntGdiCreateBitmap(Width
, Height
, 1, 1, 0);
327 DPRINT("NtGdiCreateCompatibleBitmap(%04x,%d,%d, bpp:%d) = \n",
328 hDC
, Width
, Height
, Dc
->ppdev
->gdiinfo
.cBitsPixel
);
332 SetLastWin32Error(ERROR_INVALID_HANDLE
);
336 Bmp
= IntCreateCompatibleBitmap(Dc
, Width
, Height
);
338 DPRINT("\t\t%04x\n", Bmp
);
344 NtGdiGetBitmapDimension(
354 psurfBmp
= SURFACE_LockSurface(hBitmap
);
355 if (psurfBmp
== NULL
)
357 SetLastWin32Error(ERROR_INVALID_HANDLE
);
363 ProbeForWrite(Dimension
, sizeof(SIZE
), 1);
364 *Dimension
= psurfBmp
->dimension
;
366 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
372 SURFACE_UnlockSurface(psurfBmp
);
378 NtGdiGetPixel(HDC hDC
, INT XPos
, INT YPos
)
381 COLORREF Result
= (COLORREF
)CLR_INVALID
; // default to failure
382 BOOL bInRect
= FALSE
;
393 SetLastWin32Error(ERROR_INVALID_HANDLE
);
397 if (dc
->dctype
== DC_TYPE_INFO
)
403 XPos
+= dc
->ptlDCOrig
.x
;
404 YPos
+= dc
->ptlDCOrig
.y
;
405 if (RECTL_bPointInRect(&dc
->rosdc
.CombinedClip
->rclBounds
, XPos
, YPos
))
408 psurf
= dc
->dclevel
.pSurface
;
411 pso
= &psurf
->SurfObj
;
415 GDIOBJ_IncrementShareCount(&ppal
->BaseObject
);
418 ppal
= PALETTE_ShareLockPalette(dc
->ppdev
->devinfo
.hpalDefault
);
420 if (psurf
->SurfObj
.iBitmapFormat
== BMF_1BPP
&& !psurf
->hSecure
)
422 /* FIXME: palette should be gpalMono already ! */
423 EXLATEOBJ_vInitialize(&exlo
, &gpalMono
, &gpalRGB
, 0, 0xffffff, 0);
427 EXLATEOBJ_vInitialize(&exlo
, ppal
, &gpalRGB
, 0, 0xffffff, 0);
430 // check if this DC has a DIB behind it...
431 if (pso
->pvScan0
) // STYPE_BITMAP == pso->iType
434 Result
= XLATEOBJ_iXlate(&exlo
.xlo
,
435 DibFunctionsForBitmapFormat
[pso
->iBitmapFormat
].DIB_GetPixel(pso
, XPos
, YPos
));
438 EXLATEOBJ_vCleanup(&exlo
);
439 PALETTE_ShareUnlockPalette(ppal
);
444 // if Result is still CLR_INVALID, then the "quick" method above didn't work
445 if (bInRect
&& Result
== CLR_INVALID
)
447 // FIXME: create a 1x1 32BPP DIB, and blit to it
448 HDC hDCTmp
= NtGdiCreateCompatibleDC(hDC
);
451 static const BITMAPINFOHEADER bih
= { sizeof(BITMAPINFOHEADER
), 1, 1, 1, 32, BI_RGB
, 0, 0, 0, 0, 0 };
453 RtlMoveMemory(&(bi
.bmiHeader
), &bih
, sizeof(bih
));
454 hBmpTmp
= NtGdiCreateDIBitmapInternal(hDC
,
455 bi
.bmiHeader
.biWidth
,
456 bi
.bmiHeader
.biHeight
,
461 bi
.bmiHeader
.biBitCount
,
462 bi
.bmiHeader
.biSizeImage
,
466 //HBITMAP hBmpTmp = IntGdiCreateBitmap(1, 1, 1, 32, NULL);
469 HBITMAP hBmpOld
= (HBITMAP
)NtGdiSelectBitmap(hDCTmp
, hBmpTmp
);
474 NtGdiBitBlt(hDCTmp
, 0, 0, 1, 1, hDC
, XPos
, YPos
, SRCCOPY
, 0, 0);
475 NtGdiSelectBitmap(hDCTmp
, hBmpOld
);
477 // our bitmap is no longer selected, so we can access it's stuff...
478 psurf
= SURFACE_LockSurface(hBmpTmp
);
481 // Dont you need to convert something here?
482 Result
= *(COLORREF
*)psurf
->SurfObj
.pvScan0
;
483 SURFACE_UnlockSurface(psurf
);
486 GreDeleteObject(hBmpTmp
);
488 NtGdiDeleteObjectApp(hDCTmp
);
506 /* Don't copy more bytes than the buffer has */
507 Bytes
= min(Bytes
, psurf
->SurfObj
.cjBits
);
510 /* FIXME: Call DDI CopyBits here if available */
513 DPRINT("Calling device specific BitmapBits\n");
514 if (psurf
->DDBitmap
->funcs
->pBitmapBits
)
516 ret
= psurf
->DDBitmap
->funcs
->pBitmapBits(hbitmap
,
523 ERR_(bitmap
)("BitmapBits == NULL??\n");
530 RtlCopyMemory(Bits
, psurf
->SurfObj
.pvBits
, Bytes
);
540 OUT OPTIONAL PBYTE pUnsafeBits
)
545 if (pUnsafeBits
!= NULL
&& Bytes
== 0)
550 psurf
= SURFACE_LockSurface(hBitmap
);
553 SetLastWin32Error(ERROR_INVALID_HANDLE
);
557 bmSize
= BITMAP_GetWidthBytes(psurf
->SurfObj
.sizlBitmap
.cx
,
558 BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
)) *
559 abs(psurf
->SurfObj
.sizlBitmap
.cy
);
561 /* If the bits vector is null, the function should return the read size */
562 if (pUnsafeBits
== NULL
)
564 SURFACE_UnlockSurface(psurf
);
568 /* Don't copy more bytes than the buffer has */
569 Bytes
= min(Bytes
, bmSize
);
571 // FIXME: use MmSecureVirtualMemory
574 ProbeForWrite(pUnsafeBits
, Bytes
, 1);
575 ret
= IntGetBitmapBits(psurf
, Bytes
, pUnsafeBits
);
577 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
583 SURFACE_UnlockSurface(psurf
);
597 /* Don't copy more bytes than the buffer has */
598 Bytes
= min(Bytes
, psurf
->SurfObj
.cjBits
);
601 /* FIXME: call DDI specific function here if available */
604 DPRINT("Calling device specific BitmapBits\n");
605 if (psurf
->DDBitmap
->funcs
->pBitmapBits
)
607 ret
= psurf
->DDBitmap
->funcs
->pBitmapBits(hBitmap
,
614 DPRINT("BitmapBits == NULL??\n");
621 RtlCopyMemory(psurf
->SurfObj
.pvBits
, Bits
, Bytes
);
633 IN PBYTE pUnsafeBits
)
638 if (pUnsafeBits
== NULL
|| Bytes
== 0)
643 psurf
= SURFACE_LockSurface(hBitmap
);
646 SetLastWin32Error(ERROR_INVALID_HANDLE
);
652 ProbeForRead(pUnsafeBits
, Bytes
, 1);
653 ret
= IntSetBitmapBits(psurf
, Bytes
, pUnsafeBits
);
655 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
661 SURFACE_UnlockSurface(psurf
);
667 NtGdiSetBitmapDimension(
679 psurf
= SURFACE_LockSurface(hBitmap
);
682 SetLastWin32Error(ERROR_INVALID_HANDLE
);
690 ProbeForWrite(Size
, sizeof(SIZE
), 1);
691 *Size
= psurf
->dimension
;
693 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
700 /* The dimension is changed even if writing the old value failed */
701 psurf
->dimension
.cx
= Width
;
702 psurf
->dimension
.cy
= Height
;
704 SURFACE_UnlockSurface(psurf
);
709 VOID
IntHandleSpecialColorType(HDC hDC
, COLORREF
* Color
)
713 PALETTEENTRY palEntry
;
716 switch (*Color
>> 24)
718 case 0x10: /* DIBINDEX */
719 if (IntGetDIBColorTable(hDC
, LOWORD(*Color
), 1, &quad
) == 1)
721 *Color
= RGB(quad
.rgbRed
, quad
.rgbGreen
, quad
.rgbBlue
);
725 /* Out of color table bounds - use black */
726 *Color
= RGB(0, 0, 0);
729 case 0x02: /* PALETTERGB */
730 pdc
= DC_LockDc(hDC
);
731 if (pdc
->dclevel
.hpal
!= NtGdiGetStockObject(DEFAULT_PALETTE
))
733 index
= NtGdiGetNearestPaletteIndex(pdc
->dclevel
.hpal
, *Color
);
734 IntGetPaletteEntries(pdc
->dclevel
.hpal
, index
, 1, &palEntry
);
735 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
739 /* Use the pure color */
740 *Color
= *Color
& 0x00FFFFFF;
744 case 0x01: /* PALETTEINDEX */
745 pdc
= DC_LockDc(hDC
);
746 if (IntGetPaletteEntries(pdc
->dclevel
.hpal
, LOWORD(*Color
), 1, &palEntry
) == 1)
748 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
752 /* Index does not exist, use zero index */
753 IntGetPaletteEntries(pdc
->dclevel
.hpal
, 0, 1, &palEntry
);
754 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
759 DPRINT("Unsupported color type %d passed\n", *Color
>> 24);
774 if ((Color
& 0xFF000000) != 0)
776 IntHandleSpecialColorType(hDC
, &Color
);
779 hBrush
= NtGdiCreateSolidBrush(Color
, NULL
);
783 OldBrush
= NtGdiSelectBrush(hDC
, hBrush
);
784 if (OldBrush
== NULL
)
786 GreDeleteObject(hBrush
);
790 NtGdiPatBlt(hDC
, X
, Y
, 1, 1, PATCOPY
);
791 NtGdiSelectBrush(hDC
, OldBrush
);
792 GreDeleteObject(hBrush
);
804 DPRINT("0 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
806 if (GdiSetPixelV(hDC
,X
,Y
,Color
))
808 Color
= NtGdiGetPixel(hDC
,X
,Y
);
809 DPRINT("1 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
813 Color
= (COLORREF
)CLR_INVALID
;
814 DPRINT("2 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
819 /* Internal Functions */
822 BITMAP_GetRealBitsPixel(UINT nBitsPixel
)
830 if (nBitsPixel
<= 16)
832 if (nBitsPixel
<= 24)
834 if (nBitsPixel
<= 32)
841 BITMAP_GetWidthBytes(INT bmWidth
, INT bpp
)
847 return 2 * ((bmWidth
+15) >> 4);
850 bmWidth
*= 3; /* fall through */
852 return bmWidth
+ (bmWidth
& 1);
862 return 2 * ((bmWidth
+3) >> 2);
871 return ((bmWidth
* bpp
+ 15) & ~15) >> 3;
875 BITMAP_CopyBitmap(HBITMAP hBitmap
)
879 SURFACE
*Bitmap
, *resBitmap
;
887 Bitmap
= GDIOBJ_LockObj(hBitmap
, GDI_OBJECT_TYPE_BITMAP
);
893 BITMAP_GetObject(Bitmap
, sizeof(BITMAP
), (PVOID
)&bm
);
895 if (Bitmap
->SurfObj
.lDelta
>= 0)
896 bm
.bmHeight
= -bm
.bmHeight
;
898 Size
.cx
= abs(bm
.bmWidth
);
899 Size
.cy
= abs(bm
.bmHeight
);
900 res
= IntCreateBitmap(Size
,
902 BitmapFormat(bm
.bmBitsPixel
* bm
.bmPlanes
, BI_RGB
),
903 (bm
.bmHeight
< 0 ? BMF_TOPDOWN
: 0) | BMF_NOZEROINIT
,
910 resBitmap
= GDIOBJ_LockObj(res
, GDI_OBJECT_TYPE_BITMAP
);
913 buf
= ExAllocatePoolWithTag(PagedPool
,
914 bm
.bmWidthBytes
* abs(bm
.bmHeight
),
918 GDIOBJ_UnlockObjByPtr((POBJ
)resBitmap
);
919 GDIOBJ_UnlockObjByPtr((POBJ
)Bitmap
);
920 GreDeleteObject(res
);
923 IntGetBitmapBits(Bitmap
, bm
.bmWidthBytes
* abs(bm
.bmHeight
), buf
);
924 IntSetBitmapBits(resBitmap
, bm
.bmWidthBytes
* abs(bm
.bmHeight
), buf
);
925 ExFreePoolWithTag(buf
,TAG_BITMAP
);
926 resBitmap
->flFlags
= Bitmap
->flFlags
;
930 resBitmap
->ppal
= Bitmap
->ppal
;
931 GDIOBJ_IncrementShareCount(&Bitmap
->ppal
->BaseObject
);
933 GDIOBJ_UnlockObjByPtr((POBJ
)resBitmap
);
937 GreDeleteObject(res
);
942 GDIOBJ_UnlockObjByPtr((POBJ
)Bitmap
);
948 BITMAP_GetObject(SURFACE
*psurf
, INT Count
, LPVOID buffer
)
952 if (!buffer
) return sizeof(BITMAP
);
953 if ((UINT
)Count
< sizeof(BITMAP
)) return 0;
955 /* always fill a basic BITMAP structure */
958 pBitmap
->bmWidth
= psurf
->SurfObj
.sizlBitmap
.cx
;
959 pBitmap
->bmHeight
= psurf
->SurfObj
.sizlBitmap
.cy
;
960 pBitmap
->bmWidthBytes
= abs(psurf
->SurfObj
.lDelta
);
961 pBitmap
->bmPlanes
= 1;
962 pBitmap
->bmBitsPixel
= BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
);
964 /* Check for DIB section */
967 /* Set bmBits in this case */
968 pBitmap
->bmBits
= psurf
->SurfObj
.pvBits
;
970 if (Count
>= sizeof(DIBSECTION
))
972 /* Fill rest of DIBSECTION */
973 PDIBSECTION pds
= buffer
;
975 pds
->dsBmih
.biSize
= sizeof(BITMAPINFOHEADER
);
976 pds
->dsBmih
.biWidth
= pds
->dsBm
.bmWidth
;
977 pds
->dsBmih
.biHeight
= pds
->dsBm
.bmHeight
;
978 pds
->dsBmih
.biPlanes
= pds
->dsBm
.bmPlanes
;
979 pds
->dsBmih
.biBitCount
= pds
->dsBm
.bmBitsPixel
;
980 switch (psurf
->SurfObj
.iBitmapFormat
)
982 /* FIXME: What about BI_BITFIELDS? */
989 pds
->dsBmih
.biCompression
= BI_RGB
;
992 pds
->dsBmih
.biCompression
= BI_RLE4
;
995 pds
->dsBmih
.biCompression
= BI_RLE8
;
998 pds
->dsBmih
.biCompression
= BI_JPEG
;
1001 pds
->dsBmih
.biCompression
= BI_PNG
;
1004 pds
->dsBmih
.biSizeImage
= psurf
->SurfObj
.cjBits
;
1005 pds
->dsBmih
.biXPelsPerMeter
= 0;
1006 pds
->dsBmih
.biYPelsPerMeter
= 0;
1007 pds
->dsBmih
.biClrUsed
= psurf
->biClrUsed
;
1008 pds
->dsBmih
.biClrImportant
= psurf
->biClrImportant
;
1009 pds
->dsBitfields
[0] = psurf
->dsBitfields
[0];
1010 pds
->dsBitfields
[1] = psurf
->dsBitfields
[1];
1011 pds
->dsBitfields
[2] = psurf
->dsBitfields
[2];
1012 pds
->dshSection
= psurf
->hDIBSection
;
1013 pds
->dsOffset
= psurf
->dwOffset
;
1015 return sizeof(DIBSECTION
);
1020 /* not set according to wine test, confirmed in win2k */
1021 pBitmap
->bmBits
= NULL
;
1024 return sizeof(BITMAP
);
1032 NtGdiGetDCforBitmap(
1036 PSURFACE psurf
= SURFACE_LockSurface(hsurf
);
1040 SURFACE_UnlockSurface(psurf
);