1993-09-04 12:09:32 +02:00
|
|
|
/*
|
|
|
|
* GDI brush objects
|
|
|
|
*
|
1995-01-09 19:21:16 +01:00
|
|
|
* Copyright 1993, 1994 Alexandre Julliard
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1995-01-09 19:21:16 +01:00
|
|
|
*/
|
1993-09-04 12:09:32 +02:00
|
|
|
|
2021-09-29 14:09:21 +02:00
|
|
|
#if 0
|
|
|
|
#pragma makedep unix
|
|
|
|
#endif
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
1999-02-28 13:27:56 +01:00
|
|
|
#include <string.h>
|
2001-07-18 23:04:23 +02:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
1999-02-17 14:51:06 +01:00
|
|
|
#include "winbase.h"
|
2001-07-18 23:04:23 +02:00
|
|
|
#include "wingdi.h"
|
2021-07-09 15:28:26 +02:00
|
|
|
#include "ntgdi_private.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1993-09-04 12:09:32 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(gdi);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
2002-05-31 20:43:22 +02:00
|
|
|
/* GDI logical brush object */
|
|
|
|
typedef struct
|
|
|
|
{
|
2021-06-30 17:36:19 +02:00
|
|
|
struct gdi_obj_header obj;
|
2011-11-02 20:58:36 +01:00
|
|
|
LOGBRUSH logbrush;
|
2011-12-29 16:17:44 +01:00
|
|
|
struct brush_pattern pattern;
|
2002-05-31 20:43:22 +02:00
|
|
|
} BRUSHOBJ;
|
|
|
|
|
|
|
|
#define NB_HATCH_STYLES 6
|
|
|
|
|
2009-01-27 16:30:43 +01:00
|
|
|
static INT BRUSH_GetObject( HGDIOBJ handle, INT count, LPVOID buffer );
|
2009-01-27 16:19:37 +01:00
|
|
|
static BOOL BRUSH_DeleteObject( HGDIOBJ handle );
|
2002-05-31 20:43:22 +02:00
|
|
|
|
|
|
|
static const struct gdi_obj_funcs brush_funcs =
|
|
|
|
{
|
|
|
|
BRUSH_GetObject, /* pGetObjectW */
|
|
|
|
NULL, /* pUnrealizeObject */
|
|
|
|
BRUSH_DeleteObject /* pDeleteObject */
|
|
|
|
};
|
|
|
|
|
1999-10-23 20:56:30 +02:00
|
|
|
|
2012-05-23 21:12:04 +02:00
|
|
|
static BOOL copy_bitmap( struct brush_pattern *brush, HBITMAP bitmap )
|
2011-11-03 11:11:14 +01:00
|
|
|
{
|
2012-05-23 21:12:04 +02:00
|
|
|
char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256])];
|
|
|
|
BITMAPINFO *info = (BITMAPINFO *)buffer;
|
2011-11-03 11:11:14 +01:00
|
|
|
struct gdi_image_bits bits;
|
|
|
|
struct bitblt_coords src;
|
2021-07-08 17:11:45 +02:00
|
|
|
BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, NTGDI_OBJ_BITMAP );
|
2011-12-29 20:16:46 +01:00
|
|
|
|
2012-05-23 21:12:04 +02:00
|
|
|
if (!bmp) return FALSE;
|
2011-11-03 11:11:14 +01:00
|
|
|
|
|
|
|
src.visrect.left = src.x = 0;
|
|
|
|
src.visrect.top = src.y = 0;
|
2012-01-10 16:09:54 +01:00
|
|
|
src.visrect.right = src.width = bmp->dib.dsBm.bmWidth;
|
|
|
|
src.visrect.bottom = src.height = bmp->dib.dsBm.bmHeight;
|
2012-05-29 14:24:11 +02:00
|
|
|
if (get_image_from_bitmap( bmp, info, &bits, &src )) goto done;
|
2011-11-03 11:11:14 +01:00
|
|
|
|
2012-05-23 21:12:04 +02:00
|
|
|
brush->bits = bits;
|
|
|
|
if (!bits.free)
|
2011-11-03 21:14:42 +01:00
|
|
|
{
|
2021-10-01 01:57:05 +02:00
|
|
|
if (!(brush->bits.ptr = malloc( info->bmiHeader.biSizeImage ))) goto done;
|
2012-05-23 21:12:04 +02:00
|
|
|
memcpy( brush->bits.ptr, bits.ptr, info->bmiHeader.biSizeImage );
|
|
|
|
brush->bits.free = free_heap_bits;
|
2011-11-03 21:14:42 +01:00
|
|
|
}
|
|
|
|
|
2021-10-01 01:57:05 +02:00
|
|
|
if (!(brush->info = malloc( get_dib_info_size( info, DIB_RGB_COLORS ))))
|
2011-11-03 21:14:42 +01:00
|
|
|
{
|
2012-05-23 21:12:04 +02:00
|
|
|
if (brush->bits.free) brush->bits.free( &brush->bits );
|
2011-11-03 21:14:42 +01:00
|
|
|
goto done;
|
|
|
|
}
|
2012-05-23 21:12:04 +02:00
|
|
|
memcpy( brush->info, info, get_dib_info_size( info, DIB_RGB_COLORS ));
|
|
|
|
brush->bits.is_copy = FALSE; /* the bits can't be modified */
|
2011-11-03 21:14:42 +01:00
|
|
|
brush->usage = DIB_RGB_COLORS;
|
|
|
|
|
|
|
|
done:
|
|
|
|
GDI_ReleaseObj( bitmap );
|
|
|
|
return brush->info != NULL;
|
|
|
|
}
|
|
|
|
|
2011-12-29 16:17:44 +01:00
|
|
|
BOOL store_brush_pattern( LOGBRUSH *brush, struct brush_pattern *pattern )
|
|
|
|
{
|
|
|
|
pattern->info = NULL;
|
|
|
|
pattern->bits.free = NULL;
|
|
|
|
|
|
|
|
switch (brush->lbStyle)
|
|
|
|
{
|
|
|
|
case BS_SOLID:
|
|
|
|
case BS_HOLLOW:
|
2011-12-30 11:02:57 +01:00
|
|
|
return TRUE;
|
|
|
|
|
2011-12-29 16:17:44 +01:00
|
|
|
case BS_HATCHED:
|
2011-12-30 11:02:57 +01:00
|
|
|
if (brush->lbHatch > HS_DIAGCROSS)
|
|
|
|
{
|
|
|
|
if (brush->lbHatch >= HS_API_MAX) return FALSE;
|
|
|
|
brush->lbStyle = BS_SOLID;
|
|
|
|
brush->lbHatch = 0;
|
|
|
|
}
|
2011-12-29 16:17:44 +01:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case BS_PATTERN8X8:
|
|
|
|
brush->lbStyle = BS_PATTERN;
|
|
|
|
/* fall through */
|
|
|
|
case BS_PATTERN:
|
|
|
|
brush->lbColor = 0;
|
|
|
|
return copy_bitmap( pattern, (HBITMAP)brush->lbHatch );
|
|
|
|
|
|
|
|
case BS_DIBPATTERNPT:
|
|
|
|
pattern->usage = brush->lbColor;
|
|
|
|
pattern->info = copy_packed_dib( (BITMAPINFO *)brush->lbHatch, pattern->usage );
|
|
|
|
if (!pattern->info) return FALSE;
|
|
|
|
pattern->bits.ptr = (char *)pattern->info + get_dib_info_size( pattern->info, pattern->usage );
|
|
|
|
brush->lbStyle = BS_DIBPATTERN;
|
|
|
|
brush->lbColor = 0;
|
|
|
|
return TRUE;
|
|
|
|
|
2021-08-31 14:18:32 +02:00
|
|
|
case BS_DIBPATTERN:
|
2011-12-29 16:17:44 +01:00
|
|
|
case BS_DIBPATTERN8X8:
|
|
|
|
case BS_MONOPATTERN:
|
|
|
|
case BS_INDEXED:
|
|
|
|
default:
|
|
|
|
WARN( "invalid brush style %u\n", brush->lbStyle );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void free_brush_pattern( struct brush_pattern *pattern )
|
|
|
|
{
|
|
|
|
if (pattern->bits.free) pattern->bits.free( &pattern->bits );
|
2021-10-01 01:57:05 +02:00
|
|
|
free( pattern->info );
|
2011-12-29 16:17:44 +01:00
|
|
|
}
|
|
|
|
|
2021-09-29 14:09:21 +02:00
|
|
|
BOOL CDECL get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage )
|
2011-11-01 22:05:16 +01:00
|
|
|
{
|
|
|
|
BRUSHOBJ *brush;
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
|
2021-07-08 17:11:45 +02:00
|
|
|
if (!(brush = GDI_GetObjPtr( handle, NTGDI_OBJ_BRUSH ))) return FALSE;
|
2011-11-01 22:05:16 +01:00
|
|
|
|
2011-12-29 16:17:44 +01:00
|
|
|
if (brush->pattern.info)
|
2011-11-01 22:05:16 +01:00
|
|
|
{
|
2021-09-07 14:10:44 +02:00
|
|
|
if (info)
|
|
|
|
{
|
|
|
|
memcpy( info, brush->pattern.info,
|
|
|
|
get_dib_info_size( brush->pattern.info, brush->pattern.usage ));
|
|
|
|
if (info->bmiHeader.biBitCount <= 8 && !info->bmiHeader.biClrUsed)
|
|
|
|
fill_default_color_table( info );
|
|
|
|
if (info->bmiHeader.biHeight < 0)
|
|
|
|
info->bmiHeader.biHeight = -info->bmiHeader.biHeight;
|
|
|
|
}
|
|
|
|
if (bits)
|
|
|
|
{
|
|
|
|
/* always return a bottom-up DIB */
|
|
|
|
if (brush->pattern.info->bmiHeader.biHeight < 0)
|
|
|
|
{
|
|
|
|
unsigned int i, width_bytes, height = -brush->pattern.info->bmiHeader.biHeight;
|
|
|
|
char *dst_ptr;
|
|
|
|
|
|
|
|
width_bytes = get_dib_stride( brush->pattern.info->bmiHeader.biWidth,
|
|
|
|
brush->pattern.info->bmiHeader.biBitCount );
|
|
|
|
dst_ptr = (char *)bits + (height - 1) * width_bytes;
|
|
|
|
for (i = 0; i < height; i++, dst_ptr -= width_bytes)
|
|
|
|
memcpy( dst_ptr, (char *)brush->pattern.bits.ptr + i * width_bytes,
|
|
|
|
width_bytes );
|
|
|
|
}
|
|
|
|
else memcpy( bits, brush->pattern.bits.ptr,
|
|
|
|
brush->pattern.info->bmiHeader.biSizeImage );
|
|
|
|
}
|
|
|
|
if (usage) *usage = brush->pattern.usage;
|
2011-11-01 22:05:16 +01:00
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
GDI_ReleaseObj( handle );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-08-25 14:39:48 +02:00
|
|
|
HBRUSH create_brush( const LOGBRUSH *brush )
|
1993-09-04 12:09:32 +02:00
|
|
|
{
|
2002-10-03 21:48:59 +02:00
|
|
|
BRUSHOBJ * ptr;
|
2000-08-19 23:38:55 +02:00
|
|
|
HBRUSH hbrush;
|
2002-10-03 21:48:59 +02:00
|
|
|
|
2021-10-01 01:57:05 +02:00
|
|
|
if (!(ptr = malloc( sizeof(*ptr) ))) return 0;
|
2009-01-28 18:43:06 +01:00
|
|
|
|
2011-11-02 20:58:36 +01:00
|
|
|
ptr->logbrush = *brush;
|
2002-10-03 21:48:59 +02:00
|
|
|
|
2011-12-29 16:17:44 +01:00
|
|
|
if (store_brush_pattern( &ptr->logbrush, &ptr->pattern ) &&
|
2021-07-08 17:11:45 +02:00
|
|
|
(hbrush = alloc_gdi_handle( &ptr->obj, NTGDI_OBJ_BRUSH, &brush_funcs )))
|
2009-01-28 18:43:06 +01:00
|
|
|
{
|
|
|
|
TRACE("%p\n", hbrush);
|
|
|
|
return hbrush;
|
|
|
|
}
|
2002-10-03 21:48:59 +02:00
|
|
|
|
2011-12-29 16:17:44 +01:00
|
|
|
free_brush_pattern( &ptr->pattern );
|
2021-10-01 01:57:05 +02:00
|
|
|
free( ptr );
|
2002-10-03 21:48:59 +02:00
|
|
|
return 0;
|
1996-11-02 15:24:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2021-09-10 14:28:04 +02:00
|
|
|
* NtGdiCreateHatchBrushInternal (win32u.@)
|
2004-08-20 21:57:11 +02:00
|
|
|
*
|
|
|
|
* Create a logical brush with a hatched pattern.
|
1996-11-02 15:24:07 +01:00
|
|
|
*/
|
2021-09-10 14:28:04 +02:00
|
|
|
HBRUSH WINAPI NtGdiCreateHatchBrushInternal( INT style, COLORREF color, BOOL pen )
|
1996-11-02 15:24:07 +01:00
|
|
|
{
|
1999-04-22 18:27:50 +02:00
|
|
|
LOGBRUSH logbrush;
|
|
|
|
|
2021-08-25 14:39:50 +02:00
|
|
|
TRACE( "%d %06x\n", style, color );
|
1999-04-22 18:27:50 +02:00
|
|
|
|
|
|
|
logbrush.lbStyle = BS_HATCHED;
|
|
|
|
logbrush.lbColor = color;
|
|
|
|
logbrush.lbHatch = style;
|
|
|
|
|
2021-08-25 14:39:48 +02:00
|
|
|
return create_brush( &logbrush );
|
1996-11-02 15:24:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1993-09-04 12:09:32 +02:00
|
|
|
/***********************************************************************
|
2021-08-25 14:39:51 +02:00
|
|
|
* NtGdiCreatePatternBrushInternal (win32u.@)
|
2004-08-20 21:57:11 +02:00
|
|
|
*
|
|
|
|
* Create a logical brush with a pattern from a bitmap.
|
1993-09-04 12:09:32 +02:00
|
|
|
*/
|
2021-08-25 14:39:51 +02:00
|
|
|
HBRUSH WINAPI NtGdiCreatePatternBrushInternal( HBITMAP bitmap, BOOL pen, BOOL is_8x8 )
|
1993-09-04 12:09:32 +02:00
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
LOGBRUSH logbrush = { BS_PATTERN, 0, 0 };
|
1993-09-04 12:09:32 +02:00
|
|
|
|
2021-08-25 14:39:51 +02:00
|
|
|
TRACE( "%p\n", bitmap );
|
|
|
|
|
|
|
|
logbrush.lbHatch = (ULONG_PTR)bitmap;
|
2021-08-25 14:39:48 +02:00
|
|
|
return create_brush( &logbrush );
|
1996-11-02 15:24:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-11-08 16:07:22 +01:00
|
|
|
/***********************************************************************
|
2021-08-25 14:39:52 +02:00
|
|
|
* NtGdiCreateDIBBrush (win32u.@)
|
1998-11-08 16:07:22 +01:00
|
|
|
*
|
2004-08-20 21:57:11 +02:00
|
|
|
* Create a logical brush with a pattern from a DIB.
|
1998-11-08 16:07:22 +01:00
|
|
|
*/
|
2021-08-25 14:39:52 +02:00
|
|
|
HBRUSH WINAPI NtGdiCreateDIBBrush( const void *data, UINT coloruse, UINT size,
|
|
|
|
BOOL is_8x8, BOOL pen, const void *client )
|
1998-11-08 16:07:22 +01:00
|
|
|
{
|
2021-08-25 14:39:52 +02:00
|
|
|
const BITMAPINFO *info = data;
|
1999-05-08 14:50:36 +02:00
|
|
|
LOGBRUSH logbrush;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2003-11-13 21:49:54 +01:00
|
|
|
if (!data)
|
|
|
|
return NULL;
|
|
|
|
|
2021-08-25 14:39:52 +02:00
|
|
|
TRACE( "%p %dx%d %dbpp\n", info, info->bmiHeader.biWidth,
|
|
|
|
info->bmiHeader.biHeight, info->bmiHeader.biBitCount );
|
1998-11-08 16:07:22 +01:00
|
|
|
|
1999-10-23 20:56:30 +02:00
|
|
|
logbrush.lbStyle = BS_DIBPATTERNPT;
|
1999-05-08 14:50:36 +02:00
|
|
|
logbrush.lbColor = coloruse;
|
2005-09-12 13:19:56 +02:00
|
|
|
logbrush.lbHatch = (ULONG_PTR)data;
|
1998-11-08 16:07:22 +01:00
|
|
|
|
2021-08-25 14:39:48 +02:00
|
|
|
return create_brush( &logbrush );
|
1993-09-04 12:09:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1996-11-02 15:24:07 +01:00
|
|
|
/***********************************************************************
|
2021-08-25 14:39:49 +02:00
|
|
|
* NtGdiCreateSolidBrush (win32u.@)
|
2004-08-20 21:57:11 +02:00
|
|
|
*
|
|
|
|
* Create a logical brush consisting of a single colour.
|
1996-11-02 15:24:07 +01:00
|
|
|
*/
|
2021-08-25 14:39:49 +02:00
|
|
|
HBRUSH WINAPI NtGdiCreateSolidBrush( COLORREF color, HBRUSH brush )
|
1993-09-04 12:09:32 +02:00
|
|
|
{
|
1999-04-22 18:27:50 +02:00
|
|
|
LOGBRUSH logbrush;
|
|
|
|
|
2006-10-12 22:56:56 +02:00
|
|
|
TRACE("%06x\n", color );
|
1999-04-22 18:27:50 +02:00
|
|
|
|
|
|
|
logbrush.lbStyle = BS_SOLID;
|
|
|
|
logbrush.lbColor = color;
|
|
|
|
logbrush.lbHatch = 0;
|
|
|
|
|
2021-08-25 14:39:48 +02:00
|
|
|
return create_brush( &logbrush );
|
1993-09-04 12:09:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-31 20:43:22 +02:00
|
|
|
/***********************************************************************
|
2021-07-02 12:38:47 +02:00
|
|
|
* NtGdiSelectBrush (win32u.@)
|
2002-05-31 20:43:22 +02:00
|
|
|
*/
|
2021-07-02 12:38:47 +02:00
|
|
|
HGDIOBJ WINAPI NtGdiSelectBrush( HDC hdc, HGDIOBJ handle )
|
2002-05-31 20:43:22 +02:00
|
|
|
{
|
2007-09-27 20:14:13 +02:00
|
|
|
BRUSHOBJ *brush;
|
|
|
|
HGDIOBJ ret = 0;
|
2021-07-02 12:38:47 +02:00
|
|
|
DC *dc;
|
2002-05-31 20:43:22 +02:00
|
|
|
|
2021-07-02 12:38:47 +02:00
|
|
|
if (!(dc = get_dc_ptr( hdc ))) return 0;
|
2002-05-31 20:43:22 +02:00
|
|
|
|
2021-07-08 17:11:45 +02:00
|
|
|
if ((brush = GDI_GetObjPtr( handle, NTGDI_OBJ_BRUSH )))
|
2007-09-27 20:14:13 +02:00
|
|
|
{
|
2011-03-09 21:19:09 +01:00
|
|
|
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectBrush );
|
2011-12-29 19:49:41 +01:00
|
|
|
struct brush_pattern *pattern = &brush->pattern;
|
2011-03-09 21:19:09 +01:00
|
|
|
|
2012-05-23 21:12:04 +02:00
|
|
|
if (!pattern->info) pattern = NULL;
|
2007-09-27 20:14:13 +02:00
|
|
|
|
2008-02-05 21:17:28 +01:00
|
|
|
GDI_inc_ref_count( handle );
|
|
|
|
GDI_ReleaseObj( handle );
|
|
|
|
|
2011-12-29 19:49:41 +01:00
|
|
|
if (!physdev->funcs->pSelectBrush( physdev, handle, pattern ))
|
2008-02-05 21:17:28 +01:00
|
|
|
{
|
|
|
|
GDI_dec_ref_count( handle );
|
|
|
|
}
|
|
|
|
else
|
2007-09-27 20:57:02 +02:00
|
|
|
{
|
|
|
|
ret = dc->hBrush;
|
|
|
|
dc->hBrush = handle;
|
|
|
|
GDI_dec_ref_count( ret );
|
|
|
|
}
|
2007-09-27 20:14:13 +02:00
|
|
|
}
|
|
|
|
release_dc_ptr( dc );
|
2002-05-31 20:43:22 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1993-09-04 12:09:32 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* BRUSH_DeleteObject
|
|
|
|
*/
|
2009-01-27 16:19:37 +01:00
|
|
|
static BOOL BRUSH_DeleteObject( HGDIOBJ handle )
|
1993-09-04 12:09:32 +02:00
|
|
|
{
|
2009-01-28 18:45:21 +01:00
|
|
|
BRUSHOBJ *brush = free_gdi_handle( handle );
|
2002-05-31 20:43:22 +02:00
|
|
|
|
2009-01-27 16:19:37 +01:00
|
|
|
if (!brush) return FALSE;
|
2011-12-29 16:17:44 +01:00
|
|
|
free_brush_pattern( &brush->pattern );
|
2021-10-01 01:57:05 +02:00
|
|
|
free( brush );
|
2018-01-22 10:53:38 +01:00
|
|
|
return TRUE;
|
1993-09-04 12:09:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1996-11-02 15:24:07 +01:00
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* BRUSH_GetObject
|
1996-11-02 15:24:07 +01:00
|
|
|
*/
|
2009-01-27 16:30:43 +01:00
|
|
|
static INT BRUSH_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
|
1993-09-04 12:09:32 +02:00
|
|
|
{
|
2021-07-08 17:11:45 +02:00
|
|
|
BRUSHOBJ *brush = GDI_GetObjPtr( handle, NTGDI_OBJ_BRUSH );
|
2003-07-26 22:39:46 +02:00
|
|
|
|
2009-01-27 16:30:43 +01:00
|
|
|
if (!brush) return 0;
|
|
|
|
if (buffer)
|
|
|
|
{
|
|
|
|
if (count > sizeof(brush->logbrush)) count = sizeof(brush->logbrush);
|
|
|
|
memcpy( buffer, &brush->logbrush, count );
|
|
|
|
}
|
|
|
|
else count = sizeof(brush->logbrush);
|
|
|
|
GDI_ReleaseObj( handle );
|
1993-09-04 12:09:32 +02:00
|
|
|
return count;
|
|
|
|
}
|