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
);
114 psurfBmp
->ppal
= &gpalRGB
;
115 GDIOBJ_IncrementShareCount((POBJ
)&gpalRGB
);
118 DPRINT1("Could not determine palette for bit depth %u.\n", BitsPixel
);
122 SURFACE_UnlockSurface(psurfBmp
);
124 DPRINT("IntGdiCreateBitmap : %dx%d, %d BPP colors, topdown %d, returning %08x\n",
125 Size
.cx
, Size
.cy
, BitsPixel
, (Height
< 0 ? 1 : 0), hBitmap
);
137 IN OPTIONAL LPBYTE pUnsafeBits
)
142 UINT cjBits
= BITMAP_GetWidthBytes(Width
, BitsPixel
) * abs(Height
);
144 // FIXME: Use MmSecureVirtualMemory
147 ProbeForRead(pUnsafeBits
, cjBits
, 1);
149 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
158 return IntGdiCreateBitmap(Width
, Height
, Planes
, BitsPixel
, pUnsafeBits
);
162 IntCreateCompatibleBitmap(
169 /* MS doc says if width or height is 0, return 1-by-1 pixel, monochrome bitmap */
170 if (0 == Width
|| 0 == Height
)
172 Bmp
= NtGdiGetStockObject(DEFAULT_BITMAP
);
176 if (Dc
->dctype
!= DC_TYPE_MEMORY
)
181 size
.cx
= abs(Width
);
182 size
.cy
= abs(Height
);
184 Bmp
= IntCreateBitmap(size
,
185 BITMAP_GetWidthBytes(Width
, Dc
->ppdev
->gdiinfo
.cBitsPixel
),
186 Dc
->ppdev
->pSurface
->SurfObj
.iBitmapFormat
,
190 psurf
= SURFACE_LockSurface(Bmp
);
193 psurf
->ppal
= PALETTE_ShareLockPalette(Dc
->ppdev
->devinfo
.hpalDefault
);
195 psurf
->flFlags
= BITMAPOBJ_IS_APIBITMAP
;
196 psurf
->hDC
= NULL
; // Fixme
197 SURFACE_UnlockSurface(psurf
);
203 PSURFACE psurf
= Dc
->dclevel
.pSurface
;
204 Count
= BITMAP_GetObject(psurf
, sizeof(dibs
), &dibs
);
208 if (Count
== sizeof(BITMAP
))
212 size
.cx
= abs(Width
);
213 size
.cy
= abs(Height
);
214 Bmp
= IntCreateBitmap(size
,
215 BITMAP_GetWidthBytes(Width
, dibs
.dsBm
.bmBitsPixel
),
216 psurf
->SurfObj
.iBitmapFormat
,
219 psurfBmp
= SURFACE_LockSurface(Bmp
);
222 psurfBmp
->ppal
= psurf
->ppal
;
223 GDIOBJ_IncrementShareCount((POBJ
)psurf
->ppal
);
225 psurfBmp
->flFlags
= BITMAPOBJ_IS_APIBITMAP
;
226 psurfBmp
->hDC
= NULL
; // Fixme
227 SURFACE_UnlockSurface(psurfBmp
);
231 /* A DIB section is selected in the DC */
235 /* Allocate memory for a BITMAPINFOHEADER structure and a
236 color table. The maximum number of colors in a color table
237 is 256 which corresponds to a bitmap with depth 8.
238 Bitmaps with higher depths don't have color tables. */
239 bi
= ExAllocatePoolWithTag(PagedPool
,
240 sizeof(BITMAPINFOHEADER
) +
241 256 * sizeof(RGBQUAD
),
246 bi
->bmiHeader
.biSize
= sizeof(bi
->bmiHeader
);
247 bi
->bmiHeader
.biWidth
= Width
;
248 bi
->bmiHeader
.biHeight
= Height
;
249 bi
->bmiHeader
.biPlanes
= dibs
.dsBmih
.biPlanes
;
250 bi
->bmiHeader
.biBitCount
= dibs
.dsBmih
.biBitCount
;
251 bi
->bmiHeader
.biCompression
= dibs
.dsBmih
.biCompression
;
252 bi
->bmiHeader
.biSizeImage
= 0;
253 bi
->bmiHeader
.biXPelsPerMeter
= dibs
.dsBmih
.biXPelsPerMeter
;
254 bi
->bmiHeader
.biYPelsPerMeter
= dibs
.dsBmih
.biYPelsPerMeter
;
255 bi
->bmiHeader
.biClrUsed
= dibs
.dsBmih
.biClrUsed
;
256 bi
->bmiHeader
.biClrImportant
= dibs
.dsBmih
.biClrImportant
;
258 if (bi
->bmiHeader
.biCompression
== BI_BITFIELDS
)
260 /* Copy the color masks */
261 RtlCopyMemory(bi
->bmiColors
, dibs
.dsBitfields
, 3 * sizeof(DWORD
));
263 else if (bi
->bmiHeader
.biBitCount
<= 8)
265 /* Copy the color table */
271 ExFreePoolWithTag(bi
, TAG_TEMP
);
272 SetLastWin32Error(ERROR_INVALID_HANDLE
);
276 PalGDI
= PALETTE_LockPalette(psurf
->ppal
->BaseObject
.hHmgr
);
279 Index
< 256 && Index
< PalGDI
->NumColors
;
282 bi
->bmiColors
[Index
].rgbRed
= PalGDI
->IndexedColors
[Index
].peRed
;
283 bi
->bmiColors
[Index
].rgbGreen
= PalGDI
->IndexedColors
[Index
].peGreen
;
284 bi
->bmiColors
[Index
].rgbBlue
= PalGDI
->IndexedColors
[Index
].peBlue
;
285 bi
->bmiColors
[Index
].rgbReserved
= 0;
287 PALETTE_UnlockPalette(PalGDI
);
290 Bmp
= DIB_CreateDIBSection(Dc
,
298 ExFreePoolWithTag(bi
, TAG_TEMP
);
309 NtGdiCreateCompatibleBitmap(
317 if (Width
<= 0 || Height
<= 0 || (Width
* Height
) > 0x3FFFFFFF)
319 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
324 return IntGdiCreateBitmap(Width
, Height
, 1, 1, 0);
328 DPRINT("NtGdiCreateCompatibleBitmap(%04x,%d,%d, bpp:%d) = \n",
329 hDC
, Width
, Height
, Dc
->ppdev
->gdiinfo
.cBitsPixel
);
333 SetLastWin32Error(ERROR_INVALID_HANDLE
);
337 Bmp
= IntCreateCompatibleBitmap(Dc
, Width
, Height
);
339 DPRINT("\t\t%04x\n", Bmp
);
345 NtGdiGetBitmapDimension(
355 psurfBmp
= SURFACE_LockSurface(hBitmap
);
356 if (psurfBmp
== NULL
)
358 SetLastWin32Error(ERROR_INVALID_HANDLE
);
364 ProbeForWrite(Dimension
, sizeof(SIZE
), 1);
365 *Dimension
= psurfBmp
->dimension
;
367 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
373 SURFACE_UnlockSurface(psurfBmp
);
379 NtGdiGetPixel(HDC hDC
, INT XPos
, INT YPos
)
382 COLORREF Result
= (COLORREF
)CLR_INVALID
; // default to failure
383 BOOL bInRect
= FALSE
;
394 SetLastWin32Error(ERROR_INVALID_HANDLE
);
398 if (dc
->dctype
== DC_TYPE_INFO
)
404 XPos
+= dc
->ptlDCOrig
.x
;
405 YPos
+= dc
->ptlDCOrig
.y
;
406 if (RECTL_bPointInRect(&dc
->rosdc
.CombinedClip
->rclBounds
, XPos
, YPos
))
409 psurf
= dc
->dclevel
.pSurface
;
412 pso
= &psurf
->SurfObj
;
416 GDIOBJ_IncrementShareCount(&ppal
->BaseObject
);
419 ppal
= PALETTE_ShareLockPalette(dc
->ppdev
->devinfo
.hpalDefault
);
421 if (psurf
->SurfObj
.iBitmapFormat
== BMF_1BPP
&& !psurf
->hSecure
)
423 /* FIXME: palette should be gpalMono already ! */
424 EXLATEOBJ_vInitialize(&exlo
, &gpalMono
, &gpalRGB
, 0, 0xffffff, 0);
428 EXLATEOBJ_vInitialize(&exlo
, ppal
, &gpalRGB
, 0, 0xffffff, 0);
431 // check if this DC has a DIB behind it...
432 if (pso
->pvScan0
) // STYPE_BITMAP == pso->iType
435 Result
= XLATEOBJ_iXlate(&exlo
.xlo
,
436 DibFunctionsForBitmapFormat
[pso
->iBitmapFormat
].DIB_GetPixel(pso
, XPos
, YPos
));
439 EXLATEOBJ_vCleanup(&exlo
);
440 PALETTE_ShareUnlockPalette(ppal
);
445 // if Result is still CLR_INVALID, then the "quick" method above didn't work
446 if (bInRect
&& Result
== CLR_INVALID
)
448 // FIXME: create a 1x1 32BPP DIB, and blit to it
449 HDC hDCTmp
= NtGdiCreateCompatibleDC(hDC
);
452 static const BITMAPINFOHEADER bih
= { sizeof(BITMAPINFOHEADER
), 1, 1, 1, 32, BI_RGB
, 0, 0, 0, 0, 0 };
454 RtlMoveMemory(&(bi
.bmiHeader
), &bih
, sizeof(bih
));
455 hBmpTmp
= NtGdiCreateDIBitmapInternal(hDC
,
456 bi
.bmiHeader
.biWidth
,
457 bi
.bmiHeader
.biHeight
,
462 bi
.bmiHeader
.biBitCount
,
463 bi
.bmiHeader
.biSizeImage
,
467 //HBITMAP hBmpTmp = IntGdiCreateBitmap(1, 1, 1, 32, NULL);
470 HBITMAP hBmpOld
= (HBITMAP
)NtGdiSelectBitmap(hDCTmp
, hBmpTmp
);
475 NtGdiBitBlt(hDCTmp
, 0, 0, 1, 1, hDC
, XPos
, YPos
, SRCCOPY
, 0, 0);
476 NtGdiSelectBitmap(hDCTmp
, hBmpOld
);
478 // our bitmap is no longer selected, so we can access it's stuff...
479 psurf
= SURFACE_LockSurface(hBmpTmp
);
482 // Dont you need to convert something here?
483 Result
= *(COLORREF
*)psurf
->SurfObj
.pvScan0
;
484 SURFACE_UnlockSurface(psurf
);
487 GreDeleteObject(hBmpTmp
);
489 NtGdiDeleteObjectApp(hDCTmp
);
507 /* Don't copy more bytes than the buffer has */
508 Bytes
= min(Bytes
, psurf
->SurfObj
.cjBits
);
511 /* FIXME: Call DDI CopyBits here if available */
514 DPRINT("Calling device specific BitmapBits\n");
515 if (psurf
->DDBitmap
->funcs
->pBitmapBits
)
517 ret
= psurf
->DDBitmap
->funcs
->pBitmapBits(hbitmap
,
524 ERR_(bitmap
)("BitmapBits == NULL??\n");
531 RtlCopyMemory(Bits
, psurf
->SurfObj
.pvBits
, Bytes
);
541 OUT OPTIONAL PBYTE pUnsafeBits
)
546 if (pUnsafeBits
!= NULL
&& Bytes
== 0)
551 psurf
= SURFACE_LockSurface(hBitmap
);
554 SetLastWin32Error(ERROR_INVALID_HANDLE
);
558 bmSize
= BITMAP_GetWidthBytes(psurf
->SurfObj
.sizlBitmap
.cx
,
559 BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
)) *
560 abs(psurf
->SurfObj
.sizlBitmap
.cy
);
562 /* If the bits vector is null, the function should return the read size */
563 if (pUnsafeBits
== NULL
)
565 SURFACE_UnlockSurface(psurf
);
569 /* Don't copy more bytes than the buffer has */
570 Bytes
= min(Bytes
, bmSize
);
572 // FIXME: use MmSecureVirtualMemory
575 ProbeForWrite(pUnsafeBits
, Bytes
, 1);
576 ret
= IntGetBitmapBits(psurf
, Bytes
, pUnsafeBits
);
578 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
584 SURFACE_UnlockSurface(psurf
);
598 /* Don't copy more bytes than the buffer has */
599 Bytes
= min(Bytes
, psurf
->SurfObj
.cjBits
);
602 /* FIXME: call DDI specific function here if available */
605 DPRINT("Calling device specific BitmapBits\n");
606 if (psurf
->DDBitmap
->funcs
->pBitmapBits
)
608 ret
= psurf
->DDBitmap
->funcs
->pBitmapBits(hBitmap
,
615 DPRINT("BitmapBits == NULL??\n");
622 RtlCopyMemory(psurf
->SurfObj
.pvBits
, Bits
, Bytes
);
634 IN PBYTE pUnsafeBits
)
639 if (pUnsafeBits
== NULL
|| Bytes
== 0)
644 psurf
= SURFACE_LockSurface(hBitmap
);
647 SetLastWin32Error(ERROR_INVALID_HANDLE
);
653 ProbeForRead(pUnsafeBits
, Bytes
, 1);
654 ret
= IntSetBitmapBits(psurf
, Bytes
, pUnsafeBits
);
656 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
662 SURFACE_UnlockSurface(psurf
);
668 NtGdiSetBitmapDimension(
680 psurf
= SURFACE_LockSurface(hBitmap
);
683 SetLastWin32Error(ERROR_INVALID_HANDLE
);
691 ProbeForWrite(Size
, sizeof(SIZE
), 1);
692 *Size
= psurf
->dimension
;
694 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
701 /* The dimension is changed even if writing the old value failed */
702 psurf
->dimension
.cx
= Width
;
703 psurf
->dimension
.cy
= Height
;
705 SURFACE_UnlockSurface(psurf
);
710 VOID
IntHandleSpecialColorType(HDC hDC
, COLORREF
* Color
)
714 PALETTEENTRY palEntry
;
717 switch (*Color
>> 24)
719 case 0x10: /* DIBINDEX */
720 if (IntGetDIBColorTable(hDC
, LOWORD(*Color
), 1, &quad
) == 1)
722 *Color
= RGB(quad
.rgbRed
, quad
.rgbGreen
, quad
.rgbBlue
);
726 /* Out of color table bounds - use black */
727 *Color
= RGB(0, 0, 0);
730 case 0x02: /* PALETTERGB */
731 pdc
= DC_LockDc(hDC
);
732 if (pdc
->dclevel
.hpal
!= NtGdiGetStockObject(DEFAULT_PALETTE
))
734 index
= NtGdiGetNearestPaletteIndex(pdc
->dclevel
.hpal
, *Color
);
735 IntGetPaletteEntries(pdc
->dclevel
.hpal
, index
, 1, &palEntry
);
736 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
740 /* Use the pure color */
741 *Color
= *Color
& 0x00FFFFFF;
745 case 0x01: /* PALETTEINDEX */
746 pdc
= DC_LockDc(hDC
);
747 if (IntGetPaletteEntries(pdc
->dclevel
.hpal
, LOWORD(*Color
), 1, &palEntry
) == 1)
749 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
753 /* Index does not exist, use zero index */
754 IntGetPaletteEntries(pdc
->dclevel
.hpal
, 0, 1, &palEntry
);
755 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
760 DPRINT("Unsupported color type %d passed\n", *Color
>> 24);
775 if ((Color
& 0xFF000000) != 0)
777 IntHandleSpecialColorType(hDC
, &Color
);
780 hBrush
= NtGdiCreateSolidBrush(Color
, NULL
);
784 OldBrush
= NtGdiSelectBrush(hDC
, hBrush
);
785 if (OldBrush
== NULL
)
787 GreDeleteObject(hBrush
);
791 NtGdiPatBlt(hDC
, X
, Y
, 1, 1, PATCOPY
);
792 NtGdiSelectBrush(hDC
, OldBrush
);
793 GreDeleteObject(hBrush
);
805 DPRINT("0 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
807 if (GdiSetPixelV(hDC
,X
,Y
,Color
))
809 Color
= NtGdiGetPixel(hDC
,X
,Y
);
810 DPRINT("1 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
814 Color
= (COLORREF
)CLR_INVALID
;
815 DPRINT("2 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
820 /* Internal Functions */
823 BITMAP_GetRealBitsPixel(UINT nBitsPixel
)
831 if (nBitsPixel
<= 16)
833 if (nBitsPixel
<= 24)
835 if (nBitsPixel
<= 32)
842 BITMAP_GetWidthBytes(INT bmWidth
, INT bpp
)
848 return 2 * ((bmWidth
+15) >> 4);
851 bmWidth
*= 3; /* fall through */
853 return bmWidth
+ (bmWidth
& 1);
863 return 2 * ((bmWidth
+3) >> 2);
872 return ((bmWidth
* bpp
+ 15) & ~15) >> 3;
876 BITMAP_CopyBitmap(HBITMAP hBitmap
)
880 SURFACE
*Bitmap
, *resBitmap
;
888 Bitmap
= GDIOBJ_LockObj(hBitmap
, GDI_OBJECT_TYPE_BITMAP
);
894 BITMAP_GetObject(Bitmap
, sizeof(BITMAP
), (PVOID
)&bm
);
896 if (Bitmap
->SurfObj
.lDelta
>= 0)
897 bm
.bmHeight
= -bm
.bmHeight
;
899 Size
.cx
= abs(bm
.bmWidth
);
900 Size
.cy
= abs(bm
.bmHeight
);
901 res
= IntCreateBitmap(Size
,
903 BitmapFormat(bm
.bmBitsPixel
* bm
.bmPlanes
, BI_RGB
),
904 (bm
.bmHeight
< 0 ? BMF_TOPDOWN
: 0) | BMF_NOZEROINIT
,
911 resBitmap
= GDIOBJ_LockObj(res
, GDI_OBJECT_TYPE_BITMAP
);
914 buf
= ExAllocatePoolWithTag(PagedPool
,
915 bm
.bmWidthBytes
* abs(bm
.bmHeight
),
919 GDIOBJ_UnlockObjByPtr((POBJ
)resBitmap
);
920 GDIOBJ_UnlockObjByPtr((POBJ
)Bitmap
);
921 GreDeleteObject(res
);
924 IntGetBitmapBits(Bitmap
, bm
.bmWidthBytes
* abs(bm
.bmHeight
), buf
);
925 IntSetBitmapBits(resBitmap
, bm
.bmWidthBytes
* abs(bm
.bmHeight
), buf
);
926 ExFreePoolWithTag(buf
,TAG_BITMAP
);
927 resBitmap
->flFlags
= Bitmap
->flFlags
;
931 resBitmap
->ppal
= Bitmap
->ppal
;
932 GDIOBJ_IncrementShareCount(&Bitmap
->ppal
->BaseObject
);
934 GDIOBJ_UnlockObjByPtr((POBJ
)resBitmap
);
938 GreDeleteObject(res
);
943 GDIOBJ_UnlockObjByPtr((POBJ
)Bitmap
);
949 BITMAP_GetObject(SURFACE
*psurf
, INT Count
, LPVOID buffer
)
953 if (!buffer
) return sizeof(BITMAP
);
954 if ((UINT
)Count
< sizeof(BITMAP
)) return 0;
956 /* always fill a basic BITMAP structure */
959 pBitmap
->bmWidth
= psurf
->SurfObj
.sizlBitmap
.cx
;
960 pBitmap
->bmHeight
= psurf
->SurfObj
.sizlBitmap
.cy
;
961 pBitmap
->bmWidthBytes
= abs(psurf
->SurfObj
.lDelta
);
962 pBitmap
->bmPlanes
= 1;
963 pBitmap
->bmBitsPixel
= BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
);
965 /* Check for DIB section */
968 /* Set bmBits in this case */
969 pBitmap
->bmBits
= psurf
->SurfObj
.pvBits
;
971 if (Count
>= sizeof(DIBSECTION
))
973 /* Fill rest of DIBSECTION */
974 PDIBSECTION pds
= buffer
;
976 pds
->dsBmih
.biSize
= sizeof(BITMAPINFOHEADER
);
977 pds
->dsBmih
.biWidth
= pds
->dsBm
.bmWidth
;
978 pds
->dsBmih
.biHeight
= pds
->dsBm
.bmHeight
;
979 pds
->dsBmih
.biPlanes
= pds
->dsBm
.bmPlanes
;
980 pds
->dsBmih
.biBitCount
= pds
->dsBm
.bmBitsPixel
;
981 switch (psurf
->SurfObj
.iBitmapFormat
)
983 /* FIXME: What about BI_BITFIELDS? */
990 pds
->dsBmih
.biCompression
= BI_RGB
;
993 pds
->dsBmih
.biCompression
= BI_RLE4
;
996 pds
->dsBmih
.biCompression
= BI_RLE8
;
999 pds
->dsBmih
.biCompression
= BI_JPEG
;
1002 pds
->dsBmih
.biCompression
= BI_PNG
;
1005 pds
->dsBmih
.biSizeImage
= psurf
->SurfObj
.cjBits
;
1006 pds
->dsBmih
.biXPelsPerMeter
= 0;
1007 pds
->dsBmih
.biYPelsPerMeter
= 0;
1008 pds
->dsBmih
.biClrUsed
= psurf
->biClrUsed
;
1009 pds
->dsBmih
.biClrImportant
= psurf
->biClrImportant
;
1010 pds
->dsBitfields
[0] = psurf
->dsBitfields
[0];
1011 pds
->dsBitfields
[1] = psurf
->dsBitfields
[1];
1012 pds
->dsBitfields
[2] = psurf
->dsBitfields
[2];
1013 pds
->dshSection
= psurf
->hDIBSection
;
1014 pds
->dsOffset
= psurf
->dwOffset
;
1016 return sizeof(DIBSECTION
);
1021 /* not set according to wine test, confirmed in win2k */
1022 pBitmap
->bmBits
= NULL
;
1025 return sizeof(BITMAP
);
1033 NtGdiGetDCforBitmap(
1037 PSURFACE psurf
= SURFACE_LockSurface(hsurf
);
1041 SURFACE_UnlockSurface(psurf
);