Added an implementation of iphlpapi.dll; most Get* functions
[wine.git] / objects / dc.c
blobf352c46d15ee4d67e253ede28f5e25285670a63f
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 )
53 HDC hdc;
54 DC *dc;
56 if (!(dc = GDI_AllocObject( sizeof(*dc), 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) == METAFILE_DC_MAGIC) ||
134 (GDIMAGIC(ptr->wMagic) == ENHMETAFILE_DC_MAGIC))
135 return (DC *)ptr;
136 GDI_ReleaseObj( hdc );
137 SetLastError( ERROR_INVALID_HANDLE );
138 return NULL;
141 /***********************************************************************
142 * DC_GetDCUpdate
144 * Retrieve a DC ptr while making sure the visRgn is updated.
145 * This function may call up to USER so the GDI lock should _not_
146 * be held when calling it.
148 DC *DC_GetDCUpdate( HDC hdc )
150 DC *dc = DC_GetDCPtr( hdc );
151 if (!dc) return NULL;
152 while (dc->flags & DC_DIRTY)
154 dc->flags &= ~DC_DIRTY;
155 if (!(dc->flags & (DC_SAVED | DC_MEMORY)))
157 DCHOOKPROC proc = dc->hookThunk;
158 if (proc)
160 DWORD data = dc->dwHookData;
161 GDI_ReleaseObj( hdc );
162 proc( HDC_16(hdc), DCHC_INVALIDVISRGN, data, 0 );
163 if (!(dc = DC_GetDCPtr( hdc ))) break;
164 /* otherwise restart the loop in case it became dirty again in the meantime */
168 return dc;
172 /***********************************************************************
173 * DC_DeleteObject
175 static BOOL DC_DeleteObject( HGDIOBJ handle, void *obj )
177 GDI_ReleaseObj( handle );
178 return DeleteDC( handle );
182 /***********************************************************************
183 * DC_InitDC
185 * Setup device-specific DC values for a newly created DC.
187 void DC_InitDC( DC* dc )
189 if (dc->funcs->pRealizeDefaultPalette) dc->funcs->pRealizeDefaultPalette( dc->physDev );
190 SetTextColor( dc->hSelf, dc->textColor );
191 SetBkColor( dc->hSelf, dc->backgroundColor );
192 SelectObject( dc->hSelf, dc->hPen );
193 SelectObject( dc->hSelf, dc->hBrush );
194 SelectObject( dc->hSelf, dc->hFont );
195 CLIPPING_UpdateGCRegion( dc );
199 /***********************************************************************
200 * DC_InvertXform
202 * Computes the inverse of the transformation xformSrc and stores it to
203 * xformDest. Returns TRUE if successful or FALSE if the xformSrc matrix
204 * is singular.
206 static BOOL DC_InvertXform( const XFORM *xformSrc, XFORM *xformDest )
208 FLOAT determinant;
210 determinant = xformSrc->eM11*xformSrc->eM22 -
211 xformSrc->eM12*xformSrc->eM21;
212 if (determinant > -1e-12 && determinant < 1e-12)
213 return FALSE;
215 xformDest->eM11 = xformSrc->eM22 / determinant;
216 xformDest->eM12 = -xformSrc->eM12 / determinant;
217 xformDest->eM21 = -xformSrc->eM21 / determinant;
218 xformDest->eM22 = xformSrc->eM11 / determinant;
219 xformDest->eDx = -xformSrc->eDx * xformDest->eM11 -
220 xformSrc->eDy * xformDest->eM21;
221 xformDest->eDy = -xformSrc->eDx * xformDest->eM12 -
222 xformSrc->eDy * xformDest->eM22;
224 return TRUE;
228 /***********************************************************************
229 * DC_UpdateXforms
231 * Updates the xformWorld2Vport, xformVport2World and vport2WorldValid
232 * fields of the specified DC by creating a transformation that
233 * represents the current mapping mode and combining it with the DC's
234 * world transform. This function should be called whenever the
235 * parameters associated with the mapping mode (window and viewport
236 * extents and origins) or the world transform change.
238 void DC_UpdateXforms( DC *dc )
240 XFORM xformWnd2Vport;
241 FLOAT scaleX, scaleY;
243 /* Construct a transformation to do the window-to-viewport conversion */
244 scaleX = (FLOAT)dc->vportExtX / (FLOAT)dc->wndExtX;
245 scaleY = (FLOAT)dc->vportExtY / (FLOAT)dc->wndExtY;
246 xformWnd2Vport.eM11 = scaleX;
247 xformWnd2Vport.eM12 = 0.0;
248 xformWnd2Vport.eM21 = 0.0;
249 xformWnd2Vport.eM22 = scaleY;
250 xformWnd2Vport.eDx = (FLOAT)dc->vportOrgX -
251 scaleX * (FLOAT)dc->wndOrgX;
252 xformWnd2Vport.eDy = (FLOAT)dc->vportOrgY -
253 scaleY * (FLOAT)dc->wndOrgY;
255 /* Combine with the world transformation */
256 CombineTransform( &dc->xformWorld2Vport, &dc->xformWorld2Wnd,
257 &xformWnd2Vport );
259 /* Create inverse of world-to-viewport transformation */
260 dc->vport2WorldValid = DC_InvertXform( &dc->xformWorld2Vport,
261 &dc->xformVport2World );
265 /***********************************************************************
266 * GetDCState (Not a Windows API)
268 HDC WINAPI GetDCState( HDC hdc )
270 DC * newdc, * dc;
271 HGDIOBJ handle;
273 if (!(dc = DC_GetDCPtr( hdc ))) return 0;
274 if (!(newdc = GDI_AllocObject( sizeof(DC), DC_MAGIC, &handle, &dc_funcs )))
276 GDI_ReleaseObj( hdc );
277 return 0;
279 TRACE("(%p): returning %p\n", hdc, handle );
281 newdc->flags = dc->flags | DC_SAVED;
282 newdc->hPen = dc->hPen;
283 newdc->hBrush = dc->hBrush;
284 newdc->hFont = dc->hFont;
285 newdc->hBitmap = dc->hBitmap;
286 newdc->hDevice = dc->hDevice;
287 newdc->hPalette = dc->hPalette;
288 newdc->totalExtent = dc->totalExtent;
289 newdc->bitsPerPixel = dc->bitsPerPixel;
290 newdc->ROPmode = dc->ROPmode;
291 newdc->polyFillMode = dc->polyFillMode;
292 newdc->stretchBltMode = dc->stretchBltMode;
293 newdc->relAbsMode = dc->relAbsMode;
294 newdc->backgroundMode = dc->backgroundMode;
295 newdc->backgroundColor = dc->backgroundColor;
296 newdc->textColor = dc->textColor;
297 newdc->brushOrgX = dc->brushOrgX;
298 newdc->brushOrgY = dc->brushOrgY;
299 newdc->textAlign = dc->textAlign;
300 newdc->charExtra = dc->charExtra;
301 newdc->breakTotalExtra = dc->breakTotalExtra;
302 newdc->breakCount = dc->breakCount;
303 newdc->breakExtra = dc->breakExtra;
304 newdc->breakRem = dc->breakRem;
305 newdc->MapMode = dc->MapMode;
306 newdc->GraphicsMode = dc->GraphicsMode;
307 newdc->CursPosX = dc->CursPosX;
308 newdc->CursPosY = dc->CursPosY;
309 newdc->ArcDirection = dc->ArcDirection;
310 newdc->xformWorld2Wnd = dc->xformWorld2Wnd;
311 newdc->xformWorld2Vport = dc->xformWorld2Vport;
312 newdc->xformVport2World = dc->xformVport2World;
313 newdc->vport2WorldValid = dc->vport2WorldValid;
314 newdc->wndOrgX = dc->wndOrgX;
315 newdc->wndOrgY = dc->wndOrgY;
316 newdc->wndExtX = dc->wndExtX;
317 newdc->wndExtY = dc->wndExtY;
318 newdc->vportOrgX = dc->vportOrgX;
319 newdc->vportOrgY = dc->vportOrgY;
320 newdc->vportExtX = dc->vportExtX;
321 newdc->vportExtY = dc->vportExtY;
323 newdc->hSelf = (HDC)handle;
324 newdc->saveLevel = 0;
326 PATH_InitGdiPath( &newdc->path );
328 newdc->pAbortProc = NULL;
329 newdc->hookThunk = NULL;
330 newdc->hookProc = 0;
332 /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */
334 newdc->hGCClipRgn = newdc->hVisRgn = 0;
335 if (dc->hClipRgn)
337 newdc->hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
338 CombineRgn( newdc->hClipRgn, dc->hClipRgn, 0, RGN_COPY );
340 else
341 newdc->hClipRgn = 0;
343 if(dc->gdiFont) {
344 newdc->gdiFont = dc->gdiFont;
345 } else
346 newdc->gdiFont = 0;
348 GDI_ReleaseObj( handle );
349 GDI_ReleaseObj( hdc );
350 return handle;
354 /***********************************************************************
355 * SetDCState (Not a Windows API)
357 void WINAPI SetDCState( HDC hdc, HDC hdcs )
359 DC *dc, *dcs;
361 if (!(dc = DC_GetDCUpdate( hdc ))) return;
362 if (!(dcs = DC_GetDCPtr( hdcs )))
364 GDI_ReleaseObj( hdc );
365 return;
367 if (!dcs->flags & DC_SAVED)
369 GDI_ReleaseObj( hdc );
370 GDI_ReleaseObj( hdcs );
371 return;
373 TRACE("%p %p\n", hdc, hdcs );
375 dc->flags = dcs->flags & ~(DC_SAVED | DC_DIRTY);
376 dc->hDevice = dcs->hDevice;
377 dc->totalExtent = dcs->totalExtent;
378 dc->ROPmode = dcs->ROPmode;
379 dc->polyFillMode = dcs->polyFillMode;
380 dc->stretchBltMode = dcs->stretchBltMode;
381 dc->relAbsMode = dcs->relAbsMode;
382 dc->backgroundMode = dcs->backgroundMode;
383 dc->backgroundColor = dcs->backgroundColor;
384 dc->textColor = dcs->textColor;
385 dc->brushOrgX = dcs->brushOrgX;
386 dc->brushOrgY = dcs->brushOrgY;
387 dc->textAlign = dcs->textAlign;
388 dc->charExtra = dcs->charExtra;
389 dc->breakTotalExtra = dcs->breakTotalExtra;
390 dc->breakCount = dcs->breakCount;
391 dc->breakExtra = dcs->breakExtra;
392 dc->breakRem = dcs->breakRem;
393 dc->MapMode = dcs->MapMode;
394 dc->GraphicsMode = dcs->GraphicsMode;
395 dc->CursPosX = dcs->CursPosX;
396 dc->CursPosY = dcs->CursPosY;
397 dc->ArcDirection = dcs->ArcDirection;
398 dc->xformWorld2Wnd = dcs->xformWorld2Wnd;
399 dc->xformWorld2Vport = dcs->xformWorld2Vport;
400 dc->xformVport2World = dcs->xformVport2World;
401 dc->vport2WorldValid = dcs->vport2WorldValid;
403 dc->wndOrgX = dcs->wndOrgX;
404 dc->wndOrgY = dcs->wndOrgY;
405 dc->wndExtX = dcs->wndExtX;
406 dc->wndExtY = dcs->wndExtY;
407 dc->vportOrgX = dcs->vportOrgX;
408 dc->vportOrgY = dcs->vportOrgY;
409 dc->vportExtX = dcs->vportExtX;
410 dc->vportExtY = dcs->vportExtY;
412 if (!(dc->flags & DC_MEMORY)) dc->bitsPerPixel = dcs->bitsPerPixel;
414 if (dcs->hClipRgn)
416 if (!dc->hClipRgn) dc->hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
417 CombineRgn( dc->hClipRgn, dcs->hClipRgn, 0, RGN_COPY );
419 else
421 if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
422 dc->hClipRgn = 0;
424 CLIPPING_UpdateGCRegion( dc );
426 SelectObject( hdc, dcs->hBitmap );
427 SelectObject( hdc, dcs->hBrush );
428 SelectObject( hdc, dcs->hFont );
429 SelectObject( hdc, dcs->hPen );
430 SetBkColor( hdc, dcs->backgroundColor);
431 SetTextColor( hdc, dcs->textColor);
432 GDISelectPalette( hdc, dcs->hPalette, FALSE );
433 GDI_ReleaseObj( hdcs );
434 GDI_ReleaseObj( hdc );
438 /***********************************************************************
439 * GetDCState (GDI.179)
441 HDC16 WINAPI GetDCState16( HDC16 hdc )
443 return HDC_16( GetDCState( HDC_32(hdc) ));
447 /***********************************************************************
448 * SetDCState (GDI.180)
450 void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
452 SetDCState( HDC_32(hdc), HDC_32(hdcs) );
456 /***********************************************************************
457 * SaveDC (GDI32.@)
459 INT WINAPI SaveDC( HDC hdc )
461 HDC hdcs;
462 DC * dc, * dcs;
463 INT ret;
465 dc = DC_GetDCPtr( hdc );
466 if (!dc) return 0;
468 if(dc->funcs->pSaveDC)
470 ret = dc->funcs->pSaveDC( dc->physDev );
471 GDI_ReleaseObj( hdc );
472 return ret;
475 if (!(hdcs = GetDCState( hdc )))
477 GDI_ReleaseObj( hdc );
478 return 0;
480 dcs = DC_GetDCPtr( hdcs );
482 /* Copy path. The reason why path saving / restoring is in SaveDC/
483 * RestoreDC and not in GetDCState/SetDCState is that the ...DCState
484 * functions are only in Win16 (which doesn't have paths) and that
485 * SetDCState doesn't allow us to signal an error (which can happen
486 * when copying paths).
488 if (!PATH_AssignGdiPath( &dcs->path, &dc->path ))
490 GDI_ReleaseObj( hdc );
491 GDI_ReleaseObj( hdcs );
492 DeleteDC( hdcs );
493 return 0;
496 dcs->header.hNext = dc->header.hNext;
497 dc->header.hNext = HDC_16(hdcs);
498 TRACE("(%p): returning %d\n", hdc, dc->saveLevel+1 );
499 ret = ++dc->saveLevel;
500 GDI_ReleaseObj( hdcs );
501 GDI_ReleaseObj( hdc );
502 return ret;
506 /***********************************************************************
507 * RestoreDC (GDI32.@)
509 BOOL WINAPI RestoreDC( HDC hdc, INT level )
511 DC * dc, * dcs;
512 BOOL success;
514 TRACE("%p %d\n", hdc, level );
515 dc = DC_GetDCUpdate( hdc );
516 if(!dc) return FALSE;
517 if(dc->funcs->pRestoreDC)
519 success = dc->funcs->pRestoreDC( dc->physDev, level );
520 GDI_ReleaseObj( hdc );
521 return success;
524 if (level == -1) level = dc->saveLevel;
525 if ((level < 1)
526 /* This pair of checks disagrees with MSDN "Platform SDK:
527 Windows GDI" July 2000 which says all negative values
528 for level will be interpreted as an instance relative
529 to the current state. Restricting it to just -1 does
530 not satisfy this */
531 || (level > dc->saveLevel))
533 GDI_ReleaseObj( hdc );
534 return FALSE;
537 success=TRUE;
538 while (dc->saveLevel >= level)
540 HDC hdcs = HDC_32(dc->header.hNext);
541 if (!(dcs = DC_GetDCPtr( hdcs )))
543 GDI_ReleaseObj( hdc );
544 return FALSE;
546 dc->header.hNext = dcs->header.hNext;
547 if (--dc->saveLevel < level)
549 SetDCState( hdc, hdcs );
550 if (!PATH_AssignGdiPath( &dc->path, &dcs->path ))
551 /* FIXME: This might not be quite right, since we're
552 * returning FALSE but still destroying the saved DC state */
553 success=FALSE;
555 GDI_ReleaseObj( hdcs );
556 GDI_ReleaseObj( hdc );
557 DeleteDC( hdcs );
558 if (!(dc = DC_GetDCPtr( hdc ))) return FALSE;
560 GDI_ReleaseObj( hdc );
561 return success;
565 /***********************************************************************
566 * CreateDCA (GDI32.@)
568 HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
569 const DEVMODEA *initData )
571 HDC hdc;
572 DC * dc;
573 const DC_FUNCTIONS *funcs;
574 char buf[300];
576 GDI_CheckNotLock();
578 if (!device || !DRIVER_GetDriverName( device, buf, sizeof(buf) ))
580 if (!driver) return 0;
581 strcpy(buf, driver);
584 if (!(funcs = DRIVER_load_driver( buf )))
586 ERR( "no driver found for %s\n", buf );
587 return 0;
589 if (!(dc = DC_AllocDC( funcs )))
591 DRIVER_release_driver( funcs );
592 return 0;
595 dc->flags = 0;
596 dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
598 TRACE("(driver=%s, device=%s, output=%s): returning %p\n",
599 debugstr_a(driver), debugstr_a(device), debugstr_a(output), dc->hSelf );
601 if (dc->funcs->pCreateDC &&
602 !dc->funcs->pCreateDC( dc, &dc->physDev, buf, device, output, initData ))
604 WARN("creation aborted by device\n" );
605 GDI_FreeObject( dc->hSelf, dc );
606 DRIVER_release_driver( funcs );
607 return 0;
610 dc->totalExtent.left = 0;
611 dc->totalExtent.top = 0;
612 dc->totalExtent.right = GetDeviceCaps( dc->hSelf, HORZRES );
613 dc->totalExtent.bottom = GetDeviceCaps( dc->hSelf, VERTRES );
614 dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent );
616 DC_InitDC( dc );
617 hdc = dc->hSelf;
618 GDI_ReleaseObj( hdc );
619 return hdc;
623 /***********************************************************************
624 * CreateDCW (GDI32.@)
626 HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
627 const DEVMODEW *initData )
629 LPSTR driverA = HEAP_strdupWtoA( GetProcessHeap(), 0, driver );
630 LPSTR deviceA = HEAP_strdupWtoA( GetProcessHeap(), 0, device );
631 LPSTR outputA = HEAP_strdupWtoA( GetProcessHeap(), 0, output );
632 HDC res = CreateDCA( driverA, deviceA, outputA,
633 (const DEVMODEA *)initData /*FIXME*/ );
634 HeapFree( GetProcessHeap(), 0, driverA );
635 HeapFree( GetProcessHeap(), 0, deviceA );
636 HeapFree( GetProcessHeap(), 0, outputA );
637 return res;
641 /***********************************************************************
642 * CreateICA (GDI32.@)
644 HDC WINAPI CreateICA( LPCSTR driver, LPCSTR device, LPCSTR output,
645 const DEVMODEA* initData )
647 /* Nothing special yet for ICs */
648 return CreateDCA( driver, device, output, initData );
652 /***********************************************************************
653 * CreateICW (GDI32.@)
655 HDC WINAPI CreateICW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
656 const DEVMODEW* initData )
658 /* Nothing special yet for ICs */
659 return CreateDCW( driver, device, output, initData );
663 /***********************************************************************
664 * CreateCompatibleDC (GDI32.@)
666 HDC WINAPI CreateCompatibleDC( HDC hdc )
668 DC *dc, *origDC;
669 const DC_FUNCTIONS *funcs;
671 GDI_CheckNotLock();
673 if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC )))
675 funcs = origDC->funcs;
676 GDI_ReleaseObj( hdc ); /* can't hold the lock while loading the driver */
677 funcs = DRIVER_get_driver( funcs );
679 else funcs = DRIVER_load_driver( "DISPLAY" );
681 if (!funcs) return 0;
683 if (!(dc = DC_AllocDC( funcs )))
685 DRIVER_release_driver( funcs );
686 return 0;
689 TRACE("(%p): returning %p\n", hdc, dc->hSelf );
691 dc->flags = DC_MEMORY;
692 dc->bitsPerPixel = 1;
693 dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
695 /* Copy the driver-specific physical device info into
696 * the new DC. The driver may use this read-only info
697 * while creating the compatible DC below. */
698 if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC ))) dc->physDev = origDC->physDev;
700 if (dc->funcs->pCreateDC &&
701 !dc->funcs->pCreateDC( dc, &dc->physDev, NULL, NULL, NULL, NULL ))
703 WARN("creation aborted by device\n");
704 GDI_FreeObject( dc->hSelf, dc );
705 if (origDC) GDI_ReleaseObj( hdc );
706 DRIVER_release_driver( funcs );
707 return 0;
710 dc->totalExtent.left = 0;
711 dc->totalExtent.top = 0;
712 dc->totalExtent.right = 1; /* default bitmap is 1x1 */
713 dc->totalExtent.bottom = 1;
714 dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent );
716 DC_InitDC( dc );
717 GDI_ReleaseObj( dc->hSelf );
718 if (origDC) GDI_ReleaseObj( hdc );
719 return dc->hSelf;
723 /***********************************************************************
724 * DeleteDC (GDI32.@)
726 BOOL WINAPI DeleteDC( HDC hdc )
728 const DC_FUNCTIONS *funcs = NULL;
729 DC * dc;
731 TRACE("%p\n", hdc );
733 GDI_CheckNotLock();
735 if (!(dc = GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
737 /* Call hook procedure to check whether is it OK to delete this DC */
738 if (dc->hookThunk && !(dc->flags & (DC_SAVED | DC_MEMORY)))
740 DCHOOKPROC proc = dc->hookThunk;
741 if (proc)
743 DWORD data = dc->dwHookData;
744 GDI_ReleaseObj( hdc );
745 if (!proc( HDC_16(hdc), DCHC_DELETEDC, data, 0 )) return FALSE;
746 if (!(dc = DC_GetDCPtr( hdc ))) return TRUE; /* deleted by the hook */
750 while (dc->saveLevel)
752 DC * dcs;
753 HDC hdcs = HDC_32(dc->header.hNext);
754 if (!(dcs = DC_GetDCPtr( hdcs ))) break;
755 dc->header.hNext = dcs->header.hNext;
756 dc->saveLevel--;
757 if (dcs->hClipRgn) DeleteObject( dcs->hClipRgn );
758 if (dcs->hVisRgn) DeleteObject( dcs->hVisRgn );
759 if (dcs->hGCClipRgn) DeleteObject( dcs->hGCClipRgn );
760 PATH_DestroyGdiPath(&dcs->path);
761 GDI_FreeObject( hdcs, dcs );
764 if (!(dc->flags & DC_SAVED))
766 SelectObject( hdc, GetStockObject(BLACK_PEN) );
767 SelectObject( hdc, GetStockObject(WHITE_BRUSH) );
768 SelectObject( hdc, GetStockObject(SYSTEM_FONT) );
769 SelectObject( hdc, GetStockObject(DEFAULT_BITMAP) );
770 funcs = dc->funcs;
771 if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc->physDev);
772 dc->physDev = NULL;
775 if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
776 if (dc->hVisRgn) DeleteObject( dc->hVisRgn );
777 if (dc->hGCClipRgn) DeleteObject( dc->hGCClipRgn );
778 PATH_DestroyGdiPath(&dc->path);
780 GDI_FreeObject( hdc, dc );
781 if (funcs) DRIVER_release_driver( funcs ); /* do that after releasing the GDI lock */
782 return TRUE;
786 /***********************************************************************
787 * ResetDCA (GDI32.@)
789 HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode )
791 DC *dc;
792 HDC ret = hdc;
794 if ((dc = DC_GetDCPtr( hdc )))
796 if (dc->funcs->pResetDC) ret = dc->funcs->pResetDC( dc->physDev, devmode );
797 GDI_ReleaseObj( hdc );
799 return ret;
803 /***********************************************************************
804 * ResetDCW (GDI32.@)
806 HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode )
808 return ResetDCA(hdc, (const DEVMODEA*)devmode); /* FIXME */
812 /***********************************************************************
813 * GetDeviceCaps (GDI32.@)
815 INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
817 DC *dc;
818 INT ret = 0;
820 if ((dc = DC_GetDCPtr( hdc )))
822 if (dc->funcs->pGetDeviceCaps) ret = dc->funcs->pGetDeviceCaps( dc->physDev, cap );
823 GDI_ReleaseObj( hdc );
825 return ret;
829 /***********************************************************************
830 * SetBkColor (GDI32.@)
832 COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color )
834 COLORREF oldColor;
835 DC * dc = DC_GetDCPtr( hdc );
837 if (!dc) return CLR_INVALID;
838 oldColor = dc->backgroundColor;
839 if (dc->funcs->pSetBkColor)
841 color = dc->funcs->pSetBkColor(dc->physDev, color);
842 if (color == CLR_INVALID) /* don't change it */
844 color = oldColor;
845 oldColor = CLR_INVALID;
848 dc->backgroundColor = color;
849 GDI_ReleaseObj( hdc );
850 return oldColor;
854 /***********************************************************************
855 * SetTextColor (GDI32.@)
857 COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
859 COLORREF oldColor;
860 DC * dc = DC_GetDCPtr( hdc );
862 if (!dc) return CLR_INVALID;
863 oldColor = dc->textColor;
864 if (dc->funcs->pSetTextColor)
866 color = dc->funcs->pSetTextColor(dc->physDev, color);
867 if (color == CLR_INVALID) /* don't change it */
869 color = oldColor;
870 oldColor = CLR_INVALID;
873 dc->textColor = color;
874 GDI_ReleaseObj( hdc );
875 return oldColor;
879 /***********************************************************************
880 * SetTextAlign (GDI32.@)
882 UINT WINAPI SetTextAlign( HDC hdc, UINT align )
884 UINT prevAlign;
885 DC *dc = DC_GetDCPtr( hdc );
886 if (!dc) return 0x0;
887 if (dc->funcs->pSetTextAlign)
888 prevAlign = dc->funcs->pSetTextAlign(dc->physDev, align);
889 else {
890 prevAlign = dc->textAlign;
891 dc->textAlign = align;
893 GDI_ReleaseObj( hdc );
894 return prevAlign;
897 /***********************************************************************
898 * GetDCOrgEx (GDI32.@)
900 BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp )
902 DC * dc;
904 if (!lpp) return FALSE;
905 if (!(dc = DC_GetDCPtr( hDC ))) return FALSE;
907 lpp->x = lpp->y = 0;
908 if (dc->funcs->pGetDCOrgEx) dc->funcs->pGetDCOrgEx( dc->physDev, lpp );
909 GDI_ReleaseObj( hDC );
910 return TRUE;
914 /***********************************************************************
915 * SetDCOrg (GDI.117)
917 DWORD WINAPI SetDCOrg16( HDC16 hdc16, INT16 x, INT16 y )
919 DWORD prevOrg = 0;
920 HDC hdc = HDC_32( hdc16 );
921 DC *dc = DC_GetDCPtr( hdc );
922 if (!dc) return 0;
923 if (dc->funcs->pSetDCOrg) prevOrg = dc->funcs->pSetDCOrg( dc->physDev, x, y );
924 GDI_ReleaseObj( hdc );
925 return prevOrg;
929 /***********************************************************************
930 * SetGraphicsMode (GDI32.@)
932 INT WINAPI SetGraphicsMode( HDC hdc, INT mode )
934 INT ret = 0;
935 DC *dc = DC_GetDCPtr( hdc );
937 /* One would think that setting the graphics mode to GM_COMPATIBLE
938 * would also reset the world transformation matrix to the unity
939 * matrix. However, in Windows, this is not the case. This doesn't
940 * make a lot of sense to me, but that's the way it is.
942 if (!dc) return 0;
943 if ((mode > 0) && (mode <= GM_LAST))
945 ret = dc->GraphicsMode;
946 dc->GraphicsMode = mode;
948 GDI_ReleaseObj( hdc );
949 return ret;
953 /***********************************************************************
954 * SetArcDirection (GDI32.@)
956 INT WINAPI SetArcDirection( HDC hdc, INT nDirection )
958 DC * dc;
959 INT nOldDirection = 0;
961 if (nDirection!=AD_COUNTERCLOCKWISE && nDirection!=AD_CLOCKWISE)
963 SetLastError(ERROR_INVALID_PARAMETER);
964 return 0;
967 if ((dc = DC_GetDCPtr( hdc )))
969 nOldDirection = dc->ArcDirection;
970 dc->ArcDirection = nDirection;
971 GDI_ReleaseObj( hdc );
973 return nOldDirection;
977 /***********************************************************************
978 * GetWorldTransform (GDI32.@)
980 BOOL WINAPI GetWorldTransform( HDC hdc, LPXFORM xform )
982 DC * dc;
983 if (!xform) return FALSE;
984 if (!(dc = DC_GetDCPtr( hdc ))) return FALSE;
985 *xform = dc->xformWorld2Wnd;
986 GDI_ReleaseObj( hdc );
987 return TRUE;
991 /***********************************************************************
992 * GetTransform (GDI32.@)
994 BOOL WINAPI GetTransform( HDC hdc, DWORD unknown, LPXFORM xform )
996 if (unknown == 0x0203) return GetWorldTransform( hdc, xform );
997 ERR("stub: don't know what to do for code %lx\n", unknown );
998 return FALSE;
1002 /***********************************************************************
1003 * SetWorldTransform (GDI32.@)
1005 BOOL WINAPI SetWorldTransform( HDC hdc, const XFORM *xform )
1007 BOOL ret = FALSE;
1008 DC *dc = DC_GetDCPtr( hdc );
1010 if (!dc) return FALSE;
1011 if (!xform) goto done;
1013 /* Check that graphics mode is GM_ADVANCED */
1014 if (dc->GraphicsMode!=GM_ADVANCED) goto done;
1016 dc->xformWorld2Wnd = *xform;
1017 DC_UpdateXforms( dc );
1018 ret = TRUE;
1019 done:
1020 GDI_ReleaseObj( hdc );
1021 return ret;
1025 /****************************************************************************
1026 * ModifyWorldTransform [GDI32.@]
1027 * Modifies the world transformation for a device context.
1029 * PARAMS
1030 * hdc [I] Handle to device context
1031 * xform [I] XFORM structure that will be used to modify the world
1032 * transformation
1033 * iMode [I] Specifies in what way to modify the world transformation
1034 * Possible values:
1035 * MWT_IDENTITY
1036 * Resets the world transformation to the identity matrix.
1037 * The parameter xform is ignored.
1038 * MWT_LEFTMULTIPLY
1039 * Multiplies xform into the world transformation matrix from
1040 * the left.
1041 * MWT_RIGHTMULTIPLY
1042 * Multiplies xform into the world transformation matrix from
1043 * the right.
1045 * RETURNS STD
1047 BOOL WINAPI ModifyWorldTransform( HDC hdc, const XFORM *xform,
1048 DWORD iMode )
1050 BOOL ret = FALSE;
1051 DC *dc = DC_GetDCPtr( hdc );
1053 /* Check for illegal parameters */
1054 if (!dc) return FALSE;
1055 if (!xform) goto done;
1057 /* Check that graphics mode is GM_ADVANCED */
1058 if (dc->GraphicsMode!=GM_ADVANCED) goto done;
1060 switch (iMode)
1062 case MWT_IDENTITY:
1063 dc->xformWorld2Wnd.eM11 = 1.0f;
1064 dc->xformWorld2Wnd.eM12 = 0.0f;
1065 dc->xformWorld2Wnd.eM21 = 0.0f;
1066 dc->xformWorld2Wnd.eM22 = 1.0f;
1067 dc->xformWorld2Wnd.eDx = 0.0f;
1068 dc->xformWorld2Wnd.eDy = 0.0f;
1069 break;
1070 case MWT_LEFTMULTIPLY:
1071 CombineTransform( &dc->xformWorld2Wnd, xform,
1072 &dc->xformWorld2Wnd );
1073 break;
1074 case MWT_RIGHTMULTIPLY:
1075 CombineTransform( &dc->xformWorld2Wnd, &dc->xformWorld2Wnd,
1076 xform );
1077 break;
1078 default:
1079 goto done;
1082 DC_UpdateXforms( dc );
1083 ret = TRUE;
1084 done:
1085 GDI_ReleaseObj( hdc );
1086 return ret;
1090 /****************************************************************************
1091 * CombineTransform [GDI32.@]
1092 * Combines two transformation matrices.
1094 * PARAMS
1095 * xformResult [O] Stores the result of combining the two matrices
1096 * xform1 [I] Specifies the first matrix to apply
1097 * xform2 [I] Specifies the second matrix to apply
1099 * REMARKS
1100 * The same matrix can be passed in for more than one of the parameters.
1102 * RETURNS STD
1104 BOOL WINAPI CombineTransform( LPXFORM xformResult, const XFORM *xform1,
1105 const XFORM *xform2 )
1107 XFORM xformTemp;
1109 /* Check for illegal parameters */
1110 if (!xformResult || !xform1 || !xform2)
1111 return FALSE;
1113 /* Create the result in a temporary XFORM, since xformResult may be
1114 * equal to xform1 or xform2 */
1115 xformTemp.eM11 = xform1->eM11 * xform2->eM11 +
1116 xform1->eM12 * xform2->eM21;
1117 xformTemp.eM12 = xform1->eM11 * xform2->eM12 +
1118 xform1->eM12 * xform2->eM22;
1119 xformTemp.eM21 = xform1->eM21 * xform2->eM11 +
1120 xform1->eM22 * xform2->eM21;
1121 xformTemp.eM22 = xform1->eM21 * xform2->eM12 +
1122 xform1->eM22 * xform2->eM22;
1123 xformTemp.eDx = xform1->eDx * xform2->eM11 +
1124 xform1->eDy * xform2->eM21 +
1125 xform2->eDx;
1126 xformTemp.eDy = xform1->eDx * xform2->eM12 +
1127 xform1->eDy * xform2->eM22 +
1128 xform2->eDy;
1130 /* Copy the result to xformResult */
1131 *xformResult = xformTemp;
1133 return TRUE;
1137 /***********************************************************************
1138 * SetDCHook (GDI32.@)
1140 * Note: this doesn't exist in Win32, we add it here because user32 needs it.
1142 BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD dwHookData )
1144 DC *dc = DC_GetDCPtr( hdc );
1146 if (!dc) return FALSE;
1147 dc->dwHookData = dwHookData;
1148 dc->hookThunk = hookProc;
1149 GDI_ReleaseObj( hdc );
1150 return TRUE;
1154 /* relay function to call the 16-bit DC hook proc */
1155 static BOOL16 WINAPI call_dc_hook16( HDC16 hdc16, WORD code, DWORD data, LPARAM lParam )
1157 WORD args[6];
1158 DWORD ret;
1159 FARPROC16 proc = NULL;
1160 HDC hdc = HDC_32( hdc16 );
1161 DC *dc = DC_GetDCPtr( hdc );
1163 if (!dc) return FALSE;
1164 proc = dc->hookProc;
1165 GDI_ReleaseObj( hdc );
1166 if (!proc) return FALSE;
1167 args[5] = hdc16;
1168 args[4] = code;
1169 args[3] = HIWORD(data);
1170 args[2] = LOWORD(data);
1171 args[1] = HIWORD(lParam);
1172 args[0] = LOWORD(lParam);
1173 WOWCallback16Ex( (DWORD)proc, WCB16_PASCAL, sizeof(args), args, &ret );
1174 return LOWORD(ret);
1177 /***********************************************************************
1178 * SetDCHook (GDI.190)
1180 BOOL16 WINAPI SetDCHook16( HDC16 hdc16, FARPROC16 hookProc, DWORD dwHookData )
1182 HDC hdc = HDC_32( hdc16 );
1183 DC *dc = DC_GetDCPtr( hdc );
1184 if (!dc) return FALSE;
1186 dc->hookProc = hookProc;
1187 GDI_ReleaseObj( hdc );
1188 return SetDCHook( hdc, call_dc_hook16, dwHookData );
1192 /***********************************************************************
1193 * GetDCHook (GDI.191)
1195 DWORD WINAPI GetDCHook16( HDC16 hdc16, FARPROC16 *phookProc )
1197 HDC hdc = HDC_32( hdc16 );
1198 DC *dc = DC_GetDCPtr( hdc );
1199 DWORD ret;
1201 if (!dc) return 0;
1202 *phookProc = dc->hookProc;
1203 ret = dc->dwHookData;
1204 GDI_ReleaseObj( hdc );
1205 return ret;
1209 /***********************************************************************
1210 * SetHookFlags (GDI.192)
1212 WORD WINAPI SetHookFlags16(HDC16 hdc16, WORD flags)
1214 HDC hdc = HDC_32( hdc16 );
1215 DC *dc = DC_GetDCPtr( hdc );
1217 if( dc )
1219 WORD wRet = dc->flags & DC_DIRTY;
1221 /* "Undocumented Windows" info is slightly confusing.
1224 TRACE("hDC %p, flags %04x\n",hdc,flags);
1226 if( flags & DCHF_INVALIDATEVISRGN )
1227 dc->flags |= DC_DIRTY;
1228 else if( flags & DCHF_VALIDATEVISRGN || !flags )
1229 dc->flags &= ~DC_DIRTY;
1230 GDI_ReleaseObj( hdc );
1231 return wRet;
1233 return 0;
1236 /***********************************************************************
1237 * SetICMMode (GDI32.@)
1239 INT WINAPI SetICMMode(HDC hdc, INT iEnableICM)
1241 /*FIXME Asuming that ICM is always off, and cannot be turned on */
1242 if (iEnableICM == ICM_OFF) return ICM_OFF;
1243 if (iEnableICM == ICM_ON) return 0;
1244 if (iEnableICM == ICM_QUERY) return ICM_OFF;
1245 return 0;
1248 /***********************************************************************
1249 * GetDeviceGammaRamp (GDI32.@)
1251 BOOL WINAPI GetDeviceGammaRamp(HDC hDC, LPVOID ptr)
1253 BOOL ret = FALSE;
1254 DC *dc = DC_GetDCPtr( hDC );
1256 if( dc )
1258 if (dc->funcs->pGetDeviceGammaRamp)
1259 ret = dc->funcs->pGetDeviceGammaRamp(dc->physDev, ptr);
1260 GDI_ReleaseObj( hDC );
1262 return ret;
1265 /***********************************************************************
1266 * SetDeviceGammaRamp (GDI32.@)
1268 BOOL WINAPI SetDeviceGammaRamp(HDC hDC, LPVOID ptr)
1270 BOOL ret = FALSE;
1271 DC *dc = DC_GetDCPtr( hDC );
1273 if( dc )
1275 if (dc->funcs->pSetDeviceGammaRamp)
1276 ret = dc->funcs->pSetDeviceGammaRamp(dc->physDev, ptr);
1277 GDI_ReleaseObj( hDC );
1279 return ret;
1282 /***********************************************************************
1283 * GetColorSpace (GDI32.@)
1285 HCOLORSPACE WINAPI GetColorSpace(HDC hdc)
1287 /*FIXME Need to to whatever GetColorSpace actually does */
1288 return 0;
1291 /***********************************************************************
1292 * CreateColorSpaceA (GDI32.@)
1294 HCOLORSPACE WINAPI CreateColorSpaceA( LPLOGCOLORSPACEA lpLogColorSpace )
1296 FIXME( "stub\n" );
1297 return 0;
1300 /***********************************************************************
1301 * CreateColorSpaceW (GDI32.@)
1303 HCOLORSPACE WINAPI CreateColorSpaceW( LPLOGCOLORSPACEW lpLogColorSpace )
1305 FIXME( "stub\n" );
1306 return 0;
1309 /***********************************************************************
1310 * DeleteColorSpace (GDI32.@)
1312 BOOL WINAPI DeleteColorSpace( HCOLORSPACE hColorSpace )
1314 FIXME( "stub\n" );
1316 return TRUE;
1319 /***********************************************************************
1320 * SetColorSpace (GDI32.@)
1322 HCOLORSPACE WINAPI SetColorSpace( HDC hDC, HCOLORSPACE hColorSpace )
1324 FIXME( "stub\n" );
1326 return hColorSpace;
1329 /***********************************************************************
1330 * GetBoundsRect (GDI.194)
1332 UINT16 WINAPI GetBoundsRect16(HDC16 hdc, LPRECT16 rect, UINT16 flags)
1334 return DCB_RESET | DCB_DISABLE; /* bounding rectangle always empty and disabled*/
1337 /***********************************************************************
1338 * GetBoundsRect (GDI32.@)
1340 UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
1342 FIXME("(): stub\n");
1343 return DCB_RESET; /* bounding rectangle always empty */
1346 /***********************************************************************
1347 * SetBoundsRect (GDI.193)
1349 UINT16 WINAPI SetBoundsRect16(HDC16 hdc, const RECT16* rect, UINT16 flags)
1351 if ( (flags & DCB_ACCUMULATE) || (flags & DCB_ENABLE) )
1352 FIXME("(%04x, %p, %04x): stub\n", hdc, rect, flags );
1354 return DCB_RESET | DCB_DISABLE; /* bounding rectangle always empty and disabled*/
1357 /***********************************************************************
1358 * SetBoundsRect (GDI32.@)
1360 UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
1362 FIXME("(): stub\n");
1363 return DCB_DISABLE; /* bounding rectangle always empty */
1367 /***********************************************************************
1368 * GetRelAbs (GDI32.@)
1370 INT WINAPI GetRelAbs( HDC hdc, DWORD dwIgnore )
1372 INT ret = 0;
1373 DC *dc = DC_GetDCPtr( hdc );
1374 if (dc) ret = dc->relAbsMode;
1375 GDI_ReleaseObj( hdc );
1376 return ret;
1379 /***********************************************************************
1380 * GetLayout (GDI32.@)
1382 * Gets left->right or right->left text layout flags of a dc.
1383 * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same
1386 DWORD WINAPI GetLayout(HDC hdc)
1388 FIXME("(%p): stub\n", hdc);
1389 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1390 return 0;
1393 /***********************************************************************
1394 * SetLayout (GDI32.@)
1396 * Sets left->right or right->left text layout flags of a dc.
1397 * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same
1400 DWORD WINAPI SetLayout(HDC hdc, DWORD layout)
1402 FIXME("(%p,%08lx): stub\n", hdc, layout);
1403 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1404 return 0;
1407 /***********************************************************************
1408 * SetDCBrushColor (GDI32.@)
1410 * Sets the current device context (DC) brush color to the specified
1411 * color value. If the device cannot represent the specified color
1412 * value, the color is set to the nearest physical color.
1415 COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor)
1417 FIXME("(%p, %08lx): stub\n", hdc, crColor);
1418 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1419 return CLR_INVALID;
1422 /***********************************************************************
1423 * SetVirtualResolution (GDI32.@)
1425 * Undocumented on msdn. Called when powerpoint xp saves a file.
1427 DWORD WINAPI SetVirtualResolution(HDC hdc, DWORD dw2, DWORD dw3, DWORD dw4, DWORD dw5)
1429 FIXME("(%p %08lx %08lx %08lx %08lx): stub!\n", hdc, dw2, dw3, dw4, dw5);
1430 return FALSE;