/* * ReactOS W32 Subsystem * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* $Id$ */ #undef WIN32_LEAN_AND_MEAN #include #include #include #include //#include #include #include #include #define NDEBUG #include HBRUSH STDCALL NtGdiCreateBrushIndirect(CONST LOGBRUSH *lb) { PBRUSHOBJ brushPtr; HBRUSH hBrush; hBrush = BRUSHOBJ_AllocBrush(); if (hBrush == NULL) { return 0; } brushPtr = BRUSHOBJ_LockBrush (hBrush); /* FIXME: Occurs! FiN */ /* ASSERT( brushPtr ); *///I want to know if this ever occurs if( brushPtr ){ brushPtr->iSolidColor = lb->lbColor; brushPtr->logbrush.lbStyle = lb->lbStyle; brushPtr->logbrush.lbColor = lb->lbColor; brushPtr->logbrush.lbHatch = lb->lbHatch; BRUSHOBJ_UnlockBrush( hBrush ); return hBrush; } return NULL; } HBRUSH STDCALL NtGdiCreateDIBPatternBrush(HGLOBAL hDIBPacked, UINT ColorSpec) { UNIMPLEMENTED; #if 0 LOGBRUSH logbrush; PBITMAPINFO info, newInfo; INT size; DPRINT("%04x\n", hbitmap ); logbrush.lbStyle = BS_DIBPATTERN; logbrush.lbColor = coloruse; logbrush.lbHatch = 0; /* Make a copy of the bitmap */ if (!(info = (BITMAPINFO *)GlobalLock( hbitmap ))) { return 0; } if (info->bmiHeader.biCompression) size = info->bmiHeader.biSizeImage; else size = DIB_GetDIBImageBytes(info->bmiHeader.biWidth, info->bmiHeader.biHeight, info->bmiHeader.biBitCount); size += DIB_BitmapInfoSize(info, coloruse); if (!(logbrush.lbHatch = (INT)GlobalAlloc16( GMEM_MOVEABLE, size ))) { GlobalUnlock16( hbitmap ); return 0; } newInfo = (BITMAPINFO *) GlobalLock16((HGLOBAL16)logbrush.lbHatch); memcpy(newInfo, info, size); GlobalUnlock16((HGLOBAL16)logbrush.lbHatch); GlobalUnlock(hbitmap); return NtGdiCreateBrushIndirect(&logbrush); #endif } HBRUSH STDCALL NtGdiCreateDIBPatternBrushPt(CONST VOID *PackedDIB, UINT Usage) { INT size; LOGBRUSH logbrush; PBITMAPINFO info; PBITMAPINFO newInfo; info = (BITMAPINFO *) PackedDIB; if (info == NULL) { return 0; } DPRINT ("%p %ldx%ld %dbpp\n", info, info->bmiHeader.biWidth, info->bmiHeader.biHeight, info->bmiHeader.biBitCount); logbrush.lbStyle = BS_DIBPATTERN; logbrush.lbColor = Usage; logbrush.lbHatch = 0; /* Make a copy of the bitmap */ if (info->bmiHeader.biCompression) { size = info->bmiHeader.biSizeImage; } else { size = DIB_GetDIBImageBytes (info->bmiHeader.biWidth, info->bmiHeader.biHeight, info->bmiHeader.biBitCount); } size += DIB_BitmapInfoSize (info, Usage); logbrush.lbHatch = (LONG) GDIOBJ_AllocObj(size, GDI_OBJECT_TYPE_DONTCARE, NULL); if (logbrush.lbHatch == 0) { return 0; } newInfo = (PBITMAPINFO) GDIOBJ_LockObj ((HGDIOBJ) logbrush.lbHatch, GDI_OBJECT_TYPE_DONTCARE); ASSERT(newInfo); memcpy(newInfo, info, size); GDIOBJ_UnlockObj((HGDIOBJ) logbrush.lbHatch, GDI_OBJECT_TYPE_DONTCARE); return NtGdiCreateBrushIndirect (&logbrush); } HBRUSH STDCALL NtGdiCreateHatchBrush(INT Style, COLORREF Color) { LOGBRUSH logbrush; DPRINT("%d %06lx\n", Style, Color); if (Style < 0 || Style >= NB_HATCH_STYLES) { return 0; } logbrush.lbStyle = BS_HATCHED; logbrush.lbColor = Color; logbrush.lbHatch = Style; return NtGdiCreateBrushIndirect (&logbrush); } HBRUSH STDCALL NtGdiCreatePatternBrush(HBITMAP hBitmap) { LOGBRUSH logbrush = { BS_PATTERN, 0, 0 }; DPRINT ("%04x\n", hBitmap); logbrush.lbHatch = (INT) BITMAPOBJ_CopyBitmap (hBitmap); if(!logbrush.lbHatch) { return 0; } else { return NtGdiCreateBrushIndirect( &logbrush ); } } HBRUSH STDCALL NtGdiCreateSolidBrush(COLORREF Color) { LOGBRUSH logbrush; logbrush.lbStyle = BS_SOLID; logbrush.lbColor = Color; logbrush.lbHatch = 0; return NtGdiCreateBrushIndirect(&logbrush); } BOOL STDCALL NtGdiFixBrushOrgEx(VOID) { return FALSE; } BOOL STDCALL IntPatBlt(DC *dc, INT XLeft, INT YLeft, INT Width, INT Height, DWORD ROP, PBRUSHOBJ BrushObj) { RECT DestRect; PSURFOBJ SurfObj; BOOL ret; SurfObj = (SURFOBJ*)AccessUserObject((ULONG)dc->Surface); assert(BrushObj); if (BrushObj->logbrush.lbStyle != BS_NULL) { if (Width > 0) { DestRect.left = XLeft + dc->w.DCOrgX; DestRect.right = XLeft + Width + dc->w.DCOrgX; } else { DestRect.left = XLeft + Width + 1 + dc->w.DCOrgX; DestRect.right = XLeft + dc->w.DCOrgX + 1; } if (Height > 0) { DestRect.top = YLeft + dc->w.DCOrgY; DestRect.bottom = YLeft + Height + dc->w.DCOrgY; } else { DestRect.top = YLeft + Height + dc->w.DCOrgY + 1; DestRect.bottom = YLeft + dc->w.DCOrgY + 1; } ret = IntEngBitBlt(SurfObj, NULL, NULL, dc->CombinedClip, NULL, &DestRect, NULL, NULL, BrushObj, NULL, ROP); } return(ret); } BOOL STDCALL NtGdiPolyPatBlt(HDC hDC, DWORD dwRop, PPATRECT pRects, int cRects, ULONG Reserved) { int i; PATRECT r; PBRUSHOBJ BrushObj; DC *dc = DC_LockDc(hDC); if (dc == NULL) { SetLastWin32Error(ERROR_INVALID_HANDLE); return(FALSE); } for (i = 0;iw.hBrush); ret = IntPatBlt(dc,XLeft,YLeft,Width,Height,ROP,BrushObj); BRUSHOBJ_UnlockBrush(dc->w.hBrush); DC_UnlockDc( hDC ); return(ret); } BOOL STDCALL NtGdiSetBrushOrgEx(HDC hDC, INT XOrg, INT YOrg, LPPOINT Point) { UNIMPLEMENTED; } /* EOF */