From edda3944bc5f9694fbb598fb770f353256795070 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sat, 19 Mar 2005 22:50:11 +0000 Subject: [PATCH] Forgot to add this file in revision 14203. svn path=/trunk/; revision=14204 --- reactos/lib/gdi32/objects/brush.c | 127 ++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 reactos/lib/gdi32/objects/brush.c diff --git a/reactos/lib/gdi32/objects/brush.c b/reactos/lib/gdi32/objects/brush.c new file mode 100644 index 00000000000..6978962b489 --- /dev/null +++ b/reactos/lib/gdi32/objects/brush.c @@ -0,0 +1,127 @@ +#include "precomp.h" + +#define NDEBUG +#include + +/* + * @implemented + */ +BOOL +STDCALL +FixBrushOrgEx( + HDC hDC, + INT nXOrg, + INT nYOrg, + LPPOINT lpPoint) +{ + return FALSE; +} + +/* + * @implemented + */ +HBRUSH STDCALL +CreateDIBPatternBrush( + HGLOBAL hglbDIBPacked, + UINT fuColorSpec) +{ + PVOID lpPackedDIB; + HBRUSH hBrush = NULL; + PBITMAPINFO pConvertedInfo; + UINT ConvertedInfoSize; + + lpPackedDIB = GlobalLock(hglbDIBPacked); + if (lpPackedDIB == NULL) + return 0; + + pConvertedInfo = ConvertBitmapInfo((PBITMAPINFO)lpPackedDIB, fuColorSpec, + &ConvertedInfoSize, TRUE); + if (pConvertedInfo) + { + hBrush = NtGdiCreateDIBBrush(pConvertedInfo, fuColorSpec, + ConvertedInfoSize, lpPackedDIB); + if ((PBITMAPINFO)lpPackedDIB != pConvertedInfo) + RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo); + } + + GlobalUnlock(hglbDIBPacked); + + return hBrush; +} + +/* + * @implemented + */ +HBRUSH STDCALL +CreateDIBPatternBrushPt( + CONST VOID *lpPackedDIB, + UINT fuColorSpec) +{ + HBRUSH hBrush = NULL; + PBITMAPINFO pConvertedInfo; + UINT ConvertedInfoSize; + + if (lpPackedDIB == NULL) + return 0; + + pConvertedInfo = ConvertBitmapInfo((PBITMAPINFO)lpPackedDIB, fuColorSpec, + &ConvertedInfoSize, TRUE); + if (pConvertedInfo) + { + hBrush = NtGdiCreateDIBBrush(pConvertedInfo, fuColorSpec, + ConvertedInfoSize, lpPackedDIB); + if ((PBITMAPINFO)lpPackedDIB != pConvertedInfo) + RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo); + } + + return hBrush; +} + +/* + * @implemented + */ +HBRUSH STDCALL +CreateBrushIndirect( + CONST LOGBRUSH *LogBrush) +{ + HBRUSH hBrush; + + switch (LogBrush->lbStyle) + { + case BS_DIBPATTERN8X8: + case BS_DIBPATTERN: + hBrush = CreateDIBPatternBrush((HGLOBAL)LogBrush->lbHatch, + LogBrush->lbColor); + break; + + case BS_DIBPATTERNPT: + hBrush = CreateDIBPatternBrushPt((PVOID)LogBrush->lbHatch, + LogBrush->lbColor); + break; + + case BS_PATTERN: + case BS_PATTERN8X8: + hBrush = NtGdiCreatePatternBrush((HBITMAP)LogBrush->lbHatch); + break; + + case BS_SOLID: + hBrush = NtGdiCreateSolidBrush(LogBrush->lbColor); + break; + + case BS_HATCHED: + hBrush = NtGdiCreateHatchBrush(LogBrush->lbHatch, LogBrush->lbColor); + break; + + case BS_NULL: + hBrush = NtGdiGetStockObject(NULL_BRUSH); + break; + + default: + SetLastError(ERROR_INVALID_PARAMETER); + hBrush = NULL; + break; + } + + return hBrush; +} +