Misc fixes.
[wine/gsoc_dplay.git] / objects / dc.c
blob7e234bfca924b24bfc2b4637ca6bb9dab42a0bfa
1 /*
2 * GDI Device Context functions
4 * Copyright 1993 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library 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 GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
23 #include <stdlib.h>
24 #include <string.h>
25 #include "windef.h"
26 #include "wingdi.h"
27 #include "winerror.h"
28 #include "wownt32.h"
29 #include "wine/winuser16.h"
30 #include "gdi.h"
31 #include "heap.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(dc);
36 static BOOL DC_DeleteObject( HGDIOBJ handle, void *obj );
38 static const struct gdi_obj_funcs dc_funcs =
40 NULL, /* pSelectObject */
41 NULL, /* pGetObject16 */
42 NULL, /* pGetObjectA */
43 NULL, /* pGetObjectW */
44 NULL, /* pUnrealizeObject */
45 DC_DeleteObject /* pDeleteObject */
48 /***********************************************************************
49 * DC_AllocDC
51 DC *DC_AllocDC( const DC_FUNCTIONS *funcs, WORD magic )
53 HDC hdc;
54 DC *dc;
56 if (!(dc = GDI_AllocObject( sizeof(*dc), magic, (HGDIOBJ*)&hdc, &dc_funcs ))) return NULL;
58 dc->hSelf = hdc;
59 dc->funcs = funcs;
60 dc->physDev = NULL;
61 dc->saveLevel = 0;
62 dc->dwHookData = 0;
63 dc->hookProc = NULL;
64 dc->hookThunk = NULL;
65 dc->wndOrgX = 0;
66 dc->wndOrgY = 0;
67 dc->wndExtX = 1;
68 dc->wndExtY = 1;
69 dc->vportOrgX = 0;
70 dc->vportOrgY = 0;
71 dc->vportExtX = 1;
72 dc->vportExtY = 1;
73 dc->flags = 0;
74 dc->hClipRgn = 0;
75 dc->hVisRgn = 0;
76 dc->hGCClipRgn = 0;
77 dc->hPen = GetStockObject( BLACK_PEN );
78 dc->hBrush = GetStockObject( WHITE_BRUSH );
79 dc->hFont = GetStockObject( SYSTEM_FONT );
80 dc->hBitmap = 0;
81 dc->hDevice = 0;
82 dc->hPalette = GetStockObject( DEFAULT_PALETTE );
83 dc->gdiFont = 0;
84 dc->ROPmode = R2_COPYPEN;
85 dc->polyFillMode = ALTERNATE;
86 dc->stretchBltMode = BLACKONWHITE;
87 dc->relAbsMode = ABSOLUTE;
88 dc->backgroundMode = OPAQUE;
89 dc->backgroundColor = RGB( 255, 255, 255 );
90 dc->textColor = RGB( 0, 0, 0 );
91 dc->brushOrgX = 0;
92 dc->brushOrgY = 0;
93 dc->textAlign = TA_LEFT | TA_TOP | TA_NOUPDATECP;
94 dc->charExtra = 0;
95 dc->breakTotalExtra = 0;
96 dc->breakCount = 0;
97 dc->breakExtra = 0;
98 dc->breakRem = 0;
99 dc->totalExtent.left = 0;
100 dc->totalExtent.top = 0;
101 dc->totalExtent.right = 0;
102 dc->totalExtent.bottom = 0;
103 dc->bitsPerPixel = 1;
104 dc->MapMode = MM_TEXT;
105 dc->GraphicsMode = GM_COMPATIBLE;
106 dc->pAbortProc = NULL;
107 dc->CursPosX = 0;
108 dc->CursPosY = 0;
109 dc->ArcDirection = AD_COUNTERCLOCKWISE;
110 dc->xformWorld2Wnd.eM11 = 1.0f;
111 dc->xformWorld2Wnd.eM12 = 0.0f;
112 dc->xformWorld2Wnd.eM21 = 0.0f;
113 dc->xformWorld2Wnd.eM22 = 1.0f;
114 dc->xformWorld2Wnd.eDx = 0.0f;
115 dc->xformWorld2Wnd.eDy = 0.0f;
116 dc->xformWorld2Vport = dc->xformWorld2Wnd;
117 dc->xformVport2World = dc->xformWorld2Wnd;
118 dc->vport2WorldValid = TRUE;
119 PATH_InitGdiPath(&dc->path);
120 return dc;
125 /***********************************************************************
126 * DC_GetDCPtr
128 DC *DC_GetDCPtr( HDC hdc )
130 GDIOBJHDR *ptr = GDI_GetObjPtr( hdc, MAGIC_DONTCARE );
131 if (!ptr) return NULL;
132 if ((GDIMAGIC(ptr->wMagic) == DC_MAGIC) ||
133 (GDIMAGIC(ptr->wMagic) == MEMORY_DC_MAGIC) ||
134 (GDIMAGIC(ptr->wMagic) == METAFILE_DC_MAGIC) ||
135 (GDIMAGIC(ptr->wMagic) == ENHMETAFILE_DC_MAGIC))
136 return (DC *)ptr;
137 GDI_ReleaseObj( hdc );
138 SetLastError( ERROR_INVALID_HANDLE );
139 return NULL;
142 /***********************************************************************
143 * DC_GetDCUpdate
145 * Retrieve a DC ptr while making sure the visRgn is updated.
146 * This function may call up to USER so the GDI lock should _not_
147 * be held when calling it.
149 DC *DC_GetDCUpdate( HDC hdc )
151 DC *dc = DC_GetDCPtr( hdc );
152 if (!dc) return NULL;
153 while (dc->flags & DC_DIRTY)
155 DCHOOKPROC proc = dc->hookThunk;
156 dc->flags &= ~DC_DIRTY;
157 if (proc)
159 DWORD data = dc->dwHookData;
160 GDI_ReleaseObj( hdc );
161 proc( HDC_16(hdc), DCHC_INVALIDVISRGN, data, 0 );
162 if (!(dc = DC_GetDCPtr( hdc ))) break;
163 /* otherwise restart the loop in case it became dirty again in the meantime */
166 return dc;
170 /***********************************************************************
171 * DC_DeleteObject
173 static BOOL DC_DeleteObject( HGDIOBJ handle, void *obj )
175 GDI_ReleaseObj( handle );
176 return DeleteDC( handle );
180 /***********************************************************************
181 * DC_InitDC
183 * Setup device-specific DC values for a newly created DC.
185 void DC_InitDC( DC* dc )
187 if (dc->funcs->pRealizeDefaultPalette) dc->funcs->pRealizeDefaultPalette( dc->physDev );
188 SetTextColor( dc->hSelf, dc->textColor );
189 SetBkColor( dc->hSelf, dc->backgroundColor );
190 SelectObject( dc->hSelf, dc->hPen );
191 SelectObject( dc->hSelf, dc->hBrush );
192 SelectObject( dc->hSelf, dc->hFont );
193 CLIPPING_UpdateGCRegion( dc );
197 /***********************************************************************
198 * DC_InvertXform
200 * Computes the inverse of the transformation xformSrc and stores it to
201 * xformDest. Returns TRUE if successful or FALSE if the xformSrc matrix
202 * is singular.
204 static BOOL DC_InvertXform( const XFORM *xformSrc, XFORM *xformDest )
206 FLOAT determinant;
208 determinant = xformSrc->eM11*xformSrc->eM22 -
209 xformSrc->eM12*xformSrc->eM21;
210 if (determinant > -1e-12 && determinant < 1e-12)
211 return FALSE;
213 xformDest->eM11 = xformSrc->eM22 / determinant;
214 xformDest->eM12 = -xformSrc->eM12 / determinant;
215 xformDest->eM21 = -xformSrc->eM21 / determinant;
216 xformDest->eM22 = xformSrc->eM11 / determinant;
217 xformDest->eDx = -xformSrc->eDx * xformDest->eM11 -
218 xformSrc->eDy * xformDest->eM21;
219 xformDest->eDy = -xformSrc->eDx * xformDest->eM12 -
220 xformSrc->eDy * xformDest->eM22;
222 return TRUE;
226 /***********************************************************************
227 * DC_UpdateXforms
229 * Updates the xformWorld2Vport, xformVport2World and vport2WorldValid
230 * fields of the specified DC by creating a transformation that
231 * represents the current mapping mode and combining it with the DC's
232 * world transform. This function should be called whenever the
233 * parameters associated with the mapping mode (window and viewport
234 * extents and origins) or the world transform change.
236 void DC_UpdateXforms( DC *dc )
238 XFORM xformWnd2Vport;
239 FLOAT scaleX, scaleY;
241 /* Construct a transformation to do the window-to-viewport conversion */
242 scaleX = (FLOAT)dc->vportExtX / (FLOAT)dc->wndExtX;
243 scaleY = (FLOAT)dc->vportExtY / (FLOAT)dc->wndExtY;
244 xformWnd2Vport.eM11 = scaleX;
245 xformWnd2Vport.eM12 = 0.0;
246 xformWnd2Vport.eM21 = 0.0;
247 xformWnd2Vport.eM22 = scaleY;
248 xformWnd2Vport.eDx = (FLOAT)dc->vportOrgX -
249 scaleX * (FLOAT)dc->wndOrgX;
250 xformWnd2Vport.eDy = (FLOAT)dc->vportOrgY -
251 scaleY * (FLOAT)dc->wndOrgY;
253 /* Combine with the world transformation */
254 CombineTransform( &dc->xformWorld2Vport, &dc->xformWorld2Wnd,
255 &xformWnd2Vport );
257 /* Create inverse of world-to-viewport transformation */
258 dc->vport2WorldValid = DC_InvertXform( &dc->xformWorld2Vport,
259 &dc->xformVport2World );
261 /* Reselect the font back into the dc so that the font size
262 gets updated. */
263 SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_FONT));
267 /***********************************************************************
268 * GetDCState (Not a Windows API)
270 HDC WINAPI GetDCState( HDC hdc )
272 DC * newdc, * dc;
273 HGDIOBJ handle;
275 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
276 if (!(newdc = GDI_AllocObject( sizeof(DC), GDIMAGIC(dc->header.wMagic), &handle, &dc_funcs )))
278 GDI_ReleaseObj( hdc );
279 return 0;
281 TRACE("(%p): returning %p\n", hdc, handle );
283 newdc->flags = dc->flags | DC_SAVED;
284 newdc->hPen = dc->hPen;
285 newdc->hBrush = dc->hBrush;
286 newdc->hFont = dc->hFont;
287 newdc->hBitmap = dc->hBitmap;
288 newdc->hDevice = dc->hDevice;
289 newdc->hPalette = dc->hPalette;
290 newdc->totalExtent = dc->totalExtent;
291 newdc->bitsPerPixel = dc->bitsPerPixel;
292 newdc->ROPmode = dc->ROPmode;
293 newdc->polyFillMode = dc->polyFillMode;
294 newdc->stretchBltMode = dc->stretchBltMode;
295 newdc->relAbsMode = dc->relAbsMode;
296 newdc->backgroundMode = dc->backgroundMode;
297 newdc->backgroundColor = dc->backgroundColor;
298 newdc->textColor = dc->textColor;
299 newdc->brushOrgX = dc->brushOrgX;
300 newdc->brushOrgY = dc->brushOrgY;
301 newdc->textAlign = dc->textAlign;
302 newdc->charExtra = dc->charExtra;
303 newdc->breakTotalExtra = dc->breakTotalExtra;
304 newdc->breakCount = dc->breakCount;
305 newdc->breakExtra = dc->breakExtra;
306 newdc->breakRem = dc->breakRem;
307 newdc->MapMode = dc->MapMode;
308 newdc->GraphicsMode = dc->GraphicsMode;
309 newdc->CursPosX = dc->CursPosX;
310 newdc->CursPosY = dc->CursPosY;
311 newdc->ArcDirection = dc->ArcDirection;
312 newdc->xformWorld2Wnd = dc->xformWorld2Wnd;
313 newdc->xformWorld2Vport = dc->xformWorld2Vport;
314 newdc->xformVport2World = dc->xformVport2World;
315 newdc->vport2WorldValid = dc->vport2WorldValid;
316 newdc->wndOrgX = dc->wndOrgX;
317 newdc->wndOrgY = dc->wndOrgY;
318 newdc->wndExtX = dc->wndExtX;
319 newdc->wndExtY = dc->wndExtY;
320 newdc->vportOrgX = dc->vportOrgX;
321 newdc->vportOrgY = dc->vportOrgY;
322 newdc->vportExtX = dc->vportExtX;
323 newdc->vportExtY = dc->vportExtY;
325 newdc->hSelf = (HDC)handle;
326 newdc->saveLevel = 0;
328 PATH_InitGdiPath( &newdc->path );
330 newdc->pAbortProc = NULL;
331 newdc->hookThunk = NULL;
332 newdc->hookProc = 0;
334 /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */
336 newdc->hGCClipRgn = newdc->hVisRgn = 0;
337 if (dc->hClipRgn)
339 newdc->hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
340 CombineRgn( newdc->hClipRgn, dc->hClipRgn, 0, RGN_COPY );
342 else
343 newdc->hClipRgn = 0;
345 if(dc->gdiFont) {
346 newdc->gdiFont = dc->gdiFont;
347 } else
348 newdc->gdiFont = 0;
350 GDI_ReleaseObj( handle );
351 GDI_ReleaseObj( hdc );
352 return handle;
356 /***********************************************************************
357 * SetDCState (Not a Windows API)
359 void WINAPI SetDCState( HDC hdc, HDC hdcs )
361 DC *dc, *dcs;
363 if (!(dc = DC_GetDCUpdate( hdc ))) return;
364 if (!(dcs = DC_GetDCPtr( hdcs )))
366 GDI_ReleaseObj( hdc );
367 return;
369 if (!dcs->flags & DC_SAVED)
371 GDI_ReleaseObj( hdc );
372 GDI_ReleaseObj( hdcs );
373 return;
375 TRACE("%p %p\n", hdc, hdcs );
377 dc->flags = dcs->flags & ~(DC_SAVED | DC_DIRTY);
378 dc->hDevice = dcs->hDevice;
379 dc->totalExtent = dcs->totalExtent;
380 dc->ROPmode = dcs->ROPmode;
381 dc->polyFillMode = dcs->polyFillMode;
382 dc->stretchBltMode = dcs->stretchBltMode;
383 dc->relAbsMode = dcs->relAbsMode;
384 dc->backgroundMode = dcs->backgroundMode;
385 dc->backgroundColor = dcs->backgroundColor;
386 dc->textColor = dcs->textColor;
387 dc->brushOrgX = dcs->brushOrgX;
388 dc->brushOrgY = dcs->brushOrgY;
389 dc->textAlign = dcs->textAlign;
390 dc->charExtra = dcs->charExtra;
391 dc->breakTotalExtra = dcs->breakTotalExtra;
392 dc->breakCount = dcs->breakCount;
393 dc->breakExtra = dcs->breakExtra;
394 dc->breakRem = dcs->breakRem;
395 dc->MapMode = dcs->MapMode;
396 dc->GraphicsMode = dcs->GraphicsMode;
397 dc->CursPosX = dcs->CursPosX;
398 dc->CursPosY = dcs->CursPosY;
399 dc->ArcDirection = dcs->ArcDirection;
400 dc->xformWorld2Wnd = dcs->xformWorld2Wnd;
401 dc->xformWorld2Vport = dcs->xformWorld2Vport;
402 dc->xformVport2World = dcs->xformVport2World;
403 dc->vport2WorldValid = dcs->vport2WorldValid;
405 dc->wndOrgX = dcs->wndOrgX;
406 dc->wndOrgY = dcs->wndOrgY;
407 dc->wndExtX = dcs->wndExtX;
408 dc->wndExtY = dcs->wndExtY;
409 dc->vportOrgX = dcs->vportOrgX;
410 dc->vportOrgY = dcs->vportOrgY;
411 dc->vportExtX = dcs->vportExtX;
412 dc->vportExtY = dcs->vportExtY;
414 if (GDIMAGIC(dc->header.wMagic) != MEMORY_DC_MAGIC) dc->bitsPerPixel = dcs->bitsPerPixel;
416 if (dcs->hClipRgn)
418 if (!dc->hClipRgn) dc->hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
419 CombineRgn( dc->hClipRgn, dcs->hClipRgn, 0, RGN_COPY );
421 else
423 if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
424 dc->hClipRgn = 0;
426 CLIPPING_UpdateGCRegion( dc );
428 SelectObject( hdc, dcs->hBitmap );
429 SelectObject( hdc, dcs->hBrush );
430 SelectObject( hdc, dcs->hFont );
431 SelectObject( hdc, dcs->hPen );
432 SetBkColor( hdc, dcs->backgroundColor);
433 SetTextColor( hdc, dcs->textColor);
434 GDISelectPalette( hdc, dcs->hPalette, FALSE );
435 GDI_ReleaseObj( hdcs );
436 GDI_ReleaseObj( hdc );
440 /***********************************************************************
441 * GetDCState (GDI.179)
443 HDC16 WINAPI GetDCState16( HDC16 hdc )
445 return HDC_16( GetDCState( HDC_32(hdc) ));
449 /***********************************************************************
450 * SetDCState (GDI.180)
452 void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
454 SetDCState( HDC_32(hdc), HDC_32(hdcs) );
458 /***********************************************************************
459 * SaveDC (GDI32.@)
461 INT WINAPI SaveDC( HDC hdc )
463 HDC hdcs;
464 DC * dc, * dcs;
465 INT ret;
467 dc = DC_GetDCPtr( hdc );
468 if (!dc) return 0;
470 if(dc->funcs->pSaveDC)
472 ret = dc->funcs->pSaveDC( dc->physDev );
473 GDI_ReleaseObj( hdc );
474 return ret;
477 if (!(hdcs = GetDCState( hdc )))
479 GDI_ReleaseObj( hdc );
480 return 0;
482 dcs = DC_GetDCPtr( hdcs );
484 /* Copy path. The reason why path saving / restoring is in SaveDC/
485 * RestoreDC and not in GetDCState/SetDCState is that the ...DCState
486 * functions are only in Win16 (which doesn't have paths) and that
487 * SetDCState doesn't allow us to signal an error (which can happen
488 * when copying paths).
490 if (!PATH_AssignGdiPath( &dcs->path, &dc->path ))
492 GDI_ReleaseObj( hdc );
493 GDI_ReleaseObj( hdcs );
494 DeleteDC( hdcs );
495 return 0;
498 dcs->header.hNext = dc->header.hNext;
499 dc->header.hNext = HDC_16(hdcs);
500 TRACE("(%p): returning %d\n", hdc, dc->saveLevel+1 );
501 ret = ++dc->saveLevel;
502 GDI_ReleaseObj( hdcs );
503 GDI_ReleaseObj( hdc );
504 return ret;
508 /***********************************************************************
509 * RestoreDC (GDI32.@)
511 BOOL WINAPI RestoreDC( HDC hdc, INT level )
513 DC * dc, * dcs;
514 BOOL success;
516 TRACE("%p %d\n", hdc, level );
517 dc = DC_GetDCUpdate( hdc );
518 if(!dc) return FALSE;
519 if(dc->funcs->pRestoreDC)
521 success = dc->funcs->pRestoreDC( dc->physDev, level );
522 GDI_ReleaseObj( hdc );
523 return success;
526 if (level == -1) level = dc->saveLevel;
527 if ((level < 1)
528 /* This pair of checks disagrees with MSDN "Platform SDK:
529 Windows GDI" July 2000 which says all negative values
530 for level will be interpreted as an instance relative
531 to the current state. Restricting it to just -1 does
532 not satisfy this */
533 || (level > dc->saveLevel))
535 GDI_ReleaseObj( hdc );
536 return FALSE;
539 success=TRUE;
540 while (dc->saveLevel >= level)
542 HDC hdcs = HDC_32(dc->header.hNext);
543 if (!(dcs = DC_GetDCPtr( hdcs )))
545 GDI_ReleaseObj( hdc );
546 return FALSE;
548 dc->header.hNext = dcs->header.hNext;
549 if (--dc->saveLevel < level)
551 SetDCState( hdc, hdcs );
552 if (!PATH_AssignGdiPath( &dc->path, &dcs->path ))
553 /* FIXME: This might not be quite right, since we're
554 * returning FALSE but still destroying the saved DC state */
555 success=FALSE;
557 GDI_ReleaseObj( hdcs );
558 GDI_ReleaseObj( hdc );
559 DeleteDC( hdcs );
560 if (!(dc = DC_GetDCPtr( hdc ))) return FALSE;
562 GDI_ReleaseObj( hdc );
563 return success;
567 /***********************************************************************
568 * CreateDCA (GDI32.@)
570 HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
571 const DEVMODEA *initData )
573 HDC hdc;
574 DC * dc;
575 const DC_FUNCTIONS *funcs;
576 char buf[300];
578 GDI_CheckNotLock();
580 if (!device || !DRIVER_GetDriverName( device, buf, sizeof(buf) ))
582 if (!driver) return 0;
583 strcpy(buf, driver);
586 if (!(funcs = DRIVER_load_driver( buf )))
588 ERR( "no driver found for %s\n", buf );
589 return 0;
591 if (!(dc = DC_AllocDC( funcs, DC_MAGIC )))
593 DRIVER_release_driver( funcs );
594 return 0;
597 dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
599 TRACE("(driver=%s, device=%s, output=%s): returning %p\n",
600 debugstr_a(driver), debugstr_a(device), debugstr_a(output), dc->hSelf );
602 if (dc->funcs->pCreateDC &&
603 !dc->funcs->pCreateDC( dc, &dc->physDev, buf, device, output, initData ))
605 WARN("creation aborted by device\n" );
606 GDI_FreeObject( dc->hSelf, dc );
607 DRIVER_release_driver( funcs );
608 return 0;
611 dc->totalExtent.left = 0;
612 dc->totalExtent.top = 0;
613 dc->totalExtent.right = GetDeviceCaps( dc->hSelf, HORZRES );
614 dc->totalExtent.bottom = GetDeviceCaps( dc->hSelf, VERTRES );
615 dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent );
617 DC_InitDC( dc );
618 hdc = dc->hSelf;
619 GDI_ReleaseObj( hdc );
620 return hdc;
624 /***********************************************************************
625 * CreateDCW (GDI32.@)
627 HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
628 const DEVMODEW *initData )
630 LPSTR driverA = HEAP_strdupWtoA( GetProcessHeap(), 0, driver );
631 LPSTR deviceA = HEAP_strdupWtoA( GetProcessHeap(), 0, device );
632 LPSTR outputA = HEAP_strdupWtoA( GetProcessHeap(), 0, output );
633 HDC res = CreateDCA( driverA, deviceA, outputA,
634 (const DEVMODEA *)initData /*FIXME*/ );
635 HeapFree( GetProcessHeap(), 0, driverA );
636 HeapFree( GetProcessHeap(), 0, deviceA );
637 HeapFree( GetProcessHeap(), 0, outputA );
638 return res;
642 /***********************************************************************
643 * CreateICA (GDI32.@)
645 HDC WINAPI CreateICA( LPCSTR driver, LPCSTR device, LPCSTR output,
646 const DEVMODEA* initData )
648 /* Nothing special yet for ICs */
649 return CreateDCA( driver, device, output, initData );
653 /***********************************************************************
654 * CreateICW (GDI32.@)
656 HDC WINAPI CreateICW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
657 const DEVMODEW* initData )
659 /* Nothing special yet for ICs */
660 return CreateDCW( driver, device, output, initData );
664 /***********************************************************************
665 * CreateCompatibleDC (GDI32.@)
667 HDC WINAPI CreateCompatibleDC( HDC hdc )
669 DC *dc, *origDC;
670 const DC_FUNCTIONS *funcs;
671 PHYSDEV physDev;
673 GDI_CheckNotLock();
675 if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC )))
677 funcs = origDC->funcs;
678 physDev = origDC->physDev;
679 GDI_ReleaseObj( hdc ); /* can't hold the lock while loading the driver */
680 funcs = DRIVER_get_driver( funcs );
682 else
684 funcs = DRIVER_load_driver( "DISPLAY" );
685 physDev = NULL;
688 if (!funcs) return 0;
690 if (!(dc = DC_AllocDC( funcs, MEMORY_DC_MAGIC )))
692 DRIVER_release_driver( funcs );
693 return 0;
696 TRACE("(%p): returning %p\n", hdc, dc->hSelf );
698 dc->bitsPerPixel = 1;
699 dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
701 /* Copy the driver-specific physical device info into
702 * the new DC. The driver may use this read-only info
703 * while creating the compatible DC below. */
704 dc->physDev = physDev;
706 if (dc->funcs->pCreateDC &&
707 !dc->funcs->pCreateDC( dc, &dc->physDev, NULL, NULL, NULL, NULL ))
709 WARN("creation aborted by device\n");
710 GDI_FreeObject( dc->hSelf, dc );
711 DRIVER_release_driver( funcs );
712 return 0;
715 dc->totalExtent.left = 0;
716 dc->totalExtent.top = 0;
717 dc->totalExtent.right = 1; /* default bitmap is 1x1 */
718 dc->totalExtent.bottom = 1;
719 dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent );
721 DC_InitDC( dc );
722 GDI_ReleaseObj( dc->hSelf );
723 return dc->hSelf;
727 /***********************************************************************
728 * DeleteDC (GDI32.@)
730 BOOL WINAPI DeleteDC( HDC hdc )
732 const DC_FUNCTIONS *funcs = NULL;
733 DC * dc;
735 TRACE("%p\n", hdc );
737 GDI_CheckNotLock();
739 if (!(dc = DC_GetDCPtr( hdc ))) return FALSE;
741 /* Call hook procedure to check whether is it OK to delete this DC */
742 if (dc->hookThunk)
744 DCHOOKPROC proc = dc->hookThunk;
745 DWORD data = dc->dwHookData;
746 GDI_ReleaseObj( hdc );
747 if (!proc( HDC_16(hdc), DCHC_DELETEDC, data, 0 )) return FALSE;
748 if (!(dc = DC_GetDCPtr( hdc ))) return TRUE; /* deleted by the hook */
751 while (dc->saveLevel)
753 DC * dcs;
754 HDC hdcs = HDC_32(dc->header.hNext);
755 if (!(dcs = DC_GetDCPtr( hdcs ))) break;
756 dc->header.hNext = dcs->header.hNext;
757 dc->saveLevel--;
758 if (dcs->hClipRgn) DeleteObject( dcs->hClipRgn );
759 if (dcs->hVisRgn) DeleteObject( dcs->hVisRgn );
760 if (dcs->hGCClipRgn) DeleteObject( dcs->hGCClipRgn );
761 PATH_DestroyGdiPath(&dcs->path);
762 GDI_FreeObject( hdcs, dcs );
765 if (!(dc->flags & DC_SAVED))
767 SelectObject( hdc, GetStockObject(BLACK_PEN) );
768 SelectObject( hdc, GetStockObject(WHITE_BRUSH) );
769 SelectObject( hdc, GetStockObject(SYSTEM_FONT) );
770 SelectObject( hdc, GetStockObject(DEFAULT_BITMAP) );
771 funcs = dc->funcs;
772 if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc->physDev);
773 dc->physDev = NULL;
776 if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
777 if (dc->hVisRgn) DeleteObject( dc->hVisRgn );
778 if (dc->hGCClipRgn) DeleteObject( dc->hGCClipRgn );
779 PATH_DestroyGdiPath(&dc->path);
781 GDI_FreeObject( hdc, dc );
782 if (funcs) DRIVER_release_driver( funcs ); /* do that after releasing the GDI lock */
783 return TRUE;
787 /***********************************************************************
788 * ResetDCA (GDI32.@)
790 HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode )
792 DC *dc;
793 HDC ret = hdc;
795 if ((dc = DC_GetDCPtr( hdc )))
797 if (dc->funcs->pResetDC) ret = dc->funcs->pResetDC( dc->physDev, devmode );
798 GDI_ReleaseObj( hdc );
800 return ret;
804 /***********************************************************************
805 * ResetDCW (GDI32.@)
807 HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode )
809 return ResetDCA(hdc, (const DEVMODEA*)devmode); /* FIXME */
813 /***********************************************************************
814 * GetDeviceCaps (GDI32.@)
816 INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
818 DC *dc;
819 INT ret = 0;
821 if ((dc = DC_GetDCPtr( hdc )))
823 if (dc->funcs->pGetDeviceCaps) ret = dc->funcs->pGetDeviceCaps( dc->physDev, cap );
824 GDI_ReleaseObj( hdc );
826 return ret;
830 /***********************************************************************
831 * SetBkColor (GDI32.@)
833 COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color )
835 COLORREF oldColor;
836 DC * dc = DC_GetDCPtr( hdc );
838 if (!dc) return CLR_INVALID;
839 oldColor = dc->backgroundColor;
840 if (dc->funcs->pSetBkColor)
842 color = dc->funcs->pSetBkColor(dc->physDev, color);
843 if (color == CLR_INVALID) /* don't change it */
845 color = oldColor;
846 oldColor = CLR_INVALID;
849 dc->backgroundColor = color;
850 GDI_ReleaseObj( hdc );
851 return oldColor;
855 /***********************************************************************
856 * SetTextColor (GDI32.@)
858 COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
860 COLORREF oldColor;
861 DC * dc = DC_GetDCPtr( hdc );
863 if (!dc) return CLR_INVALID;
864 oldColor = dc->textColor;
865 if (dc->funcs->pSetTextColor)
867 color = dc->funcs->pSetTextColor(dc->physDev, color);
868 if (color == CLR_INVALID) /* don't change it */
870 color = oldColor;
871 oldColor = CLR_INVALID;
874 dc->textColor = color;
875 GDI_ReleaseObj( hdc );
876 return oldColor;
880 /***********************************************************************
881 * SetTextAlign (GDI32.@)
883 UINT WINAPI SetTextAlign( HDC hdc, UINT align )
885 UINT prevAlign;
886 DC *dc = DC_GetDCPtr( hdc );
887 if (!dc) return 0x0;
888 if (dc->funcs->pSetTextAlign)
889 prevAlign = dc->funcs->pSetTextAlign(dc->physDev, align);
890 else {
891 prevAlign = dc->textAlign;
892 dc->textAlign = align;
894 GDI_ReleaseObj( hdc );
895 return prevAlign;
898 /***********************************************************************
899 * GetDCOrgEx (GDI32.@)
901 BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp )
903 DC * dc;
905 if (!lpp) return FALSE;
906 if (!(dc = DC_GetDCPtr( hDC ))) return FALSE;
908 lpp->x = lpp->y = 0;
909 if (dc->funcs->pGetDCOrgEx) dc->funcs->pGetDCOrgEx( dc->physDev, lpp );
910 GDI_ReleaseObj( hDC );
911 return TRUE;
915 /***********************************************************************
916 * SetDCOrg (GDI.117)
918 DWORD WINAPI SetDCOrg16( HDC16 hdc16, INT16 x, INT16 y )
920 DWORD prevOrg = 0;
921 HDC hdc = HDC_32( hdc16 );
922 DC *dc = DC_GetDCPtr( hdc );
923 if (!dc) return 0;
924 if (dc->funcs->pSetDCOrg) prevOrg = dc->funcs->pSetDCOrg( dc->physDev, x, y );
925 GDI_ReleaseObj( hdc );
926 return prevOrg;
930 /***********************************************************************
931 * SetGraphicsMode (GDI32.@)
933 INT WINAPI SetGraphicsMode( HDC hdc, INT mode )
935 INT ret = 0;
936 DC *dc = DC_GetDCPtr( hdc );
938 /* One would think that setting the graphics mode to GM_COMPATIBLE
939 * would also reset the world transformation matrix to the unity
940 * matrix. However, in Windows, this is not the case. This doesn't
941 * make a lot of sense to me, but that's the way it is.
943 if (!dc) return 0;
944 if ((mode > 0) && (mode <= GM_LAST))
946 ret = dc->GraphicsMode;
947 dc->GraphicsMode = mode;
949 GDI_ReleaseObj( hdc );
950 return ret;
954 /***********************************************************************
955 * SetArcDirection (GDI32.@)
957 INT WINAPI SetArcDirection( HDC hdc, INT nDirection )
959 DC * dc;
960 INT nOldDirection = 0;
962 if (nDirection!=AD_COUNTERCLOCKWISE && nDirection!=AD_CLOCKWISE)
964 SetLastError(ERROR_INVALID_PARAMETER);
965 return 0;
968 if ((dc = DC_GetDCPtr( hdc )))
970 nOldDirection = dc->ArcDirection;
971 dc->ArcDirection = nDirection;
972 GDI_ReleaseObj( hdc );
974 return nOldDirection;
978 /***********************************************************************
979 * GetWorldTransform (GDI32.@)
981 BOOL WINAPI GetWorldTransform( HDC hdc, LPXFORM xform )
983 DC * dc;
984 if (!xform) return FALSE;
985 if (!(dc = DC_GetDCPtr( hdc ))) return FALSE;
986 *xform = dc->xformWorld2Wnd;
987 GDI_ReleaseObj( hdc );
988 return TRUE;
992 /***********************************************************************
993 * GetTransform (GDI32.@)
995 BOOL WINAPI GetTransform( HDC hdc, DWORD unknown, LPXFORM xform )
997 if (unknown == 0x0203) return GetWorldTransform( hdc, xform );
998 ERR("stub: don't know what to do for code %lx\n", unknown );
999 return FALSE;
1003 /***********************************************************************
1004 * SetWorldTransform (GDI32.@)
1006 BOOL WINAPI SetWorldTransform( HDC hdc, const XFORM *xform )
1008 BOOL ret = FALSE;
1009 DC *dc = DC_GetDCPtr( hdc );
1011 if (!dc) return FALSE;
1012 if (!xform) goto done;
1014 /* Check that graphics mode is GM_ADVANCED */
1015 if (dc->GraphicsMode!=GM_ADVANCED) goto done;
1017 if (dc->funcs->pSetWorldTransform)
1019 ret = dc->funcs->pSetWorldTransform(dc->physDev, xform);
1020 if (!ret) goto done;
1023 dc->xformWorld2Wnd = *xform;
1024 DC_UpdateXforms( dc );
1025 ret = TRUE;
1026 done:
1027 GDI_ReleaseObj( hdc );
1028 return ret;
1032 /****************************************************************************
1033 * ModifyWorldTransform [GDI32.@]
1034 * Modifies the world transformation for a device context.
1036 * PARAMS
1037 * hdc [I] Handle to device context
1038 * xform [I] XFORM structure that will be used to modify the world
1039 * transformation
1040 * iMode [I] Specifies in what way to modify the world transformation
1041 * Possible values:
1042 * MWT_IDENTITY
1043 * Resets the world transformation to the identity matrix.
1044 * The parameter xform is ignored.
1045 * MWT_LEFTMULTIPLY
1046 * Multiplies xform into the world transformation matrix from
1047 * the left.
1048 * MWT_RIGHTMULTIPLY
1049 * Multiplies xform into the world transformation matrix from
1050 * the right.
1052 * RETURNS STD
1054 BOOL WINAPI ModifyWorldTransform( HDC hdc, const XFORM *xform,
1055 DWORD iMode )
1057 BOOL ret = FALSE;
1058 DC *dc = DC_GetDCPtr( hdc );
1060 /* Check for illegal parameters */
1061 if (!dc) return FALSE;
1062 if (!xform) goto done;
1064 /* Check that graphics mode is GM_ADVANCED */
1065 if (dc->GraphicsMode!=GM_ADVANCED) goto done;
1067 if (dc->funcs->pModifyWorldTransform)
1069 ret = dc->funcs->pModifyWorldTransform(dc->physDev, xform, iMode);
1070 if (!ret) goto done;
1073 switch (iMode)
1075 case MWT_IDENTITY:
1076 dc->xformWorld2Wnd.eM11 = 1.0f;
1077 dc->xformWorld2Wnd.eM12 = 0.0f;
1078 dc->xformWorld2Wnd.eM21 = 0.0f;
1079 dc->xformWorld2Wnd.eM22 = 1.0f;
1080 dc->xformWorld2Wnd.eDx = 0.0f;
1081 dc->xformWorld2Wnd.eDy = 0.0f;
1082 break;
1083 case MWT_LEFTMULTIPLY:
1084 CombineTransform( &dc->xformWorld2Wnd, xform,
1085 &dc->xformWorld2Wnd );
1086 break;
1087 case MWT_RIGHTMULTIPLY:
1088 CombineTransform( &dc->xformWorld2Wnd, &dc->xformWorld2Wnd,
1089 xform );
1090 break;
1091 default:
1092 goto done;
1095 DC_UpdateXforms( dc );
1096 ret = TRUE;
1097 done:
1098 GDI_ReleaseObj( hdc );
1099 return ret;
1103 /****************************************************************************
1104 * CombineTransform [GDI32.@]
1105 * Combines two transformation matrices.
1107 * PARAMS
1108 * xformResult [O] Stores the result of combining the two matrices
1109 * xform1 [I] Specifies the first matrix to apply
1110 * xform2 [I] Specifies the second matrix to apply
1112 * REMARKS
1113 * The same matrix can be passed in for more than one of the parameters.
1115 * RETURNS STD
1117 BOOL WINAPI CombineTransform( LPXFORM xformResult, const XFORM *xform1,
1118 const XFORM *xform2 )
1120 XFORM xformTemp;
1122 /* Check for illegal parameters */
1123 if (!xformResult || !xform1 || !xform2)
1124 return FALSE;
1126 /* Create the result in a temporary XFORM, since xformResult may be
1127 * equal to xform1 or xform2 */
1128 xformTemp.eM11 = xform1->eM11 * xform2->eM11 +
1129 xform1->eM12 * xform2->eM21;
1130 xformTemp.eM12 = xform1->eM11 * xform2->eM12 +
1131 xform1->eM12 * xform2->eM22;
1132 xformTemp.eM21 = xform1->eM21 * xform2->eM11 +
1133 xform1->eM22 * xform2->eM21;
1134 xformTemp.eM22 = xform1->eM21 * xform2->eM12 +
1135 xform1->eM22 * xform2->eM22;
1136 xformTemp.eDx = xform1->eDx * xform2->eM11 +
1137 xform1->eDy * xform2->eM21 +
1138 xform2->eDx;
1139 xformTemp.eDy = xform1->eDx * xform2->eM12 +
1140 xform1->eDy * xform2->eM22 +
1141 xform2->eDy;
1143 /* Copy the result to xformResult */
1144 *xformResult = xformTemp;
1146 return TRUE;
1150 /***********************************************************************
1151 * SetDCHook (GDI32.@)
1153 * Note: this doesn't exist in Win32, we add it here because user32 needs it.
1155 BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD dwHookData )
1157 DC *dc = GDI_GetObjPtr( hdc, DC_MAGIC );
1159 if (!dc) return FALSE;
1161 if (!(dc->flags & DC_SAVED))
1163 dc->dwHookData = dwHookData;
1164 dc->hookThunk = hookProc;
1166 GDI_ReleaseObj( hdc );
1167 return TRUE;
1171 /* relay function to call the 16-bit DC hook proc */
1172 static BOOL16 WINAPI call_dc_hook16( HDC16 hdc16, WORD code, DWORD data, LPARAM lParam )
1174 WORD args[6];
1175 DWORD ret;
1176 FARPROC16 proc = NULL;
1177 HDC hdc = HDC_32( hdc16 );
1178 DC *dc = DC_GetDCPtr( hdc );
1180 if (!dc) return FALSE;
1181 proc = dc->hookProc;
1182 GDI_ReleaseObj( hdc );
1183 if (!proc) return FALSE;
1184 args[5] = hdc16;
1185 args[4] = code;
1186 args[3] = HIWORD(data);
1187 args[2] = LOWORD(data);
1188 args[1] = HIWORD(lParam);
1189 args[0] = LOWORD(lParam);
1190 WOWCallback16Ex( (DWORD)proc, WCB16_PASCAL, sizeof(args), args, &ret );
1191 return LOWORD(ret);
1194 /***********************************************************************
1195 * SetDCHook (GDI.190)
1197 BOOL16 WINAPI SetDCHook16( HDC16 hdc16, FARPROC16 hookProc, DWORD dwHookData )
1199 HDC hdc = HDC_32( hdc16 );
1200 DC *dc = DC_GetDCPtr( hdc );
1201 if (!dc) return FALSE;
1203 dc->hookProc = hookProc;
1204 GDI_ReleaseObj( hdc );
1205 return SetDCHook( hdc, call_dc_hook16, dwHookData );
1209 /***********************************************************************
1210 * GetDCHook (GDI.191)
1212 DWORD WINAPI GetDCHook16( HDC16 hdc16, FARPROC16 *phookProc )
1214 HDC hdc = HDC_32( hdc16 );
1215 DC *dc = DC_GetDCPtr( hdc );
1216 DWORD ret;
1218 if (!dc) return 0;
1219 *phookProc = dc->hookProc;
1220 ret = dc->dwHookData;
1221 GDI_ReleaseObj( hdc );
1222 return ret;
1226 /***********************************************************************
1227 * SetHookFlags (GDI.192)
1229 WORD WINAPI SetHookFlags16(HDC16 hdc16, WORD flags)
1231 HDC hdc = HDC_32( hdc16 );
1232 DC *dc = DC_GetDCPtr( hdc );
1234 if( dc )
1236 WORD wRet = dc->flags & DC_DIRTY;
1238 /* "Undocumented Windows" info is slightly confusing.
1241 TRACE("hDC %p, flags %04x\n",hdc,flags);
1243 if( flags & DCHF_INVALIDATEVISRGN )
1244 dc->flags |= DC_DIRTY;
1245 else if( flags & DCHF_VALIDATEVISRGN || !flags )
1246 dc->flags &= ~DC_DIRTY;
1247 GDI_ReleaseObj( hdc );
1248 return wRet;
1250 return 0;
1253 /***********************************************************************
1254 * SetICMMode (GDI32.@)
1256 INT WINAPI SetICMMode(HDC hdc, INT iEnableICM)
1258 /*FIXME Asuming that ICM is always off, and cannot be turned on */
1259 if (iEnableICM == ICM_OFF) return ICM_OFF;
1260 if (iEnableICM == ICM_ON) return 0;
1261 if (iEnableICM == ICM_QUERY) return ICM_OFF;
1262 return 0;
1265 /***********************************************************************
1266 * GetDeviceGammaRamp (GDI32.@)
1268 BOOL WINAPI GetDeviceGammaRamp(HDC hDC, LPVOID ptr)
1270 BOOL ret = FALSE;
1271 DC *dc = DC_GetDCPtr( hDC );
1273 if( dc )
1275 if (dc->funcs->pGetDeviceGammaRamp)
1276 ret = dc->funcs->pGetDeviceGammaRamp(dc->physDev, ptr);
1277 GDI_ReleaseObj( hDC );
1279 return ret;
1282 /***********************************************************************
1283 * SetDeviceGammaRamp (GDI32.@)
1285 BOOL WINAPI SetDeviceGammaRamp(HDC hDC, LPVOID ptr)
1287 BOOL ret = FALSE;
1288 DC *dc = DC_GetDCPtr( hDC );
1290 if( dc )
1292 if (dc->funcs->pSetDeviceGammaRamp)
1293 ret = dc->funcs->pSetDeviceGammaRamp(dc->physDev, ptr);
1294 GDI_ReleaseObj( hDC );
1296 return ret;
1299 /***********************************************************************
1300 * GetColorSpace (GDI32.@)
1302 HCOLORSPACE WINAPI GetColorSpace(HDC hdc)
1304 /*FIXME Need to to whatever GetColorSpace actually does */
1305 return 0;
1308 /***********************************************************************
1309 * CreateColorSpaceA (GDI32.@)
1311 HCOLORSPACE WINAPI CreateColorSpaceA( LPLOGCOLORSPACEA lpLogColorSpace )
1313 FIXME( "stub\n" );
1314 return 0;
1317 /***********************************************************************
1318 * CreateColorSpaceW (GDI32.@)
1320 HCOLORSPACE WINAPI CreateColorSpaceW( LPLOGCOLORSPACEW lpLogColorSpace )
1322 FIXME( "stub\n" );
1323 return 0;
1326 /***********************************************************************
1327 * DeleteColorSpace (GDI32.@)
1329 BOOL WINAPI DeleteColorSpace( HCOLORSPACE hColorSpace )
1331 FIXME( "stub\n" );
1333 return TRUE;
1336 /***********************************************************************
1337 * SetColorSpace (GDI32.@)
1339 HCOLORSPACE WINAPI SetColorSpace( HDC hDC, HCOLORSPACE hColorSpace )
1341 FIXME( "stub\n" );
1343 return hColorSpace;
1346 /***********************************************************************
1347 * GetBoundsRect (GDI.194)
1349 UINT16 WINAPI GetBoundsRect16(HDC16 hdc, LPRECT16 rect, UINT16 flags)
1351 return DCB_RESET | DCB_DISABLE; /* bounding rectangle always empty and disabled*/
1354 /***********************************************************************
1355 * GetBoundsRect (GDI32.@)
1357 UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
1359 FIXME("(): stub\n");
1360 return DCB_RESET; /* bounding rectangle always empty */
1363 /***********************************************************************
1364 * SetBoundsRect (GDI.193)
1366 UINT16 WINAPI SetBoundsRect16(HDC16 hdc, const RECT16* rect, UINT16 flags)
1368 if ( (flags & DCB_ACCUMULATE) || (flags & DCB_ENABLE) )
1369 FIXME("(%04x, %p, %04x): stub\n", hdc, rect, flags );
1371 return DCB_RESET | DCB_DISABLE; /* bounding rectangle always empty and disabled*/
1374 /***********************************************************************
1375 * SetBoundsRect (GDI32.@)
1377 UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
1379 FIXME("(): stub\n");
1380 return DCB_DISABLE; /* bounding rectangle always empty */
1384 /***********************************************************************
1385 * GetRelAbs (GDI32.@)
1387 INT WINAPI GetRelAbs( HDC hdc, DWORD dwIgnore )
1389 INT ret = 0;
1390 DC *dc = DC_GetDCPtr( hdc );
1391 if (dc) ret = dc->relAbsMode;
1392 GDI_ReleaseObj( hdc );
1393 return ret;
1396 /***********************************************************************
1397 * GetLayout (GDI32.@)
1399 * Gets left->right or right->left text layout flags of a dc.
1400 * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same
1403 DWORD WINAPI GetLayout(HDC hdc)
1405 FIXME("(%p): stub\n", hdc);
1406 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1407 return 0;
1410 /***********************************************************************
1411 * SetLayout (GDI32.@)
1413 * Sets left->right or right->left text layout flags of a dc.
1414 * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same
1417 DWORD WINAPI SetLayout(HDC hdc, DWORD layout)
1419 FIXME("(%p,%08lx): stub\n", hdc, layout);
1420 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1421 return 0;
1424 /***********************************************************************
1425 * SetDCBrushColor (GDI32.@)
1427 * Sets the current device context (DC) brush color to the specified
1428 * color value. If the device cannot represent the specified color
1429 * value, the color is set to the nearest physical color.
1432 COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor)
1434 FIXME("(%p, %08lx): stub\n", hdc, crColor);
1435 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1436 return CLR_INVALID;
1439 /***********************************************************************
1440 * SetVirtualResolution (GDI32.@)
1442 * Undocumented on msdn. Called when powerpoint xp saves a file.
1444 DWORD WINAPI SetVirtualResolution(HDC hdc, DWORD dw2, DWORD dw3, DWORD dw4, DWORD dw5)
1446 FIXME("(%p %08lx %08lx %08lx %08lx): stub!\n", hdc, dw2, dw3, dw4, dw5);
1447 return FALSE;