reactos/subsystems/win32/win32k/include/brush.h

135 lines
4 KiB
C
Raw Normal View History

#pragma once
#include "gdiobj.h"
/* Internal interface */
#define NB_HATCH_STYLES 6
/*
* The layout of this structure is taken from "Windows Graphics Programming"
* book written by Feng Yuan.
*
* DON'T MODIFY THIS STRUCTURE UNLESS REALLY NEEDED AND EVEN THEN ASK ON
* A MAILING LIST FIRST.
*/
typedef struct _BRUSH
{
/* Header for all gdi objects in the handle table.
Do not (re)move this. */
BASEOBJECT BaseObject;
ULONG ulStyle;
HBITMAP hbmPattern;
HANDLE hbmClient;
ULONG flAttrs;
ULONG ulBrushUnique;
BRUSH_ATTR *pBrushAttr; // Just like DC_ATTR, pointer to user data
BRUSH_ATTR BrushAttr; // " " DCOBJ, internal if pBrushAttr == Zero
POINT ptOrigin;
ULONG bCacheGrabbed;
COLORREF crBack;
COLORREF crFore;
ULONG ulPalTime;
ULONG ulSurfTime;
PVOID ulRealization;
ULONG Unknown4C[3];
POINT ptPenWidth;
ULONG ulPenStyle;
DWORD *pStyle;
ULONG dwStyleCount;
ULONG Unknown6C;
} BRUSH, *PBRUSH;
typedef struct _EBRUSHOBJ
{
BRUSHOBJ BrushObject;
COLORREF crRealize;
ULONG ulRGBColor;
PVOID pengbrush;
ULONG ulSurfPalTime;
ULONG ulDCPalTime;
COLORREF crCurrentText;
COLORREF crCurrentBack;
COLORADJUSTMENT *pca;
// DWORD dwUnknown2c;
// DWORD dwUnknown30;
SURFACE * psurfTrg;
XLATEOBJ rewrite. The new XLATEOBJ is not allocated from paged pool anymore, but instead allocated on the stack and Initialized. Only when we habe more than a color table with more than 6 entries, we need to allocate an additional buffer. The new interface: EXLATEOBJ_vInitialize is the main init function. It takes a source and destination palette and back and fore colors for monochome surfaces. EXLATEOBJ_vInitXlateFromDCs takes the source and dest DC and is for color translation between 2 surfaces represented by 2 DCs. EXLATEOBJ_vInitBrushXlate initializes an XLATEOBJ for a pattern brush. Finally EXLATEOBJ_vCleanup needs to be called when the XLATEOBJ is not needed anymore. Implement individual iXlate functions for certain cases and store a function pointer in the EXLATEOBJ structure for quick access. Change the usage of the PALETTE.Mode member to be a flag instead of an enum, add usage of PAL_MONOCHOME, PAL_RGB16_555 and PAL_RGB16_565. Add gpalMono, which *should* be used as palette for 1bpp DDBs. Currently there's a hack in the XLATEOBJ init code, to hack around the fact that this is missing. Fix the Hatch brush patterns, as they were inverted. Implement PALETTE_ulGetNearestBitFieldsIndex and PALETTE_ulGetNearestIndex. Get rid of the XLATEOBJ for the mouse pointer instead realize the pointer before usage. Get rid of logicalToSystem PALETTE member. NtGdiGetDIBitsInternal: Don't create a DIBBrush from the BITMAPINFO, when pvBits is NULL, as the function might be uninitualized. This fixes a crash of gdi_regtest. The whole function is quite ugly and needs to be rewritten (like probably the rest of the DIB code). This fixes the problem of artifacts in the selected desktop icons and some color problems. svn path=/trunk/; revision=42391
2009-08-04 20:37:10 +00:00
struct _PALETTE * ppalSurf;
// PALETTE * ppalDC;
// PALETTE * ppal3;
// DWORD dwUnknown44;
BRUSH * pbrush;
FLONG flattrs;
DWORD ulUnique;
// DWORD dwUnknown54;
// DWORD dwUnknown58;
} EBRUSHOBJ, *PEBRUSHOBJ;
/* GDI Brush Attributes */
#define GDIBRUSH_NEED_FG_CLR 0x0001
#define GDIBRUSH_NEED_BK_CLR 0x0002 /* Background color is needed */
#define GDIBRUSH_DITHER_OK 0x0004 /* Allow color dithering */
#define GDIBRUSH_IS_SOLID 0x0010 /* Solid brush */
#define GDIBRUSH_IS_HATCH 0x0020 /* Hatch brush */
#define GDIBRUSH_IS_BITMAP 0x0040 /* DDB pattern brush */
#define GDIBRUSH_IS_DIB 0x0080 /* DIB pattern brush */
#define GDIBRUSH_IS_NULL 0x0100 /* Null/hollow brush */
#define GDIBRUSH_IS_GLOBAL 0x0200 /* Stock objects */
#define GDIBRUSH_IS_PEN 0x0400 /* Pen */
#define GDIBRUSH_IS_OLDSTYLEPEN 0x0800 /* Geometric pen */
#define GDIBRUSH_IS_DIBPALCOLORS 0x1000
#define GDIBRUSH_IS_DIBPALINDICE 0x2000
#define GDIBRUSH_IS_DEFAULTSTYLE 0x4000
#define GDIBRUSH_IS_MASKING 0x8000 /* Pattern bitmap is used as transparent mask (?) */
#define GDIBRUSH_IS_INSIDEFRAME 0x00010000
#define GDIBRUSH_CACHED_ENGINE 0x00040000
#define GDIBRUSH_CACHED_IS_SOLID 0x80000000
#define BRUSH_AllocBrush() ((PBRUSH) GDIOBJ_AllocObj(GDIObjType_BRUSH_TYPE))
#define BRUSH_AllocBrushWithHandle() ((PBRUSH) GDIOBJ_AllocObjWithHandle (GDI_OBJECT_TYPE_BRUSH))
#define BRUSH_FreeBrush(pBrush) GDIOBJ_FreeObj((POBJ)pBrush, GDIObjType_BRUSH_TYPE)
#define BRUSH_FreeBrushByHandle(hBrush) GDIOBJ_FreeObjByHandle((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)
#define BRUSH_LockBrush(hBrush) ((PBRUSH)GDIOBJ_LockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
#define BRUSH_UnlockBrush(pBrush) GDIOBJ_UnlockObjByPtr((POBJ)pBrush)
#define BRUSH_ShareLockBrush(hBrush) ((PBRUSH)GDIOBJ_ShareLockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
#define BRUSH_ShareUnlockBrush(pBrush) GDIOBJ_ShareUnlockObjByPtr((POBJ)pBrush)
INT FASTCALL BRUSH_GetObject (PBRUSH GdiObject, INT Count, LPLOGBRUSH Buffer);
BOOL INTERNAL_CALL BRUSH_Cleanup(PVOID ObjectBody);
struct _DC;
VOID
NTAPI
EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *);
VOID
FASTCALL
XLATEOBJ rewrite. The new XLATEOBJ is not allocated from paged pool anymore, but instead allocated on the stack and Initialized. Only when we habe more than a color table with more than 6 entries, we need to allocate an additional buffer. The new interface: EXLATEOBJ_vInitialize is the main init function. It takes a source and destination palette and back and fore colors for monochome surfaces. EXLATEOBJ_vInitXlateFromDCs takes the source and dest DC and is for color translation between 2 surfaces represented by 2 DCs. EXLATEOBJ_vInitBrushXlate initializes an XLATEOBJ for a pattern brush. Finally EXLATEOBJ_vCleanup needs to be called when the XLATEOBJ is not needed anymore. Implement individual iXlate functions for certain cases and store a function pointer in the EXLATEOBJ structure for quick access. Change the usage of the PALETTE.Mode member to be a flag instead of an enum, add usage of PAL_MONOCHOME, PAL_RGB16_555 and PAL_RGB16_565. Add gpalMono, which *should* be used as palette for 1bpp DDBs. Currently there's a hack in the XLATEOBJ init code, to hack around the fact that this is missing. Fix the Hatch brush patterns, as they were inverted. Implement PALETTE_ulGetNearestBitFieldsIndex and PALETTE_ulGetNearestIndex. Get rid of the XLATEOBJ for the mouse pointer instead realize the pointer before usage. Get rid of logicalToSystem PALETTE member. NtGdiGetDIBitsInternal: Don't create a DIBBrush from the BITMAPINFO, when pvBits is NULL, as the function might be uninitualized. This fixes a crash of gdi_regtest. The whole function is quite ugly and needs to be rewritten (like probably the rest of the DIB code). This fixes the problem of artifacts in the selected desktop icons and some color problems. svn path=/trunk/; revision=42391
2009-08-04 20:37:10 +00:00
EBRUSHOBJ_vSetSolidBrushColor(EBRUSHOBJ *pebo, COLORREF crColor);
VOID
NTAPI
EBRUSHOBJ_vUpdate(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *pdc);
BOOL
NTAPI
EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo, BOOL bCallDriver);
VOID
NTAPI
EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo);
PVOID
NTAPI
EBRUSHOBJ_pvGetEngBrush(EBRUSHOBJ *pebo);
PVOID FASTCALL AllocateObjectAttr(VOID);
VOID FASTCALL FreeObjectAttr(PVOID);
BOOL FASTCALL IntGdiSetBrushOwner(PBRUSH,DWORD);