From 471b5dff8dfdb2f9476a07a06569e7ef20ad6e52 Mon Sep 17 00:00:00 2001 From: Jeff Johann Date: Sun, 8 Nov 1998 15:07:22 +0000 Subject: [PATCH] Added CreateDIBPatternBrushPt (GDI32.35) with minor documentation updates. --- objects/brush.c | 60 +++++++++++++++++++++++++++++++++++++++++++++- relay32/gdi32.spec | 2 +- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/objects/brush.c b/objects/brush.c index 2bed5915cf3..2f3fd7e8245 100644 --- a/objects/brush.c +++ b/objects/brush.c @@ -132,8 +132,22 @@ HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse ) /*********************************************************************** * CreateDIBPatternBrush32 (GDI32.34) + * + * Create a logical brush which has the pattern specified by the DIB + * + * Function call is for compatability only. CreateDIBPatternBrushPt should be used. + * + * RETURNS + * + * Handle to a logical brush on success, NULL on failure. + * + * BUGS + * */ -HBRUSH32 WINAPI CreateDIBPatternBrush32( HGLOBAL32 hbitmap, UINT32 coloruse ) +HBRUSH32 WINAPI CreateDIBPatternBrush32( + HGLOBAL32 hbitmap, /* Global object containg BITMAPINFO structure */ + UINT32 coloruse /* Specifies color format, if provided */ +) { LOGBRUSH32 logbrush = { BS_DIBPATTERN, coloruse, 0 }; BITMAPINFO *info, *newInfo; @@ -165,6 +179,50 @@ HBRUSH32 WINAPI CreateDIBPatternBrush32( HGLOBAL32 hbitmap, UINT32 coloruse ) } +/*********************************************************************** + * CreateDIBPatternBrushPt32 (GDI32.35) + * + * Create a logical brush which has the pattern specified by the DIB + * + * RETURNS + * + * Handle to a logical brush on success, NULL on failure. + * + * BUGS + * + */ +HBRUSH32 WINAPI CreateDIBPatternBrushPt32( + BITMAPINFO *info, /* Pointer to a BITMAPINFO structure */ + UINT32 coloruse /* Specifies color format, if provided */ +) +{ + LOGBRUSH32 logbrush = { BS_DIBPATTERN, coloruse, 0 }; + BITMAPINFO *newInfo; + INT32 size; + + TRACE(gdi, "%04x\n", info ); + + /* Make a copy of the bitmap */ + + + if (info->bmiHeader.biCompression) + size = info->bmiHeader.biSizeImage; + else + size = (info->bmiHeader.biWidth * info->bmiHeader.biBitCount + 31) / 32 + * 8 * info->bmiHeader.biHeight; + size += DIB_BitmapInfoSize( info, coloruse ); + + if (!(logbrush.lbHatch = (INT32)GlobalAlloc16( GMEM_MOVEABLE, size ))) + { + return 0; + } + newInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)logbrush.lbHatch ); + memcpy( newInfo, info, size ); + GlobalUnlock16( (HGLOBAL16)logbrush.lbHatch ); + return CreateBrushIndirect32( &logbrush ); +} + + /*********************************************************************** * CreateSolidBrush (GDI.66) */ diff --git a/relay32/gdi32.spec b/relay32/gdi32.spec index 9c09252361d..83b60836dee 100644 --- a/relay32/gdi32.spec +++ b/relay32/gdi32.spec @@ -37,7 +37,7 @@ init MAIN_GdiInit 32 stdcall CreateDCA(str str str ptr) CreateDC32A 33 stdcall CreateDCW(wstr wstr wstr ptr) CreateDC32W 34 stdcall CreateDIBPatternBrush(long long) CreateDIBPatternBrush32 - 35 stub CreateDIBPatternBrushPt + 35 stdcall CreateDIBPatternBrushPt(long long) CreateDIBPatternBrushPt32 36 stdcall CreateDIBSection(long ptr long ptr long long) CreateDIBSection32 37 stdcall CreateDIBitmap(long ptr long ptr ptr long) CreateDIBitmap32 38 stdcall CreateDiscardableBitmap(long long long) CreateDiscardableBitmap32