Stubbed GetDeviceGammaRamp.
[wine/multimedia.git] / objects / dc.c
blob8c7e756be064aaaeb914f22da99f079e05a7586c
1 /*
2 * GDI Device Context functions
4 * Copyright 1993 Alexandre Julliard
6 */
8 #include "config.h"
10 #include <stdlib.h>
11 #include <string.h>
12 #include "dc.h"
13 #include "gdi.h"
14 #include "heap.h"
15 #include "debugtools.h"
16 #include "font.h"
17 #include "callback.h"
18 #include "winerror.h"
19 #include "windef.h"
20 #include "wingdi.h"
21 #include "wine/winuser16.h"
23 DEFAULT_DEBUG_CHANNEL(dc);
25 /***********************************************************************
26 * DC_Init_DC_INFO
28 * Fill the WIN_DC_INFO structure.
30 static void DC_Init_DC_INFO( WIN_DC_INFO *win_dc_info )
32 win_dc_info->flags = 0;
33 win_dc_info->devCaps = NULL;
34 win_dc_info->hClipRgn = 0;
35 win_dc_info->hVisRgn = 0;
36 win_dc_info->hGCClipRgn = 0;
37 win_dc_info->hPen = STOCK_BLACK_PEN;
38 win_dc_info->hBrush = STOCK_WHITE_BRUSH;
39 win_dc_info->hFont = STOCK_SYSTEM_FONT;
40 win_dc_info->hBitmap = 0;
41 win_dc_info->hDevice = 0;
42 win_dc_info->hPalette = STOCK_DEFAULT_PALETTE;
43 win_dc_info->ROPmode = R2_COPYPEN;
44 win_dc_info->polyFillMode = ALTERNATE;
45 win_dc_info->stretchBltMode = BLACKONWHITE;
46 win_dc_info->relAbsMode = ABSOLUTE;
47 win_dc_info->backgroundMode = OPAQUE;
48 win_dc_info->backgroundColor = RGB( 255, 255, 255 );
49 win_dc_info->textColor = RGB( 0, 0, 0 );
50 win_dc_info->brushOrgX = 0;
51 win_dc_info->brushOrgY = 0;
52 win_dc_info->textAlign = TA_LEFT | TA_TOP | TA_NOUPDATECP;
53 win_dc_info->charExtra = 0;
54 win_dc_info->breakTotalExtra = 0;
55 win_dc_info->breakCount = 0;
56 win_dc_info->breakExtra = 0;
57 win_dc_info->breakRem = 0;
58 win_dc_info->bitsPerPixel = 1;
59 win_dc_info->MapMode = MM_TEXT;
60 win_dc_info->GraphicsMode = GM_COMPATIBLE;
61 win_dc_info->DCOrgX = 0;
62 win_dc_info->DCOrgY = 0;
63 win_dc_info->pAbortProc = NULL;
64 win_dc_info->CursPosX = 0;
65 win_dc_info->CursPosY = 0;
66 win_dc_info->ArcDirection = AD_COUNTERCLOCKWISE;
67 win_dc_info->xformWorld2Wnd.eM11 = 1.0f;
68 win_dc_info->xformWorld2Wnd.eM12 = 0.0f;
69 win_dc_info->xformWorld2Wnd.eM21 = 0.0f;
70 win_dc_info->xformWorld2Wnd.eM22 = 1.0f;
71 win_dc_info->xformWorld2Wnd.eDx = 0.0f;
72 win_dc_info->xformWorld2Wnd.eDy = 0.0f;
73 win_dc_info->xformWorld2Vport = win_dc_info->xformWorld2Wnd;
74 win_dc_info->xformVport2World = win_dc_info->xformWorld2Wnd;
75 win_dc_info->vport2WorldValid = TRUE;
77 PATH_InitGdiPath(&win_dc_info->path);
81 /***********************************************************************
82 * DC_AllocDC
84 DC *DC_AllocDC( const DC_FUNCTIONS *funcs )
86 HDC hdc;
87 DC *dc;
89 if (!(dc = GDI_AllocObject( sizeof(DC), DC_MAGIC, &hdc ))) return NULL;
90 dc->hSelf = hdc;
91 dc->funcs = funcs;
92 dc->physDev = NULL;
93 dc->saveLevel = 0;
94 dc->dwHookData = 0L;
95 dc->hookProc = NULL;
96 dc->hookThunk = NULL;
97 dc->wndOrgX = 0;
98 dc->wndOrgY = 0;
99 dc->wndExtX = 1;
100 dc->wndExtY = 1;
101 dc->vportOrgX = 0;
102 dc->vportOrgY = 0;
103 dc->vportExtX = 1;
104 dc->vportExtY = 1;
106 DC_Init_DC_INFO( &dc->w );
108 return dc;
113 /***********************************************************************
114 * DC_GetDCPtr
116 DC *DC_GetDCPtr( HDC hdc )
118 GDIOBJHDR *ptr = GDI_GetObjPtr( hdc, MAGIC_DONTCARE );
119 if (!ptr) return NULL;
120 if ((GDIMAGIC(ptr->wMagic) == DC_MAGIC) ||
121 (GDIMAGIC(ptr->wMagic) == METAFILE_DC_MAGIC) ||
122 (GDIMAGIC(ptr->wMagic) == ENHMETAFILE_DC_MAGIC))
123 return (DC *)ptr;
124 GDI_ReleaseObj( hdc );
125 SetLastError( ERROR_INVALID_HANDLE );
126 return NULL;
129 /***********************************************************************
130 * DC_GetDCUpdate
132 * Retrieve a DC ptr while making sure the visRgn is updated.
133 * This function may call up to USER so the GDI lock should _not_
134 * be held when calling it.
136 DC *DC_GetDCUpdate( HDC hdc )
138 DC *dc = DC_GetDCPtr( hdc );
139 if (!dc) return NULL;
140 while (dc->w.flags & DC_DIRTY)
142 dc->w.flags &= ~DC_DIRTY;
143 if (!(dc->w.flags & (DC_SAVED | DC_MEMORY)))
145 DCHOOKPROC proc = dc->hookThunk;
146 if (proc)
148 DWORD data = dc->dwHookData;
149 GDI_ReleaseObj( hdc );
150 proc( hdc, DCHC_INVALIDVISRGN, data, 0 );
151 if (!(dc = DC_GetDCPtr( hdc ))) break;
152 /* otherwise restart the loop in case it became dirty again in the meantime */
156 return dc;
159 /***********************************************************************
160 * DC_InitDC
162 * Setup device-specific DC values for a newly created DC.
164 void DC_InitDC( DC* dc )
166 RealizeDefaultPalette16( dc->hSelf );
167 SetTextColor( dc->hSelf, dc->w.textColor );
168 SetBkColor( dc->hSelf, dc->w.backgroundColor );
169 SelectObject( dc->hSelf, dc->w.hPen );
170 SelectObject( dc->hSelf, dc->w.hBrush );
171 SelectObject( dc->hSelf, dc->w.hFont );
172 CLIPPING_UpdateGCRegion( dc );
176 /***********************************************************************
177 * DC_InvertXform
179 * Computes the inverse of the transformation xformSrc and stores it to
180 * xformDest. Returns TRUE if successful or FALSE if the xformSrc matrix
181 * is singular.
183 static BOOL DC_InvertXform( const XFORM *xformSrc, XFORM *xformDest )
185 FLOAT determinant;
187 determinant = xformSrc->eM11*xformSrc->eM22 -
188 xformSrc->eM12*xformSrc->eM21;
189 if (determinant > -1e-12 && determinant < 1e-12)
190 return FALSE;
192 xformDest->eM11 = xformSrc->eM22 / determinant;
193 xformDest->eM12 = -xformSrc->eM12 / determinant;
194 xformDest->eM21 = -xformSrc->eM21 / determinant;
195 xformDest->eM22 = xformSrc->eM11 / determinant;
196 xformDest->eDx = -xformSrc->eDx * xformDest->eM11 -
197 xformSrc->eDy * xformDest->eM21;
198 xformDest->eDy = -xformSrc->eDx * xformDest->eM12 -
199 xformSrc->eDy * xformDest->eM22;
201 return TRUE;
205 /***********************************************************************
206 * DC_UpdateXforms
208 * Updates the xformWorld2Vport, xformVport2World and vport2WorldValid
209 * fields of the specified DC by creating a transformation that
210 * represents the current mapping mode and combining it with the DC's
211 * world transform. This function should be called whenever the
212 * parameters associated with the mapping mode (window and viewport
213 * extents and origins) or the world transform change.
215 void DC_UpdateXforms( DC *dc )
217 XFORM xformWnd2Vport;
218 FLOAT scaleX, scaleY;
220 /* Construct a transformation to do the window-to-viewport conversion */
221 scaleX = (FLOAT)dc->vportExtX / (FLOAT)dc->wndExtX;
222 scaleY = (FLOAT)dc->vportExtY / (FLOAT)dc->wndExtY;
223 xformWnd2Vport.eM11 = scaleX;
224 xformWnd2Vport.eM12 = 0.0;
225 xformWnd2Vport.eM21 = 0.0;
226 xformWnd2Vport.eM22 = scaleY;
227 xformWnd2Vport.eDx = (FLOAT)dc->vportOrgX -
228 scaleX * (FLOAT)dc->wndOrgX;
229 xformWnd2Vport.eDy = (FLOAT)dc->vportOrgY -
230 scaleY * (FLOAT)dc->wndOrgY;
232 /* Combine with the world transformation */
233 CombineTransform( &dc->w.xformWorld2Vport, &dc->w.xformWorld2Wnd,
234 &xformWnd2Vport );
236 /* Create inverse of world-to-viewport transformation */
237 dc->w.vport2WorldValid = DC_InvertXform( &dc->w.xformWorld2Vport,
238 &dc->w.xformVport2World );
242 /***********************************************************************
243 * GetDCState (GDI.179)
245 HDC16 WINAPI GetDCState16( HDC16 hdc )
247 DC * newdc, * dc;
248 HGDIOBJ handle;
250 if (!(dc = DC_GetDCUpdate( hdc ))) return 0;
251 if (!(newdc = GDI_AllocObject( sizeof(DC), DC_MAGIC, &handle )))
253 GDI_ReleaseObj( hdc );
254 return 0;
256 TRACE("(%04x): returning %04x\n", hdc, handle );
258 newdc->w.flags = dc->w.flags | DC_SAVED;
259 newdc->w.devCaps = dc->w.devCaps;
260 newdc->w.hPen = dc->w.hPen;
261 newdc->w.hBrush = dc->w.hBrush;
262 newdc->w.hFont = dc->w.hFont;
263 newdc->w.hBitmap = dc->w.hBitmap;
264 newdc->w.hDevice = dc->w.hDevice;
265 newdc->w.hPalette = dc->w.hPalette;
266 newdc->w.totalExtent = dc->w.totalExtent;
267 newdc->w.bitsPerPixel = dc->w.bitsPerPixel;
268 newdc->w.ROPmode = dc->w.ROPmode;
269 newdc->w.polyFillMode = dc->w.polyFillMode;
270 newdc->w.stretchBltMode = dc->w.stretchBltMode;
271 newdc->w.relAbsMode = dc->w.relAbsMode;
272 newdc->w.backgroundMode = dc->w.backgroundMode;
273 newdc->w.backgroundColor = dc->w.backgroundColor;
274 newdc->w.textColor = dc->w.textColor;
275 newdc->w.brushOrgX = dc->w.brushOrgX;
276 newdc->w.brushOrgY = dc->w.brushOrgY;
277 newdc->w.textAlign = dc->w.textAlign;
278 newdc->w.charExtra = dc->w.charExtra;
279 newdc->w.breakTotalExtra = dc->w.breakTotalExtra;
280 newdc->w.breakCount = dc->w.breakCount;
281 newdc->w.breakExtra = dc->w.breakExtra;
282 newdc->w.breakRem = dc->w.breakRem;
283 newdc->w.MapMode = dc->w.MapMode;
284 newdc->w.GraphicsMode = dc->w.GraphicsMode;
285 #if 0
286 /* Apparently, the DC origin is not changed by [GS]etDCState */
287 newdc->w.DCOrgX = dc->w.DCOrgX;
288 newdc->w.DCOrgY = dc->w.DCOrgY;
289 #endif
290 newdc->w.CursPosX = dc->w.CursPosX;
291 newdc->w.CursPosY = dc->w.CursPosY;
292 newdc->w.ArcDirection = dc->w.ArcDirection;
293 newdc->w.xformWorld2Wnd = dc->w.xformWorld2Wnd;
294 newdc->w.xformWorld2Vport = dc->w.xformWorld2Vport;
295 newdc->w.xformVport2World = dc->w.xformVport2World;
296 newdc->w.vport2WorldValid = dc->w.vport2WorldValid;
297 newdc->wndOrgX = dc->wndOrgX;
298 newdc->wndOrgY = dc->wndOrgY;
299 newdc->wndExtX = dc->wndExtX;
300 newdc->wndExtY = dc->wndExtY;
301 newdc->vportOrgX = dc->vportOrgX;
302 newdc->vportOrgY = dc->vportOrgY;
303 newdc->vportExtX = dc->vportExtX;
304 newdc->vportExtY = dc->vportExtY;
306 newdc->hSelf = (HDC)handle;
307 newdc->saveLevel = 0;
309 PATH_InitGdiPath( &newdc->w.path );
311 newdc->w.pAbortProc = NULL;
312 newdc->hookThunk = NULL;
314 /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */
316 newdc->w.hGCClipRgn = newdc->w.hVisRgn = 0;
317 if (dc->w.hClipRgn)
319 newdc->w.hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
320 CombineRgn( newdc->w.hClipRgn, dc->w.hClipRgn, 0, RGN_COPY );
322 else
323 newdc->w.hClipRgn = 0;
324 GDI_ReleaseObj( handle );
325 GDI_ReleaseObj( hdc );
326 return handle;
330 /***********************************************************************
331 * SetDCState (GDI.180)
333 void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
335 DC *dc, *dcs;
337 if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return;
338 if (!(dcs = (DC *) GDI_GetObjPtr( hdcs, DC_MAGIC )))
340 GDI_ReleaseObj( hdc );
341 return;
343 if (!dcs->w.flags & DC_SAVED)
345 GDI_ReleaseObj( hdc );
346 GDI_ReleaseObj( hdcs );
347 return;
349 TRACE("%04x %04x\n", hdc, hdcs );
351 dc->w.flags = dcs->w.flags & ~DC_SAVED;
352 dc->w.devCaps = dcs->w.devCaps;
353 dc->w.hDevice = dcs->w.hDevice;
354 dc->w.totalExtent = dcs->w.totalExtent;
355 dc->w.ROPmode = dcs->w.ROPmode;
356 dc->w.polyFillMode = dcs->w.polyFillMode;
357 dc->w.stretchBltMode = dcs->w.stretchBltMode;
358 dc->w.relAbsMode = dcs->w.relAbsMode;
359 dc->w.backgroundMode = dcs->w.backgroundMode;
360 dc->w.backgroundColor = dcs->w.backgroundColor;
361 dc->w.textColor = dcs->w.textColor;
362 dc->w.brushOrgX = dcs->w.brushOrgX;
363 dc->w.brushOrgY = dcs->w.brushOrgY;
364 dc->w.textAlign = dcs->w.textAlign;
365 dc->w.charExtra = dcs->w.charExtra;
366 dc->w.breakTotalExtra = dcs->w.breakTotalExtra;
367 dc->w.breakCount = dcs->w.breakCount;
368 dc->w.breakExtra = dcs->w.breakExtra;
369 dc->w.breakRem = dcs->w.breakRem;
370 dc->w.MapMode = dcs->w.MapMode;
371 dc->w.GraphicsMode = dcs->w.GraphicsMode;
372 #if 0
373 /* Apparently, the DC origin is not changed by [GS]etDCState */
374 dc->w.DCOrgX = dcs->w.DCOrgX;
375 dc->w.DCOrgY = dcs->w.DCOrgY;
376 #endif
377 dc->w.CursPosX = dcs->w.CursPosX;
378 dc->w.CursPosY = dcs->w.CursPosY;
379 dc->w.ArcDirection = dcs->w.ArcDirection;
380 dc->w.xformWorld2Wnd = dcs->w.xformWorld2Wnd;
381 dc->w.xformWorld2Vport = dcs->w.xformWorld2Vport;
382 dc->w.xformVport2World = dcs->w.xformVport2World;
383 dc->w.vport2WorldValid = dcs->w.vport2WorldValid;
385 dc->wndOrgX = dcs->wndOrgX;
386 dc->wndOrgY = dcs->wndOrgY;
387 dc->wndExtX = dcs->wndExtX;
388 dc->wndExtY = dcs->wndExtY;
389 dc->vportOrgX = dcs->vportOrgX;
390 dc->vportOrgY = dcs->vportOrgY;
391 dc->vportExtX = dcs->vportExtX;
392 dc->vportExtY = dcs->vportExtY;
394 if (!(dc->w.flags & DC_MEMORY)) dc->w.bitsPerPixel = dcs->w.bitsPerPixel;
396 if (dcs->w.hClipRgn)
398 if (!dc->w.hClipRgn) dc->w.hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
399 CombineRgn( dc->w.hClipRgn, dcs->w.hClipRgn, 0, RGN_COPY );
401 else
403 if (dc->w.hClipRgn) DeleteObject16( dc->w.hClipRgn );
404 dc->w.hClipRgn = 0;
406 CLIPPING_UpdateGCRegion( dc );
408 SelectObject( hdc, dcs->w.hBitmap );
409 SelectObject( hdc, dcs->w.hBrush );
410 SelectObject( hdc, dcs->w.hFont );
411 SelectObject( hdc, dcs->w.hPen );
412 SetBkColor( hdc, dcs->w.backgroundColor);
413 SetTextColor( hdc, dcs->w.textColor);
414 GDISelectPalette16( hdc, dcs->w.hPalette, FALSE );
415 GDI_ReleaseObj( hdcs );
416 GDI_ReleaseObj( hdc );
420 /***********************************************************************
421 * SaveDC16 (GDI.30)
423 INT16 WINAPI SaveDC16( HDC16 hdc )
425 return (INT16)SaveDC( hdc );
429 /***********************************************************************
430 * SaveDC (GDI32.292)
432 INT WINAPI SaveDC( HDC hdc )
434 HDC hdcs;
435 DC * dc, * dcs;
436 INT ret;
438 dc = DC_GetDCUpdate( hdc );
439 if (!dc) return 0;
441 if(dc->funcs->pSaveDC)
443 ret = dc->funcs->pSaveDC( dc );
444 GDI_ReleaseObj( hdc );
445 return ret;
448 if (!(hdcs = GetDCState16( hdc )))
450 GDI_ReleaseObj( hdc );
451 return 0;
453 dcs = GDI_GetObjPtr( hdcs, DC_MAGIC );
455 /* Copy path. The reason why path saving / restoring is in SaveDC/
456 * RestoreDC and not in GetDCState/SetDCState is that the ...DCState
457 * functions are only in Win16 (which doesn't have paths) and that
458 * SetDCState doesn't allow us to signal an error (which can happen
459 * when copying paths).
461 if (!PATH_AssignGdiPath( &dcs->w.path, &dc->w.path ))
463 GDI_ReleaseObj( hdc );
464 GDI_ReleaseObj( hdcs );
465 DeleteDC( hdcs );
466 return 0;
469 dcs->header.hNext = dc->header.hNext;
470 dc->header.hNext = hdcs;
471 TRACE("(%04x): returning %d\n", hdc, dc->saveLevel+1 );
472 ret = ++dc->saveLevel;
473 GDI_ReleaseObj( hdcs );
474 GDI_ReleaseObj( hdc );
475 return ret;
479 /***********************************************************************
480 * RestoreDC16 (GDI.39)
482 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
484 return RestoreDC( hdc, level );
488 /***********************************************************************
489 * RestoreDC (GDI32.290)
491 BOOL WINAPI RestoreDC( HDC hdc, INT level )
493 DC * dc, * dcs;
494 BOOL success;
496 TRACE("%04x %d\n", hdc, level );
497 dc = DC_GetDCPtr( hdc );
498 if(!dc) return FALSE;
499 if(dc->funcs->pRestoreDC)
501 success = dc->funcs->pRestoreDC( dc, level );
502 GDI_ReleaseObj( hdc );
503 return success;
506 if (level == -1) level = dc->saveLevel;
507 if ((level < 1)
508 /* This pair of checks disagrees with MSDN "Platform SDK:
509 Windows GDI" July 2000 which says all negative values
510 for level will be interpreted as an instance relative
511 to the current state. Restricting it to just -1 does
512 not satisfy this */
513 || (level > dc->saveLevel))
515 GDI_ReleaseObj( hdc );
516 return FALSE;
519 success=TRUE;
520 while (dc->saveLevel >= level)
522 HDC16 hdcs = dc->header.hNext;
523 if (!(dcs = (DC *) GDI_GetObjPtr( hdcs, DC_MAGIC )))
525 GDI_ReleaseObj( hdc );
526 return FALSE;
528 dc->header.hNext = dcs->header.hNext;
529 if (--dc->saveLevel < level)
531 SetDCState16( hdc, hdcs );
532 if (!PATH_AssignGdiPath( &dc->w.path, &dcs->w.path ))
533 /* FIXME: This might not be quite right, since we're
534 * returning FALSE but still destroying the saved DC state */
535 success=FALSE;
537 GDI_ReleaseObj( hdcs );
538 DeleteDC( hdcs );
540 GDI_ReleaseObj( hdc );
541 return success;
545 /***********************************************************************
546 * CreateDC16 (GDI.53)
548 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
549 const DEVMODEA *initData )
551 HDC hdc;
552 DC * dc;
553 const DC_FUNCTIONS *funcs;
554 char buf[300];
556 if (!device || !DRIVER_GetDriverName( device, buf, sizeof(buf) ))
557 strcpy(buf, driver);
559 if (!(funcs = DRIVER_FindDriver( buf ))) return 0;
560 if (!(dc = DC_AllocDC( funcs ))) return 0;
561 dc->w.flags = 0;
563 TRACE("(driver=%s, device=%s, output=%s): returning %04x\n",
564 debugstr_a(driver), debugstr_a(device), debugstr_a(output), dc->hSelf );
566 if (dc->funcs->pCreateDC &&
567 !dc->funcs->pCreateDC( dc, buf, device, output, initData ))
569 WARN("creation aborted by device\n" );
570 GDI_FreeObject( dc->hSelf, dc );
571 return 0;
574 DC_InitDC( dc );
575 hdc = dc->hSelf;
576 GDI_ReleaseObj( hdc );
577 return hdc;
581 /***********************************************************************
582 * CreateDCA (GDI32.)
584 HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
585 const DEVMODEA *initData )
587 return CreateDC16( driver, device, output, (const DEVMODEA *)initData );
591 /***********************************************************************
592 * CreateDCW (GDI32.)
594 HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
595 const DEVMODEW *initData )
597 LPSTR driverA = HEAP_strdupWtoA( GetProcessHeap(), 0, driver );
598 LPSTR deviceA = HEAP_strdupWtoA( GetProcessHeap(), 0, device );
599 LPSTR outputA = HEAP_strdupWtoA( GetProcessHeap(), 0, output );
600 HDC res = CreateDC16( driverA, deviceA, outputA,
601 (const DEVMODEA *)initData /*FIXME*/ );
602 HeapFree( GetProcessHeap(), 0, driverA );
603 HeapFree( GetProcessHeap(), 0, deviceA );
604 HeapFree( GetProcessHeap(), 0, outputA );
605 return res;
609 /***********************************************************************
610 * CreateIC16 (GDI.153)
612 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
613 const DEVMODEA* initData )
615 /* Nothing special yet for ICs */
616 return CreateDC16( driver, device, output, initData );
620 /***********************************************************************
621 * CreateICA (GDI32.49)
623 HDC WINAPI CreateICA( LPCSTR driver, LPCSTR device, LPCSTR output,
624 const DEVMODEA* initData )
626 /* Nothing special yet for ICs */
627 return CreateDCA( driver, device, output, initData );
631 /***********************************************************************
632 * CreateICW (GDI32.50)
634 HDC WINAPI CreateICW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
635 const DEVMODEW* initData )
637 /* Nothing special yet for ICs */
638 return CreateDCW( driver, device, output, initData );
642 /***********************************************************************
643 * CreateCompatibleDC16 (GDI.52)
645 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
647 return (HDC16)CreateCompatibleDC( hdc );
651 /***********************************************************************
652 * CreateCompatibleDC (GDI32.31)
654 HDC WINAPI CreateCompatibleDC( HDC hdc )
656 DC *dc, *origDC;
657 const DC_FUNCTIONS *funcs;
659 if ((origDC = (DC *)GDI_GetObjPtr( hdc, DC_MAGIC ))) funcs = origDC->funcs;
660 else funcs = DRIVER_FindDriver( "DISPLAY" );
662 if (!funcs || !(dc = DC_AllocDC( funcs )))
664 if (origDC) GDI_ReleaseObj( hdc );
665 return 0;
668 TRACE("(%04x): returning %04x\n",
669 hdc, dc->hSelf );
671 dc->w.flags = DC_MEMORY;
672 dc->w.bitsPerPixel = 1;
673 dc->w.hBitmap = hPseudoStockBitmap;
675 /* Copy the driver-specific physical device info into
676 * the new DC. The driver may use this read-only info
677 * while creating the compatible DC below. */
678 if (origDC)
679 dc->physDev = origDC->physDev;
681 if (dc->funcs->pCreateDC &&
682 !dc->funcs->pCreateDC( dc, NULL, NULL, NULL, NULL ))
684 WARN("creation aborted by device\n");
685 GDI_FreeObject( dc->hSelf, dc );
686 if (origDC) GDI_ReleaseObj( hdc );
687 return 0;
690 DC_InitDC( dc );
691 GDI_ReleaseObj( dc->hSelf );
692 if (origDC) GDI_ReleaseObj( hdc );
693 return dc->hSelf;
697 /***********************************************************************
698 * DeleteDC16 (GDI.68)
700 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
702 return DeleteDC( hdc );
706 /***********************************************************************
707 * DeleteDC (GDI32.67)
709 BOOL WINAPI DeleteDC( HDC hdc )
711 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
712 if (!dc) return FALSE;
714 TRACE("%04x\n", hdc );
716 /* Call hook procedure to check whether is it OK to delete this DC */
717 if (dc->hookThunk && !(dc->w.flags & (DC_SAVED | DC_MEMORY)))
719 DCHOOKPROC proc = dc->hookThunk;
720 if (proc)
722 DWORD data = dc->dwHookData;
723 GDI_ReleaseObj( hdc );
724 if (!proc( hdc, DCHC_DELETEDC, data, 0 )) return FALSE;
725 if (!(dc = DC_GetDCPtr( hdc ))) return FALSE;
729 while (dc->saveLevel)
731 DC * dcs;
732 HDC16 hdcs = dc->header.hNext;
733 if (!(dcs = (DC *) GDI_GetObjPtr( hdcs, DC_MAGIC ))) break;
734 dc->header.hNext = dcs->header.hNext;
735 dc->saveLevel--;
736 GDI_ReleaseObj( hdcs );
737 DeleteDC( hdcs );
740 if (!(dc->w.flags & DC_SAVED))
742 SelectObject( hdc, STOCK_BLACK_PEN );
743 SelectObject( hdc, STOCK_WHITE_BRUSH );
744 SelectObject( hdc, STOCK_SYSTEM_FONT );
745 if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc);
748 if (dc->w.hClipRgn) DeleteObject( dc->w.hClipRgn );
749 if (dc->w.hVisRgn) DeleteObject( dc->w.hVisRgn );
750 if (dc->w.hGCClipRgn) DeleteObject( dc->w.hGCClipRgn );
751 if (dc->w.pAbortProc) THUNK_Free( (FARPROC)dc->w.pAbortProc );
752 if (dc->hookThunk) THUNK_Free( (FARPROC)dc->hookThunk );
753 PATH_DestroyGdiPath(&dc->w.path);
755 return GDI_FreeObject( hdc, dc );
759 /***********************************************************************
760 * ResetDC16 (GDI.376)
762 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
764 FIXME("stub\n" );
765 return hdc;
769 /***********************************************************************
770 * ResetDCA (GDI32.287)
772 HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode )
774 FIXME("stub\n" );
775 return hdc;
779 /***********************************************************************
780 * ResetDCW (GDI32.288)
782 HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode )
784 FIXME("stub\n" );
785 return hdc;
789 /***********************************************************************
790 * GetDeviceCaps16 (GDI.80)
792 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
794 INT16 ret = GetDeviceCaps( hdc, cap );
795 /* some apps don't expect -1 and think it's a B&W screen */
796 if ((cap == NUMCOLORS) && (ret == -1)) ret = 2048;
797 return ret;
801 /***********************************************************************
802 * GetDeviceCaps (GDI32.171)
804 INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
806 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
807 INT ret = 0;
808 POINT pt;
810 if (!dc) return 0;
812 /* Device capabilities for the printer */
813 switch (cap)
815 case PHYSICALWIDTH:
816 if(Escape(hdc, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0) ret = pt.x;
817 break;
818 case PHYSICALHEIGHT:
819 if(Escape(hdc, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0) ret = pt.y;
820 break;
821 case PHYSICALOFFSETX:
822 if(Escape(hdc, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0) ret = pt.x;
823 break;
824 case PHYSICALOFFSETY:
825 if(Escape(hdc, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0) ret = pt.y;
826 break;
827 case SCALINGFACTORX:
828 if(Escape(hdc, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0) ret = pt.x;
829 break;
830 case SCALINGFACTORY:
831 if(Escape(hdc, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0) ret = pt.y;
832 break;
833 default:
834 if ((cap < 0) || (cap > sizeof(DeviceCaps)-sizeof(WORD))) break;
836 if (((cap>=46) && (cap<88)) || ((cap>=92) && (cap<104)))
837 FIXME("(%04x,%d): unsupported DeviceCaps capability, will yield 0!\n",
838 hdc,cap );
839 ret = *(WORD *)(((char *)dc->w.devCaps) + cap);
841 if ((cap == NUMCOLORS) && (ret == 0xffff))
842 ret = -1;
843 break;
846 TRACE("(%04x,%d): returning %d\n", hdc, cap, ret );
847 GDI_ReleaseObj( hdc );
848 return ret;
852 /***********************************************************************
853 * SetBkColor16 (GDI.1)
855 COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color )
857 return SetBkColor( hdc, color );
861 /***********************************************************************
862 * SetBkColor (GDI32.305)
864 COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color )
866 COLORREF oldColor;
867 DC * dc = DC_GetDCPtr( hdc );
869 if (!dc) return 0x80000000;
870 if (dc->funcs->pSetBkColor)
871 oldColor = dc->funcs->pSetBkColor(dc, color);
872 else {
873 oldColor = dc->w.backgroundColor;
874 dc->w.backgroundColor = color;
876 GDI_ReleaseObj( hdc );
877 return oldColor;
881 /***********************************************************************
882 * SetTextColor16 (GDI.9)
884 COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color )
886 return SetTextColor( hdc, color );
890 /***********************************************************************
891 * SetTextColor (GDI32.338)
893 COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
895 COLORREF oldColor;
896 DC * dc = DC_GetDCPtr( hdc );
898 if (!dc) return 0x80000000;
899 if (dc->funcs->pSetTextColor)
900 oldColor = dc->funcs->pSetTextColor(dc, color);
901 else {
902 oldColor = dc->w.textColor;
903 dc->w.textColor = color;
905 GDI_ReleaseObj( hdc );
906 return oldColor;
909 /***********************************************************************
910 * SetTextAlign16 (GDI.346)
912 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
914 return SetTextAlign( hdc, align );
918 /***********************************************************************
919 * SetTextAlign (GDI32.336)
921 UINT WINAPI SetTextAlign( HDC hdc, UINT align )
923 UINT prevAlign;
924 DC *dc = DC_GetDCPtr( hdc );
925 if (!dc) return 0x0;
926 if (dc->funcs->pSetTextAlign)
927 prevAlign = dc->funcs->pSetTextAlign(dc, align);
928 else {
929 prevAlign = dc->w.textAlign;
930 dc->w.textAlign = align;
932 GDI_ReleaseObj( hdc );
933 return prevAlign;
936 /***********************************************************************
937 * GetDCOrgEx (GDI32.168)
939 BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp )
941 DC * dc;
943 if (!lpp) return FALSE;
944 if (!(dc = (DC *) GDI_GetObjPtr( hDC, DC_MAGIC ))) return FALSE;
946 lpp->x = lpp->y = 0;
947 if (dc->funcs->pGetDCOrgEx) dc->funcs->pGetDCOrgEx( dc, lpp );
948 lpp->x += dc->w.DCOrgX;
949 lpp->y += dc->w.DCOrgY;
950 GDI_ReleaseObj( hDC );
951 return TRUE;
955 /***********************************************************************
956 * GetDCOrg (GDI.79)
958 DWORD WINAPI GetDCOrg16( HDC16 hdc )
960 POINT pt;
961 if( GetDCOrgEx( hdc, &pt) )
962 return MAKELONG( (WORD)pt.x, (WORD)pt.y );
963 return 0;
967 /***********************************************************************
968 * SetDCOrg (GDI.117)
970 DWORD WINAPI SetDCOrg16( HDC16 hdc, INT16 x, INT16 y )
972 DWORD prevOrg;
973 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
974 if (!dc) return 0;
975 prevOrg = dc->w.DCOrgX | (dc->w.DCOrgY << 16);
976 dc->w.DCOrgX = x;
977 dc->w.DCOrgY = y;
978 GDI_ReleaseObj( hdc );
979 return prevOrg;
983 /***********************************************************************
984 * SetGraphicsMode (GDI32.317)
986 INT WINAPI SetGraphicsMode( HDC hdc, INT mode )
988 INT ret = 0;
989 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
991 /* One would think that setting the graphics mode to GM_COMPATIBLE
992 * would also reset the world transformation matrix to the unity
993 * matrix. However, in Windows, this is not the case. This doesn't
994 * make a lot of sense to me, but that's the way it is.
997 if (!dc) return 0;
998 if ((mode > 0) || (mode <= GM_LAST))
1000 ret = dc->w.GraphicsMode;
1001 dc->w.GraphicsMode = mode;
1003 GDI_ReleaseObj( hdc );
1004 return ret;
1008 /***********************************************************************
1009 * SetArcDirection16 (GDI.525)
1011 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
1013 return SetArcDirection( (HDC)hdc, (INT)nDirection );
1017 /***********************************************************************
1018 * SetArcDirection (GDI32.302)
1020 INT WINAPI SetArcDirection( HDC hdc, INT nDirection )
1022 DC * dc;
1023 INT nOldDirection = 0;
1025 if (nDirection!=AD_COUNTERCLOCKWISE && nDirection!=AD_CLOCKWISE)
1027 SetLastError(ERROR_INVALID_PARAMETER);
1028 return 0;
1031 if ((dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC )))
1033 nOldDirection = dc->w.ArcDirection;
1034 dc->w.ArcDirection = nDirection;
1035 GDI_ReleaseObj( hdc );
1037 return nOldDirection;
1041 /***********************************************************************
1042 * GetWorldTransform (GDI32.244)
1044 BOOL WINAPI GetWorldTransform( HDC hdc, LPXFORM xform )
1046 DC * dc;
1047 if (!xform) return FALSE;
1048 if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
1049 *xform = dc->w.xformWorld2Wnd;
1050 GDI_ReleaseObj( hdc );
1051 return TRUE;
1055 /***********************************************************************
1056 * SetWorldTransform (GDI32.346)
1058 BOOL WINAPI SetWorldTransform( HDC hdc, const XFORM *xform )
1060 BOOL ret = FALSE;
1061 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
1063 if (!dc)
1065 SetLastError( ERROR_INVALID_HANDLE );
1066 return FALSE;
1069 if (!xform) goto done;
1071 /* Check that graphics mode is GM_ADVANCED */
1072 if (dc->w.GraphicsMode!=GM_ADVANCED) goto done;
1074 dc->w.xformWorld2Wnd = *xform;
1075 DC_UpdateXforms( dc );
1076 ret = TRUE;
1077 done:
1078 GDI_ReleaseObj( hdc );
1079 return ret;
1083 /****************************************************************************
1084 * ModifyWorldTransform [GDI32.253]
1085 * Modifies the world transformation for a device context.
1087 * PARAMS
1088 * hdc [I] Handle to device context
1089 * xform [I] XFORM structure that will be used to modify the world
1090 * transformation
1091 * iMode [I] Specifies in what way to modify the world transformation
1092 * Possible values:
1093 * MWT_IDENTITY
1094 * Resets the world transformation to the identity matrix.
1095 * The parameter xform is ignored.
1096 * MWT_LEFTMULTIPLY
1097 * Multiplies xform into the world transformation matrix from
1098 * the left.
1099 * MWT_RIGHTMULTIPLY
1100 * Multiplies xform into the world transformation matrix from
1101 * the right.
1103 * RETURNS STD
1105 BOOL WINAPI ModifyWorldTransform( HDC hdc, const XFORM *xform,
1106 DWORD iMode )
1108 BOOL ret = FALSE;
1109 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
1111 /* Check for illegal parameters */
1112 if (!dc)
1114 SetLastError( ERROR_INVALID_HANDLE );
1115 return FALSE;
1117 if (!xform) goto done;
1119 /* Check that graphics mode is GM_ADVANCED */
1120 if (dc->w.GraphicsMode!=GM_ADVANCED) goto done;
1122 switch (iMode)
1124 case MWT_IDENTITY:
1125 dc->w.xformWorld2Wnd.eM11 = 1.0f;
1126 dc->w.xformWorld2Wnd.eM12 = 0.0f;
1127 dc->w.xformWorld2Wnd.eM21 = 0.0f;
1128 dc->w.xformWorld2Wnd.eM22 = 1.0f;
1129 dc->w.xformWorld2Wnd.eDx = 0.0f;
1130 dc->w.xformWorld2Wnd.eDy = 0.0f;
1131 break;
1132 case MWT_LEFTMULTIPLY:
1133 CombineTransform( &dc->w.xformWorld2Wnd, xform,
1134 &dc->w.xformWorld2Wnd );
1135 break;
1136 case MWT_RIGHTMULTIPLY:
1137 CombineTransform( &dc->w.xformWorld2Wnd, &dc->w.xformWorld2Wnd,
1138 xform );
1139 break;
1140 default:
1141 goto done;
1144 DC_UpdateXforms( dc );
1145 ret = TRUE;
1146 done:
1147 GDI_ReleaseObj( hdc );
1148 return ret;
1152 /****************************************************************************
1153 * CombineTransform [GDI32.20]
1154 * Combines two transformation matrices.
1156 * PARAMS
1157 * xformResult [O] Stores the result of combining the two matrices
1158 * xform1 [I] Specifies the first matrix to apply
1159 * xform2 [I] Specifies the second matrix to apply
1161 * REMARKS
1162 * The same matrix can be passed in for more than one of the parameters.
1164 * RETURNS STD
1166 BOOL WINAPI CombineTransform( LPXFORM xformResult, const XFORM *xform1,
1167 const XFORM *xform2 )
1169 XFORM xformTemp;
1171 /* Check for illegal parameters */
1172 if (!xformResult || !xform1 || !xform2)
1173 return FALSE;
1175 /* Create the result in a temporary XFORM, since xformResult may be
1176 * equal to xform1 or xform2 */
1177 xformTemp.eM11 = xform1->eM11 * xform2->eM11 +
1178 xform1->eM12 * xform2->eM21;
1179 xformTemp.eM12 = xform1->eM11 * xform2->eM12 +
1180 xform1->eM12 * xform2->eM22;
1181 xformTemp.eM21 = xform1->eM21 * xform2->eM11 +
1182 xform1->eM22 * xform2->eM21;
1183 xformTemp.eM22 = xform1->eM21 * xform2->eM12 +
1184 xform1->eM22 * xform2->eM22;
1185 xformTemp.eDx = xform1->eDx * xform2->eM11 +
1186 xform1->eDy * xform2->eM21 +
1187 xform2->eDx;
1188 xformTemp.eDy = xform1->eDx * xform2->eM12 +
1189 xform1->eDy * xform2->eM22 +
1190 xform2->eDy;
1192 /* Copy the result to xformResult */
1193 *xformResult = xformTemp;
1195 return TRUE;
1199 /***********************************************************************
1200 * SetDCHook (GDI.190)
1202 /* ### start build ### */
1203 extern WORD CALLBACK GDI_CallTo16_word_wwll(FARPROC16,WORD,WORD,LONG,LONG);
1204 /* ### stop build ### */
1205 BOOL16 WINAPI SetDCHook( HDC16 hdc, FARPROC16 hookProc, DWORD dwHookData )
1207 DC *dc = (DC *)GDI_GetObjPtr( hdc, DC_MAGIC );
1208 if (!dc) return FALSE;
1211 * Note: We store the original SEGPTR 'hookProc' as we need to be
1212 * able to return it verbatim in GetDCHook,
1214 * On the other hand, we still call THUNK_Alloc and store the
1215 * 32-bit thunk into another DC member, because THUNK_Alloc
1216 * recognizes the (typical) case that the 'hookProc' is indeed
1217 * the 16-bit API entry point of a built-in routine (e.g. DCHook16)
1219 * We could perform that test every time the hook is about to
1220 * be called (or else we could live with the 32->16->32 detour),
1221 * but this way is the most efficient ...
1224 dc->hookProc = hookProc;
1225 dc->dwHookData = dwHookData;
1227 THUNK_Free( (FARPROC)dc->hookThunk );
1228 dc->hookThunk = (DCHOOKPROC)
1229 THUNK_Alloc( hookProc, (RELAY)GDI_CallTo16_word_wwll );
1231 GDI_ReleaseObj( hdc );
1232 return TRUE;
1236 /***********************************************************************
1237 * GetDCHook (GDI.191)
1239 DWORD WINAPI GetDCHook( HDC16 hdc, FARPROC16 *phookProc )
1241 DC *dc = (DC *)GDI_GetObjPtr( hdc, DC_MAGIC );
1242 if (!dc) return 0;
1243 *phookProc = dc->hookProc;
1244 GDI_ReleaseObj( hdc );
1245 return dc->dwHookData;
1249 /***********************************************************************
1250 * SetHookFlags (GDI.192)
1252 WORD WINAPI SetHookFlags16(HDC16 hDC, WORD flags)
1254 DC* dc = (DC*)GDI_GetObjPtr( hDC, DC_MAGIC );
1256 if( dc )
1258 WORD wRet = dc->w.flags & DC_DIRTY;
1260 /* "Undocumented Windows" info is slightly confusing.
1263 TRACE("hDC %04x, flags %04x\n",hDC,flags);
1265 if( flags & DCHF_INVALIDATEVISRGN )
1266 dc->w.flags |= DC_DIRTY;
1267 else if( flags & DCHF_VALIDATEVISRGN || !flags )
1268 dc->w.flags &= ~DC_DIRTY;
1269 GDI_ReleaseObj( hDC );
1270 return wRet;
1272 return 0;
1275 /***********************************************************************
1276 * SetICMMode (GDI32.318)
1278 INT WINAPI SetICMMode(HDC hdc, INT iEnableICM)
1280 /*FIXME Asuming that ICM is always off, and cannot be turned on */
1281 if (iEnableICM == ICM_OFF) return ICM_OFF;
1282 if (iEnableICM == ICM_ON) return 0;
1283 if (iEnableICM == ICM_QUERY) return ICM_OFF;
1284 return 0;
1287 /***********************************************************************
1288 * GetDeviceGammaRamp (GDI32.*)
1290 BOOL WINAPI GetDeviceGammaRamp(HDC hdc,LPVOID ptr) {
1291 FIXME("(%x,%p), empty stub!\n",hdc,ptr);
1292 return FALSE;
1295 /***********************************************************************
1296 * GetColorSpace (GDI32.165)
1298 HCOLORSPACE WINAPI GetColorSpace(HDC hdc)
1300 /*FIXME Need to to whatever GetColorSpace actually does */
1301 return 0;
1304 /***********************************************************************
1305 * CreateColorSpaceA (GDI32.???)
1307 HCOLORSPACE WINAPI CreateColorSpaceA( LPLOGCOLORSPACEA lpLogColorSpace )
1309 FIXME( "stub\n" );
1310 return 0;
1313 /***********************************************************************
1314 * CreateColorSpaceW (GDI32.???)
1316 HCOLORSPACE WINAPI CreateColorSpaceW( LPLOGCOLORSPACEW lpLogColorSpace )
1318 FIXME( "stub\n" );
1319 return 0;
1322 /***********************************************************************
1323 * DeleteColorSpace (GDI32.???)
1325 BOOL WINAPI DeleteColorSpace( HCOLORSPACE hColorSpace )
1327 FIXME( "stub\n" );
1329 return TRUE;
1332 /***********************************************************************
1333 * SetColorSpace (GDI32.???)
1335 HCOLORSPACE WINAPI SetColorSpace( HDC hDC, HCOLORSPACE hColorSpace )
1337 FIXME( "stub\n" );
1339 return hColorSpace;
1342 /***********************************************************************
1343 * GetBoundsRect16 (GDI.194)
1345 UINT16 WINAPI GetBoundsRect16(HDC16 hdc, LPRECT16 rect, UINT16 flags)
1347 return DCB_RESET | DCB_DISABLE; /* bounding rectangle always empty and disabled*/
1350 /***********************************************************************
1351 * GetBoundsRect (GDI32.147)
1353 UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
1355 FIXME("(): stub\n");
1356 return DCB_RESET; /* bounding rectangle always empty */
1359 /***********************************************************************
1360 * SetBoundsRect16 (GDI.193)
1362 UINT16 WINAPI SetBoundsRect16(HDC16 hdc, const RECT16* rect, UINT16 flags)
1364 if ( (flags & DCB_ACCUMULATE) || (flags & DCB_ENABLE) )
1365 FIXME("(%04x, %p, %04x): stub\n", hdc, rect, flags );
1367 return DCB_RESET | DCB_DISABLE; /* bounding rectangle always empty and disabled*/
1370 /***********************************************************************
1371 * SetBoundsRect (GDI32.307)
1373 UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
1375 FIXME("(): stub\n");
1376 return DCB_DISABLE; /* bounding rectangle always empty */
1380 /***********************************************************************
1381 * GetRelAbs (GDI32.218)
1383 INT WINAPI GetRelAbs( HDC hdc, DWORD dwIgnore )
1385 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
1386 if (!dc) return 0;
1387 return dc->w.relAbsMode;
1390 /***********************************************************************
1391 * Death (GDI.121)
1393 * Disables GDI, switches back to text mode.
1394 * We don't have to do anything here,
1395 * just let console support handle everything
1397 void WINAPI Death16(HDC16 hDC)
1399 MESSAGE("Death(%04x) called. Application enters text mode...\n", hDC);
1402 /***********************************************************************
1403 * Resurrection (GDI.122)
1405 * Restores GDI functionality
1407 void WINAPI Resurrection16(HDC16 hDC,
1408 WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1410 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n", hDC, w1, w2, w3, w4, w5, w6);
1413 /***********************************************************************
1414 * GetLayout (GDI32.321)
1416 * Gets left->right or right->left text layout flags of a dc.
1417 * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same
1420 DWORD WINAPI GetLayout(HDC hdc)
1422 FIXME("(%08x): stub\n", hdc);
1423 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1424 return 0;
1427 /***********************************************************************
1428 * SetLayout (GDI32.450)
1430 * Sets left->right or right->left text layout flags of a dc.
1431 * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same
1434 DWORD WINAPI SetLayout(HDC hdc, DWORD layout)
1436 FIXME("(%08x,%08lx): stub\n", hdc, layout);
1437 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1438 return 0;