2 #include <win32k/kapi.h>
3 #include <rosrtl/logfont.h>
8 #define NtUserGetDCBrushColor(hbr) \
9 (COLORREF)NtUserCallTwoParam((DWORD)(hbr), OBJ_BRUSH, TWOPARAM_ROUTINE_GETDCCOLOR)
11 #define NtUserGetDCPenColor(hbr) \
12 (COLORREF)NtUserCallTwoParam((DWORD)(hbr), OBJ_PEN, TWOPARAM_ROUTINE_GETDCCOLOR)
14 #define NtUserSetDCBrushColor(hbr, crColor) \
15 (COLORREF)NtUserCallTwoParam((DWORD)(hbr), (DWORD)crColor, TWOPARAM_ROUTINE_SETDCBRUSHCOLOR)
17 #define NtUserSetDCPenColor(hbr, crColor) \
18 (COLORREF)NtUserCallTwoParam((DWORD)(hbr), (DWORD)crColor, TWOPARAM_ROUTINE_SETDCPENCOLOR)
29 return NtGdiGetObjectType(h
);
45 return NtGdiDPtoLP(hdc
, lpPoints
, nCount
);
59 return NtGdiSetBkColor(hdc
, crColor
);
72 return NtGdiGetGraphicsMode(hdc
);
86 return NtGdiSetGraphicsMode(hdc
, iMode
);
99 return NtGdiGetMapMode(hdc
);
107 GetCurrentPositionEx(
112 return NtGdiGetCurrentPositionEx(hdc
, lpPoint
);
125 return NtGdiGetBkColor(hdc
);
138 return NtGdiGetBkMode(hdc
);
151 return NtGdiGetBrushOrgEx(hdc
, lppt
);
164 return NtGdiGetROP2(hdc
);
177 return NtGdiGetStretchBltMode(hdc
);
191 return NtGdiGetTextAlign(hdc
);
204 return NtGdiGetTextColor(hdc
);
218 return NtGdiGetViewportExtEx(hdc
, lpSize
);
232 return NtGdiGetViewportOrgEx(hdc
, lpPoint
);
246 return NtGdiGetWindowExtEx(hdc
, lpSize
);
260 return NtGdiGetWindowOrgEx(hdc
, lpPoint
);
274 return NtGdiSetBkMode(hdc
, iBkMode
);
288 return NtGdiSetROP2(hdc
, fnDrawMode
);
302 return NtGdiSetStretchBltMode(hdc
, iStretchMode
);
316 return NtGdiGetRelAbs(hdc
);
324 GetStockObject(int fnObject
)
326 return NtGdiGetStockObject(fnObject
);
338 return NtGdiGetClipBox(hdc
, lprc
);
351 return NtGdiGetPolyFillMode(hdc
);
364 CONST DEVMODEA
* lpInitData
367 ANSI_STRING DriverA
, DeviceA
, OutputA
;
368 UNICODE_STRING DriverU
, DeviceU
, OutputU
;
370 DEVMODEW
*lpInitDataW
;
373 * If needed, convert to Unicode
374 * any string parameter.
377 if (NULL
!= lpszDriver
)
379 RtlInitAnsiString(&DriverA
, (LPSTR
)lpszDriver
);
380 RtlAnsiStringToUnicodeString(&DriverU
, &DriverA
, TRUE
);
382 DriverU
.Buffer
= NULL
;
383 if (NULL
!= lpszDevice
)
385 RtlInitAnsiString(&DeviceA
, (LPSTR
)lpszDevice
);
386 RtlAnsiStringToUnicodeString(&DeviceU
, &DeviceA
, TRUE
);
388 DeviceU
.Buffer
= NULL
;
389 if (NULL
!= lpszOutput
)
391 RtlInitAnsiString(&OutputA
, (LPSTR
)lpszOutput
);
392 RtlAnsiStringToUnicodeString(&OutputU
, &OutputA
, TRUE
);
394 OutputU
.Buffer
= NULL
;
396 if (NULL
!= lpInitData
)
398 // lpInitDataW = HeapAllocMem(
403 * Call the Unicode version
414 * Free Unicode parameters.
416 RtlFreeUnicodeString(&DriverU
);
417 RtlFreeUnicodeString(&DeviceU
);
418 RtlFreeUnicodeString(&OutputU
);
421 * Return the possible DC handle.
437 CONST DEVMODEW
* lpInitData
440 UNICODE_STRING Driver
, Device
, Output
;
443 RtlInitUnicodeString(&Driver
, lpwszDriver
);
445 RtlInitUnicodeString(&Driver
, lpwszDevice
);
447 RtlInitUnicodeString(&Driver
, lpwszOutput
);
449 return NtGdiCreateDC((lpwszDriver
? &Driver
: NULL
),
450 (lpwszDevice
? &Device
: NULL
),
451 (lpwszOutput
? &Output
: NULL
),
452 (PDEVMODEW
)lpInitData
);
459 BOOL STDCALL
DeleteDC( HDC hdc
)
461 return NtGdiDeleteDC(hdc
);
474 return NtGdiCreateCompatableDC(hdc
);
488 return NtGdiSelectObject(hdc
, hgdiobj
);
502 return NtGdiSetMapMode(hdc
, fnMapMode
);
518 return NtGdiSetViewportOrgEx(hdc
, X
, Y
, lpPoint
);
534 return NtGdiOffsetViewportOrgEx(hdc
, nXOffset
, nYOffset
, lpPoint
);
550 return NtGdiSetWindowOrgEx(hdc
, X
, Y
, lpPoint
);
559 DeleteObject(HGDIOBJ hObject
)
561 if (0 != ((DWORD
) hObject
& 0x00800000))
563 DPRINT1("Trying to delete system object 0x%x\n", hObject
);
567 return NtGdiDeleteObject(hObject
);
579 BOOL bForceBackground
582 return NtGdiSelectPalette(hdc
, hpal
, bForceBackground
);
595 return NtGdiRealizePalette(hdc
);
610 return NtGdiLPtoDP(hdc
, lpPoints
, nCount
);
624 return NtGdiSetPolyFillMode(hdc
, iPolyFillMode
);
638 return NtGdiGetDeviceCaps(hdc
, nIndex
);
647 CONST LOGPALETTE
*lplgpl
650 return NtGdiCreatePalette((CONST PLOGPALETTE
)lplgpl
);
663 return NtGdiGetNearestColor(hdc
, crColor
);
671 GetNearestPaletteIndex(
676 return NtGdiGetNearestPaletteIndex(hpal
, crColor
);
691 return NtGdiGetPaletteEntries(hpal
, iStartIndex
, nEntries
, lppe
);
699 GetSystemPaletteEntries(
706 return NtGdiGetSystemPaletteEntries(hdc
, iStartIndex
, nEntries
, lppe
);
719 return NtGdiRestoreDC(hdc
, nSavedDC
);
732 return NtGdiSaveDC(hdc
);
744 CONST PALETTEENTRY
*lppe
747 return NtGdiSetPaletteEntries(hpal
, iStart
, cEntries
, (CONST PPALETTEENTRY
)lppe
);
760 return NtGdiGetWorldTransform(hdc
, lpXform
);
773 return NtGdiSetWorldTransform(hdc
, (CONST PXFORM
)lpXform
);
781 ModifyWorldTransform(
783 CONST XFORM
*lpXform
,
787 return NtGdiModifyWorldTransform(hdc
, (CONST PXFORM
)lpXform
, iMode
);
796 LPXFORM lpxformResult
,
797 CONST XFORM
*lpxform1
,
798 CONST XFORM
*lpxform2
801 return NtGdiCombineTransform(lpxformResult
, (CONST PXFORM
)lpxform1
, (CONST PXFORM
)lpxform2
);
816 DbgPrint("GetDIBColorTable\n");
817 return NtGdiGetDIBColorTable(hdc
, uStartIndex
, cEntries
, pColors
);
829 CONST RGBQUAD
*pColors
832 return NtGdiSetDIBColorTable(hdc
, uStartIndex
, cEntries
, (RGBQUAD
*)pColors
);
840 CreateHalftonePalette(
844 return NtGdiCreateHalftonePalette(hdc
);
859 return NtGdiSetViewportExtEx(hdc
, nXExtent
, nYExtent
, lpSize
);
874 return NtGdiSetWindowExtEx(hdc
, nXExtent
, nYExtent
, lpSize
);
889 return NtGdiOffsetWindowOrgEx(hdc
, nXOffset
, nYOffset
, lpPoint
);
897 SetBitmapDimensionEx(
904 return NtGdiSetBitmapDimensionEx(hBitmap
, nWidth
, nHeight
, lpSize
);
917 return NtGdiGetDCOrgEx(hdc
, lpPoint
);
929 // Officially obsolete by Microsoft
931 if (!NtGdiGetDCOrgEx(hdc
, &Pt
))
933 return(MAKELONG(Pt
.x
, Pt
.y
));
946 return NtGdiRectVisible(hdc
, (RECT
*)lprc
);
963 return NtGdiExtEscape(hdc
, nEscape
, cbInput
, lpszInData
, cbOutput
, lpszOutData
);
972 GetObjectA(HGDIOBJ Handle
, int Size
, LPVOID Buffer
)
978 Type
= GetObjectType(Handle
);
984 if (OBJ_FONT
== Type
)
986 if (Size
< sizeof(LOGFONTA
))
988 SetLastError(ERROR_BUFFER_OVERFLOW
);
991 Result
= NtGdiGetObject(Handle
, sizeof(LOGFONTW
), &LogFontW
);
996 RosRtlLogFontW2A((LPLOGFONTA
) Buffer
, &LogFontW
);
997 Result
= sizeof(LOGFONTA
);
1001 Result
= NtGdiGetObject(Handle
, Size
, Buffer
);
1013 GetObjectW(HGDIOBJ Handle
, int Size
, LPVOID Buffer
)
1015 return NtGdiGetObject(Handle
, Size
, Buffer
);
1031 return NtGdiSetBrushOrgEx(hdc
, nXOrg
, nYOrg
, lppt
);
1048 /* FIXME - Check if we're emulating win95, if so, forward to SetBrushOrgEx() */
1049 return SetBrushOrgEx(hdc
, nXOrg
, nYOrg
, lppt
);
1066 return NtGdiGetCurrentObject(hdc
, uObjectType
);
1081 return NtGdiPtVisible(hdc
, X
, Y
);
1093 return NtUserGetDCBrushColor(hdc
);
1105 return NtUserGetDCPenColor(hdc
);
1118 return NtUserSetDCBrushColor(hdc
, crColor
);
1131 return NtUserSetDCPenColor(hdc
, crColor
);