2 * ReactOS Win32 Subsystem
4 * Copyright (C) 1998 - 2004 ReactOS Team
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 /* PRIVATE FUNCTIONS **********************************************************/
31 IntGdiCreatePenIndirect(PLOGPEN LogPen
)
34 PGDIBRUSHOBJ PenObject
;
35 static const WORD wPatternAlternate
[] = {0x5555};
37 if (LogPen
->lopnStyle
> PS_INSIDEFRAME
)
40 hPen
= PENOBJ_AllocPen();
43 SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY
);
44 DPRINT("Can't allocate pen\n");
48 PenObject
= PENOBJ_LockPen(hPen
);
49 /* FIXME - Handle PenObject == NULL!!! */
50 PenObject
->ptPenWidth
= LogPen
->lopnWidth
;
51 PenObject
->ulPenStyle
= LogPen
->lopnStyle
;
52 PenObject
->BrushAttr
.lbColor
= LogPen
->lopnColor
;
53 PenObject
->flAttrs
= GDIBRUSH_IS_OLDSTYLEPEN
;
54 switch (LogPen
->lopnStyle
)
57 PenObject
->flAttrs
|= GDIBRUSH_IS_NULL
;
61 PenObject
->flAttrs
|= GDIBRUSH_IS_SOLID
;
65 PenObject
->flAttrs
|= GDIBRUSH_IS_BITMAP
;
66 PenObject
->hbmPattern
= NtGdiCreateBitmap(8, 1, 1, 1, (LPBYTE
)wPatternAlternate
);
70 DPRINT1("FIXME: IntGdiCreatePenIndirect is UNIMPLEMENTED\n");
73 PENOBJ_UnlockPen(PenObject
);
78 /* PUBLIC FUNCTIONS ***********************************************************/
89 LogPen
.lopnStyle
= PenStyle
;
90 LogPen
.lopnWidth
.x
= Width
;
91 LogPen
.lopnWidth
.y
= 0;
92 LogPen
.lopnColor
= Color
;
94 return IntGdiCreatePenIndirect(&LogPen
);
98 NtGdiCreatePenIndirect(CONST PLOGPEN LogPen
)
101 NTSTATUS Status
= STATUS_SUCCESS
;
108 SafeLogPen
= *LogPen
;
112 Status
= _SEH_GetExceptionCode();
116 if (!NT_SUCCESS(Status
))
118 SetLastNtError(Status
);
122 return IntGdiCreatePenIndirect(&SafeLogPen
);
129 IN ULONG iBrushStyle
,
131 IN ULONG_PTR lClientHatch
,
136 IN BOOL bOldStylePen
,
137 IN OPTIONAL HBRUSH hbrush
)
139 /* NOTE: This is HACK! */
140 DPRINT1("FIXME: FIX CALLERS FIRST!\n");
144 if (PenStyle
& PS_USERSTYLE
)
145 PenStyle
= (PenStyle
& ~PS_STYLE_MASK
) | PS_SOLID
;
147 LogPen
.lopnStyle
= PenStyle
& PS_STYLE_MASK
;
148 LogPen
.lopnWidth
.x
= Width
;
149 LogPen
.lopnColor
= ulColor
;
151 return IntGdiCreatePenIndirect(&LogPen
);