Added documentation on how to setup wine's Buildin Postscript Driver
[wine.git] / objects / dc.c
blob26ebd8c82650db876cbab76612c0a9bc64a33b51
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 HDC16 hdc;
87 DC *dc;
89 if (!(hdc = GDI_AllocObject( sizeof(DC), DC_MAGIC ))) return NULL;
90 dc = (DC *) GDI_HEAP_LOCK( hdc );
92 dc->hSelf = hdc;
93 dc->funcs = funcs;
94 dc->physDev = NULL;
95 dc->saveLevel = 0;
96 dc->dwHookData = 0L;
97 dc->hookProc = NULL;
98 dc->hookThunk = NULL;
99 dc->wndOrgX = 0;
100 dc->wndOrgY = 0;
101 dc->wndExtX = 1;
102 dc->wndExtY = 1;
103 dc->vportOrgX = 0;
104 dc->vportOrgY = 0;
105 dc->vportExtX = 1;
106 dc->vportExtY = 1;
108 DC_Init_DC_INFO( &dc->w );
110 return dc;
115 /***********************************************************************
116 * DC_GetDCPtr
118 DC *DC_GetDCPtr( HDC hdc )
120 GDIOBJHDR *ptr = (GDIOBJHDR *)GDI_HEAP_LOCK( hdc );
121 if (!ptr) return NULL;
122 if ((ptr->wMagic == DC_MAGIC) || (ptr->wMagic == METAFILE_DC_MAGIC) ||
123 (ptr->wMagic == ENHMETAFILE_DC_MAGIC))
124 return (DC *)ptr;
125 GDI_HEAP_UNLOCK( hdc );
126 SetLastError( ERROR_INVALID_HANDLE );
127 return NULL;
131 /***********************************************************************
132 * DC_InitDC
134 * Setup device-specific DC values for a newly created DC.
136 void DC_InitDC( DC* dc )
138 RealizeDefaultPalette16( dc->hSelf );
139 SetTextColor( dc->hSelf, dc->w.textColor );
140 SetBkColor( dc->hSelf, dc->w.backgroundColor );
141 SelectObject( dc->hSelf, dc->w.hPen );
142 SelectObject( dc->hSelf, dc->w.hBrush );
143 SelectObject( dc->hSelf, dc->w.hFont );
144 CLIPPING_UpdateGCRegion( dc );
148 /***********************************************************************
149 * DC_InvertXform
151 * Computes the inverse of the transformation xformSrc and stores it to
152 * xformDest. Returns TRUE if successful or FALSE if the xformSrc matrix
153 * is singular.
155 static BOOL DC_InvertXform( const XFORM *xformSrc, XFORM *xformDest )
157 FLOAT determinant;
159 determinant = xformSrc->eM11*xformSrc->eM22 -
160 xformSrc->eM12*xformSrc->eM21;
161 if (determinant > -1e-12 && determinant < 1e-12)
162 return FALSE;
164 xformDest->eM11 = xformSrc->eM22 / determinant;
165 xformDest->eM12 = -xformSrc->eM12 / determinant;
166 xformDest->eM21 = -xformSrc->eM21 / determinant;
167 xformDest->eM22 = xformSrc->eM11 / determinant;
168 xformDest->eDx = -xformSrc->eDx * xformDest->eM11 -
169 xformSrc->eDy * xformDest->eM21;
170 xformDest->eDy = -xformSrc->eDx * xformDest->eM12 -
171 xformSrc->eDy * xformDest->eM22;
173 return TRUE;
177 /***********************************************************************
178 * DC_UpdateXforms
180 * Updates the xformWorld2Vport, xformVport2World and vport2WorldValid
181 * fields of the specified DC by creating a transformation that
182 * represents the current mapping mode and combining it with the DC's
183 * world transform. This function should be called whenever the
184 * parameters associated with the mapping mode (window and viewport
185 * extents and origins) or the world transform change.
187 void DC_UpdateXforms( DC *dc )
189 XFORM xformWnd2Vport;
190 FLOAT scaleX, scaleY;
192 /* Construct a transformation to do the window-to-viewport conversion */
193 scaleX = (FLOAT)dc->vportExtX / (FLOAT)dc->wndExtX;
194 scaleY = (FLOAT)dc->vportExtY / (FLOAT)dc->wndExtY;
195 xformWnd2Vport.eM11 = scaleX;
196 xformWnd2Vport.eM12 = 0.0;
197 xformWnd2Vport.eM21 = 0.0;
198 xformWnd2Vport.eM22 = scaleY;
199 xformWnd2Vport.eDx = (FLOAT)dc->vportOrgX -
200 scaleX * (FLOAT)dc->wndOrgX;
201 xformWnd2Vport.eDy = (FLOAT)dc->vportOrgY -
202 scaleY * (FLOAT)dc->wndOrgY;
204 /* Combine with the world transformation */
205 CombineTransform( &dc->w.xformWorld2Vport, &dc->w.xformWorld2Wnd,
206 &xformWnd2Vport );
208 /* Create inverse of world-to-viewport transformation */
209 dc->w.vport2WorldValid = DC_InvertXform( &dc->w.xformWorld2Vport,
210 &dc->w.xformVport2World );
214 /***********************************************************************
215 * GetDCState (GDI.179)
217 HDC16 WINAPI GetDCState16( HDC16 hdc )
219 DC * newdc, * dc;
220 HGDIOBJ16 handle;
222 if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
223 if (!(handle = GDI_AllocObject( sizeof(DC), DC_MAGIC )))
225 GDI_HEAP_UNLOCK( hdc );
226 return 0;
228 newdc = (DC *) GDI_HEAP_LOCK( handle );
230 TRACE("(%04x): returning %04x\n", hdc, handle );
232 newdc->w.flags = dc->w.flags | DC_SAVED;
233 newdc->w.devCaps = dc->w.devCaps;
234 newdc->w.hPen = dc->w.hPen;
235 newdc->w.hBrush = dc->w.hBrush;
236 newdc->w.hFont = dc->w.hFont;
237 newdc->w.hBitmap = dc->w.hBitmap;
238 newdc->w.hDevice = dc->w.hDevice;
239 newdc->w.hPalette = dc->w.hPalette;
240 newdc->w.totalExtent = dc->w.totalExtent;
241 newdc->w.bitsPerPixel = dc->w.bitsPerPixel;
242 newdc->w.ROPmode = dc->w.ROPmode;
243 newdc->w.polyFillMode = dc->w.polyFillMode;
244 newdc->w.stretchBltMode = dc->w.stretchBltMode;
245 newdc->w.relAbsMode = dc->w.relAbsMode;
246 newdc->w.backgroundMode = dc->w.backgroundMode;
247 newdc->w.backgroundColor = dc->w.backgroundColor;
248 newdc->w.textColor = dc->w.textColor;
249 newdc->w.brushOrgX = dc->w.brushOrgX;
250 newdc->w.brushOrgY = dc->w.brushOrgY;
251 newdc->w.textAlign = dc->w.textAlign;
252 newdc->w.charExtra = dc->w.charExtra;
253 newdc->w.breakTotalExtra = dc->w.breakTotalExtra;
254 newdc->w.breakCount = dc->w.breakCount;
255 newdc->w.breakExtra = dc->w.breakExtra;
256 newdc->w.breakRem = dc->w.breakRem;
257 newdc->w.MapMode = dc->w.MapMode;
258 newdc->w.GraphicsMode = dc->w.GraphicsMode;
259 #if 0
260 /* Apparently, the DC origin is not changed by [GS]etDCState */
261 newdc->w.DCOrgX = dc->w.DCOrgX;
262 newdc->w.DCOrgY = dc->w.DCOrgY;
263 #endif
264 newdc->w.CursPosX = dc->w.CursPosX;
265 newdc->w.CursPosY = dc->w.CursPosY;
266 newdc->w.ArcDirection = dc->w.ArcDirection;
267 newdc->w.xformWorld2Wnd = dc->w.xformWorld2Wnd;
268 newdc->w.xformWorld2Vport = dc->w.xformWorld2Vport;
269 newdc->w.xformVport2World = dc->w.xformVport2World;
270 newdc->w.vport2WorldValid = dc->w.vport2WorldValid;
271 newdc->wndOrgX = dc->wndOrgX;
272 newdc->wndOrgY = dc->wndOrgY;
273 newdc->wndExtX = dc->wndExtX;
274 newdc->wndExtY = dc->wndExtY;
275 newdc->vportOrgX = dc->vportOrgX;
276 newdc->vportOrgY = dc->vportOrgY;
277 newdc->vportExtX = dc->vportExtX;
278 newdc->vportExtY = dc->vportExtY;
280 newdc->hSelf = (HDC)handle;
281 newdc->saveLevel = 0;
283 PATH_InitGdiPath( &newdc->w.path );
285 newdc->w.pAbortProc = NULL;
286 newdc->hookThunk = NULL;
288 /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */
290 newdc->w.hGCClipRgn = newdc->w.hVisRgn = 0;
291 if (dc->w.hClipRgn)
293 newdc->w.hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
294 CombineRgn( newdc->w.hClipRgn, dc->w.hClipRgn, 0, RGN_COPY );
296 else
297 newdc->w.hClipRgn = 0;
298 GDI_HEAP_UNLOCK( handle );
299 GDI_HEAP_UNLOCK( hdc );
300 return handle;
304 /***********************************************************************
305 * SetDCState (GDI.180)
307 void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
309 DC *dc, *dcs;
311 if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return;
312 if (!(dcs = (DC *) GDI_GetObjPtr( hdcs, DC_MAGIC )))
314 GDI_HEAP_UNLOCK( hdc );
315 return;
317 if (!dcs->w.flags & DC_SAVED)
319 GDI_HEAP_UNLOCK( hdc );
320 GDI_HEAP_UNLOCK( hdcs );
321 return;
323 TRACE("%04x %04x\n", hdc, hdcs );
325 dc->w.flags = dcs->w.flags & ~DC_SAVED;
326 dc->w.devCaps = dcs->w.devCaps;
327 dc->w.hDevice = dcs->w.hDevice;
328 dc->w.totalExtent = dcs->w.totalExtent;
329 dc->w.ROPmode = dcs->w.ROPmode;
330 dc->w.polyFillMode = dcs->w.polyFillMode;
331 dc->w.stretchBltMode = dcs->w.stretchBltMode;
332 dc->w.relAbsMode = dcs->w.relAbsMode;
333 dc->w.backgroundMode = dcs->w.backgroundMode;
334 dc->w.backgroundColor = dcs->w.backgroundColor;
335 dc->w.textColor = dcs->w.textColor;
336 dc->w.brushOrgX = dcs->w.brushOrgX;
337 dc->w.brushOrgY = dcs->w.brushOrgY;
338 dc->w.textAlign = dcs->w.textAlign;
339 dc->w.charExtra = dcs->w.charExtra;
340 dc->w.breakTotalExtra = dcs->w.breakTotalExtra;
341 dc->w.breakCount = dcs->w.breakCount;
342 dc->w.breakExtra = dcs->w.breakExtra;
343 dc->w.breakRem = dcs->w.breakRem;
344 dc->w.MapMode = dcs->w.MapMode;
345 dc->w.GraphicsMode = dcs->w.GraphicsMode;
346 #if 0
347 /* Apparently, the DC origin is not changed by [GS]etDCState */
348 dc->w.DCOrgX = dcs->w.DCOrgX;
349 dc->w.DCOrgY = dcs->w.DCOrgY;
350 #endif
351 dc->w.CursPosX = dcs->w.CursPosX;
352 dc->w.CursPosY = dcs->w.CursPosY;
353 dc->w.ArcDirection = dcs->w.ArcDirection;
354 dc->w.xformWorld2Wnd = dcs->w.xformWorld2Wnd;
355 dc->w.xformWorld2Vport = dcs->w.xformWorld2Vport;
356 dc->w.xformVport2World = dcs->w.xformVport2World;
357 dc->w.vport2WorldValid = dcs->w.vport2WorldValid;
359 dc->wndOrgX = dcs->wndOrgX;
360 dc->wndOrgY = dcs->wndOrgY;
361 dc->wndExtX = dcs->wndExtX;
362 dc->wndExtY = dcs->wndExtY;
363 dc->vportOrgX = dcs->vportOrgX;
364 dc->vportOrgY = dcs->vportOrgY;
365 dc->vportExtX = dcs->vportExtX;
366 dc->vportExtY = dcs->vportExtY;
368 if (!(dc->w.flags & DC_MEMORY)) dc->w.bitsPerPixel = dcs->w.bitsPerPixel;
370 if (dcs->w.hClipRgn)
372 if (!dc->w.hClipRgn) dc->w.hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
373 CombineRgn( dc->w.hClipRgn, dcs->w.hClipRgn, 0, RGN_COPY );
375 else
377 if (dc->w.hClipRgn) DeleteObject16( dc->w.hClipRgn );
378 dc->w.hClipRgn = 0;
380 CLIPPING_UpdateGCRegion( dc );
382 SelectObject( hdc, dcs->w.hBitmap );
383 SelectObject( hdc, dcs->w.hBrush );
384 SelectObject( hdc, dcs->w.hFont );
385 SelectObject( hdc, dcs->w.hPen );
386 SetBkColor( hdc, dcs->w.backgroundColor);
387 SetTextColor( hdc, dcs->w.textColor);
388 GDISelectPalette16( hdc, dcs->w.hPalette, FALSE );
389 GDI_HEAP_UNLOCK( hdc );
390 GDI_HEAP_UNLOCK( hdcs );
394 /***********************************************************************
395 * SaveDC16 (GDI.30)
397 INT16 WINAPI SaveDC16( HDC16 hdc )
399 return (INT16)SaveDC( hdc );
403 /***********************************************************************
404 * SaveDC (GDI32.292)
406 INT WINAPI SaveDC( HDC hdc )
408 HDC hdcs;
409 DC * dc, * dcs;
410 INT ret;
412 dc = DC_GetDCPtr( hdc );
413 if (!dc) return 0;
415 if(dc->funcs->pSaveDC)
416 return dc->funcs->pSaveDC( dc );
418 if (!(hdcs = GetDCState16( hdc )))
420 GDI_HEAP_UNLOCK( hdc );
421 return 0;
423 dcs = (DC *) GDI_HEAP_LOCK( hdcs );
425 /* Copy path. The reason why path saving / restoring is in SaveDC/
426 * RestoreDC and not in GetDCState/SetDCState is that the ...DCState
427 * functions are only in Win16 (which doesn't have paths) and that
428 * SetDCState doesn't allow us to signal an error (which can happen
429 * when copying paths).
431 if (!PATH_AssignGdiPath( &dcs->w.path, &dc->w.path ))
433 GDI_HEAP_UNLOCK( hdc );
434 GDI_HEAP_UNLOCK( hdcs );
435 DeleteDC( hdcs );
436 return 0;
439 dcs->header.hNext = dc->header.hNext;
440 dc->header.hNext = hdcs;
441 TRACE("(%04x): returning %d\n", hdc, dc->saveLevel+1 );
442 ret = ++dc->saveLevel;
443 GDI_HEAP_UNLOCK( hdcs );
444 GDI_HEAP_UNLOCK( hdc );
445 return ret;
449 /***********************************************************************
450 * RestoreDC16 (GDI.39)
452 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
454 return RestoreDC( hdc, level );
458 /***********************************************************************
459 * RestoreDC (GDI32.290)
461 BOOL WINAPI RestoreDC( HDC hdc, INT level )
463 DC * dc, * dcs;
464 BOOL success;
466 TRACE("%04x %d\n", hdc, level );
467 dc = DC_GetDCPtr( hdc );
468 if(!dc) return FALSE;
469 if(dc->funcs->pRestoreDC)
470 return dc->funcs->pRestoreDC( dc, level );
472 if (level == -1) level = dc->saveLevel;
473 if ((level < 1) || (level > dc->saveLevel))
475 GDI_HEAP_UNLOCK( hdc );
476 return FALSE;
479 success=TRUE;
480 while (dc->saveLevel >= level)
482 HDC16 hdcs = dc->header.hNext;
483 if (!(dcs = (DC *) GDI_GetObjPtr( hdcs, DC_MAGIC )))
485 GDI_HEAP_UNLOCK( hdc );
486 return FALSE;
488 dc->header.hNext = dcs->header.hNext;
489 if (--dc->saveLevel < level)
491 SetDCState16( hdc, hdcs );
492 if (!PATH_AssignGdiPath( &dc->w.path, &dcs->w.path ))
493 /* FIXME: This might not be quite right, since we're
494 * returning FALSE but still destroying the saved DC state */
495 success=FALSE;
497 DeleteDC( hdcs );
499 GDI_HEAP_UNLOCK( hdc );
500 return success;
504 /***********************************************************************
505 * CreateDC16 (GDI.53)
507 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
508 const DEVMODEA *initData )
510 DC * dc;
511 const DC_FUNCTIONS *funcs;
512 char buf[300];
514 if (device) {
515 if(!DRIVER_GetDriverName( device, buf, sizeof(buf) )) return 0;
516 } else
517 strcpy(buf, driver);
519 if (!(funcs = DRIVER_FindDriver( buf ))) return 0;
520 if (!(dc = DC_AllocDC( funcs ))) return 0;
521 dc->w.flags = 0;
523 TRACE("(driver=%s, device=%s, output=%s): returning %04x\n",
524 debugstr_a(driver), debugstr_a(device), debugstr_a(output), dc->hSelf );
526 if (dc->funcs->pCreateDC &&
527 !dc->funcs->pCreateDC( dc, buf, device, output, initData ))
529 WARN("creation aborted by device\n" );
530 GDI_HEAP_FREE( dc->hSelf );
531 return 0;
534 DC_InitDC( dc );
535 GDI_HEAP_UNLOCK( dc->hSelf );
536 return dc->hSelf;
540 /***********************************************************************
541 * CreateDCA (GDI32.)
543 HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
544 const DEVMODEA *initData )
546 return CreateDC16( driver, device, output, (const DEVMODEA *)initData );
550 /***********************************************************************
551 * CreateDCW (GDI32.)
553 HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
554 const DEVMODEW *initData )
556 LPSTR driverA = HEAP_strdupWtoA( GetProcessHeap(), 0, driver );
557 LPSTR deviceA = HEAP_strdupWtoA( GetProcessHeap(), 0, device );
558 LPSTR outputA = HEAP_strdupWtoA( GetProcessHeap(), 0, output );
559 HDC res = CreateDC16( driverA, deviceA, outputA,
560 (const DEVMODEA *)initData /*FIXME*/ );
561 HeapFree( GetProcessHeap(), 0, driverA );
562 HeapFree( GetProcessHeap(), 0, deviceA );
563 HeapFree( GetProcessHeap(), 0, outputA );
564 return res;
568 /***********************************************************************
569 * CreateIC16 (GDI.153)
571 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
572 const DEVMODEA* initData )
574 /* Nothing special yet for ICs */
575 return CreateDC16( driver, device, output, initData );
579 /***********************************************************************
580 * CreateICA (GDI32.49)
582 HDC WINAPI CreateICA( LPCSTR driver, LPCSTR device, LPCSTR output,
583 const DEVMODEA* initData )
585 /* Nothing special yet for ICs */
586 return CreateDCA( driver, device, output, initData );
590 /***********************************************************************
591 * CreateICW (GDI32.50)
593 HDC WINAPI CreateICW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
594 const DEVMODEW* initData )
596 /* Nothing special yet for ICs */
597 return CreateDCW( driver, device, output, initData );
601 /***********************************************************************
602 * CreateCompatibleDC16 (GDI.52)
604 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
606 return (HDC16)CreateCompatibleDC( hdc );
610 /***********************************************************************
611 * CreateCompatibleDC (GDI32.31)
613 HDC WINAPI CreateCompatibleDC( HDC hdc )
615 DC *dc, *origDC;
616 const DC_FUNCTIONS *funcs;
618 if ((origDC = (DC *)GDI_GetObjPtr( hdc, DC_MAGIC ))) funcs = origDC->funcs;
619 else funcs = DRIVER_FindDriver( "DISPLAY" );
620 if (!funcs) return 0;
622 if (!(dc = DC_AllocDC( funcs ))) return 0;
624 TRACE("(%04x): returning %04x\n",
625 hdc, dc->hSelf );
627 dc->w.flags = DC_MEMORY;
628 dc->w.bitsPerPixel = 1;
629 dc->w.hBitmap = hPseudoStockBitmap;
631 /* Copy the driver-specific physical device info into
632 * the new DC. The driver may use this read-only info
633 * while creating the compatible DC below. */
634 if (origDC)
635 dc->physDev = origDC->physDev;
637 if (dc->funcs->pCreateDC &&
638 !dc->funcs->pCreateDC( dc, NULL, NULL, NULL, NULL ))
640 WARN("creation aborted by device\n");
641 GDI_HEAP_FREE( dc->hSelf );
642 return 0;
645 DC_InitDC( dc );
646 GDI_HEAP_UNLOCK( dc->hSelf );
647 return dc->hSelf;
651 /***********************************************************************
652 * DeleteDC16 (GDI.68)
654 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
656 return DeleteDC( hdc );
660 /***********************************************************************
661 * DeleteDC (GDI32.67)
663 BOOL WINAPI DeleteDC( HDC hdc )
665 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
666 if (!dc) return FALSE;
668 TRACE("%04x\n", hdc );
670 /* Call hook procedure to check whether is it OK to delete this DC */
671 if ( dc->hookThunk && !(dc->w.flags & (DC_SAVED | DC_MEMORY))
672 && dc->hookThunk( hdc, DCHC_DELETEDC, dc->dwHookData, 0 ) == FALSE )
674 GDI_HEAP_UNLOCK( hdc );
675 return FALSE;
678 while (dc->saveLevel)
680 DC * dcs;
681 HDC16 hdcs = dc->header.hNext;
682 if (!(dcs = (DC *) GDI_GetObjPtr( hdcs, DC_MAGIC ))) break;
683 dc->header.hNext = dcs->header.hNext;
684 dc->saveLevel--;
685 DeleteDC( hdcs );
688 if (!(dc->w.flags & DC_SAVED))
690 SelectObject( hdc, STOCK_BLACK_PEN );
691 SelectObject( hdc, STOCK_WHITE_BRUSH );
692 SelectObject( hdc, STOCK_SYSTEM_FONT );
693 if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc);
696 if (dc->w.hClipRgn) DeleteObject( dc->w.hClipRgn );
697 if (dc->w.hVisRgn) DeleteObject( dc->w.hVisRgn );
698 if (dc->w.hGCClipRgn) DeleteObject( dc->w.hGCClipRgn );
699 if (dc->w.pAbortProc) THUNK_Free( (FARPROC)dc->w.pAbortProc );
700 if (dc->hookThunk) THUNK_Free( (FARPROC)dc->hookThunk );
701 PATH_DestroyGdiPath(&dc->w.path);
703 return GDI_FreeObject( hdc );
707 /***********************************************************************
708 * ResetDC16 (GDI.376)
710 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
712 FIXME("stub\n" );
713 return hdc;
717 /***********************************************************************
718 * ResetDCA (GDI32.287)
720 HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode )
722 FIXME("stub\n" );
723 return hdc;
727 /***********************************************************************
728 * ResetDCW (GDI32.288)
730 HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode )
732 FIXME("stub\n" );
733 return hdc;
737 /***********************************************************************
738 * GetDeviceCaps16 (GDI.80)
740 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
742 return GetDeviceCaps( hdc, cap );
746 /***********************************************************************
747 * GetDeviceCaps (GDI32.171)
749 INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
751 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
752 INT ret;
753 POINT pt;
755 if (!dc) return 0;
757 /* Device capabilities for the printer */
758 switch (cap)
760 case PHYSICALWIDTH:
761 if(Escape(hdc, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0)
762 return pt.x;
763 case PHYSICALHEIGHT:
764 if(Escape(hdc, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0)
765 return pt.y;
766 case PHYSICALOFFSETX:
767 if(Escape(hdc, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0)
768 return pt.x;
769 case PHYSICALOFFSETY:
770 if(Escape(hdc, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0)
771 return pt.y;
772 case SCALINGFACTORX:
773 if(Escape(hdc, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0)
774 return pt.x;
775 case SCALINGFACTORY:
776 if(Escape(hdc, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0)
777 return pt.y;
780 if ((cap < 0) || (cap > sizeof(DeviceCaps)-sizeof(WORD)))
782 GDI_HEAP_UNLOCK( hdc );
783 return 0;
786 if (((cap>=46) && (cap<88)) || ((cap>=92) && (cap<104)))
787 FIXME("(%04x,%d): unsupported DeviceCaps capability, will yield 0!\n",
788 hdc,cap
790 TRACE("(%04x,%d): returning %d\n",
791 hdc, cap, *(WORD *)(((char *)dc->w.devCaps) + cap) );
792 ret = *(WORD *)(((char *)dc->w.devCaps) + cap);
793 GDI_HEAP_UNLOCK( hdc );
794 return ret;
798 /***********************************************************************
799 * SetBkColor16 (GDI.1)
801 COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color )
803 return SetBkColor( hdc, color );
807 /***********************************************************************
808 * SetBkColor (GDI32.305)
810 COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color )
812 COLORREF oldColor;
813 DC * dc = DC_GetDCPtr( hdc );
815 if (!dc) return 0x80000000;
816 if (dc->funcs->pSetBkColor)
817 oldColor = dc->funcs->pSetBkColor(dc, color);
818 else {
819 oldColor = dc->w.backgroundColor;
820 dc->w.backgroundColor = color;
822 GDI_HEAP_UNLOCK( hdc );
823 return oldColor;
827 /***********************************************************************
828 * SetTextColor16 (GDI.9)
830 COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color )
832 return SetTextColor( hdc, color );
836 /***********************************************************************
837 * SetTextColor (GDI32.338)
839 COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
841 COLORREF oldColor;
842 DC * dc = DC_GetDCPtr( hdc );
844 if (!dc) return 0x80000000;
845 if (dc->funcs->pSetTextColor)
846 oldColor = dc->funcs->pSetTextColor(dc, color);
847 else {
848 oldColor = dc->w.textColor;
849 dc->w.textColor = color;
851 GDI_HEAP_UNLOCK( hdc );
852 return oldColor;
855 /***********************************************************************
856 * SetTextAlign16 (GDI.346)
858 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
860 return SetTextAlign( hdc, align );
864 /***********************************************************************
865 * SetTextAlign (GDI32.336)
867 UINT WINAPI SetTextAlign( HDC hdc, UINT align )
869 UINT prevAlign;
870 DC *dc = DC_GetDCPtr( hdc );
871 if (!dc) return 0x0;
872 if (dc->funcs->pSetTextAlign)
873 prevAlign = dc->funcs->pSetTextAlign(dc, align);
874 else {
875 prevAlign = dc->w.textAlign;
876 dc->w.textAlign = align;
878 GDI_HEAP_UNLOCK( hdc );
879 return prevAlign;
882 /***********************************************************************
883 * GetDCOrgEx (GDI32.168)
885 BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp )
887 DC * dc;
889 if (!lpp) return FALSE;
890 if (!(dc = (DC *) GDI_GetObjPtr( hDC, DC_MAGIC ))) return FALSE;
892 lpp->x = lpp->y = 0;
893 if (dc->funcs->pGetDCOrgEx) dc->funcs->pGetDCOrgEx( dc, lpp );
894 lpp->x += dc->w.DCOrgX;
895 lpp->y += dc->w.DCOrgY;
896 GDI_HEAP_UNLOCK( hDC );
897 return TRUE;
901 /***********************************************************************
902 * GetDCOrg (GDI.79)
904 DWORD WINAPI GetDCOrg16( HDC16 hdc )
906 POINT pt;
907 if( GetDCOrgEx( hdc, &pt) )
908 return MAKELONG( (WORD)pt.x, (WORD)pt.y );
909 return 0;
913 /***********************************************************************
914 * SetDCOrg (GDI.117)
916 DWORD WINAPI SetDCOrg16( HDC16 hdc, INT16 x, INT16 y )
918 DWORD prevOrg;
919 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
920 if (!dc) return 0;
921 prevOrg = dc->w.DCOrgX | (dc->w.DCOrgY << 16);
922 dc->w.DCOrgX = x;
923 dc->w.DCOrgY = y;
924 GDI_HEAP_UNLOCK( hdc );
925 return prevOrg;
929 /***********************************************************************
930 * GetGraphicsMode (GDI32.188)
932 INT WINAPI GetGraphicsMode( HDC hdc )
934 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
935 if (!dc) return 0;
936 return dc->w.GraphicsMode;
940 /***********************************************************************
941 * SetGraphicsMode (GDI32.317)
943 INT WINAPI SetGraphicsMode( HDC hdc, INT mode )
945 INT ret;
946 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
948 /* One would think that setting the graphics mode to GM_COMPATIBLE
949 * would also reset the world transformation matrix to the unity
950 * matrix. However, in Windows, this is not the case. This doesn't
951 * make a lot of sense to me, but that's the way it is.
954 if (!dc) return 0;
955 if ((mode <= 0) || (mode > GM_LAST)) return 0;
956 ret = dc->w.GraphicsMode;
957 dc->w.GraphicsMode = mode;
958 return ret;
962 /***********************************************************************
963 * GetArcDirection16 (GDI.524)
965 INT16 WINAPI GetArcDirection16( HDC16 hdc )
967 return GetArcDirection( (HDC)hdc );
971 /***********************************************************************
972 * GetArcDirection (GDI32.141)
974 INT WINAPI GetArcDirection( HDC hdc )
976 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
978 if (!dc)
979 return 0;
981 return dc->w.ArcDirection;
985 /***********************************************************************
986 * SetArcDirection16 (GDI.525)
988 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
990 return SetArcDirection( (HDC)hdc, (INT)nDirection );
994 /***********************************************************************
995 * SetArcDirection (GDI32.302)
997 INT WINAPI SetArcDirection( HDC hdc, INT nDirection )
999 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
1000 INT nOldDirection;
1002 if (!dc)
1003 return 0;
1005 if (nDirection!=AD_COUNTERCLOCKWISE && nDirection!=AD_CLOCKWISE)
1007 SetLastError(ERROR_INVALID_PARAMETER);
1008 return 0;
1011 nOldDirection = dc->w.ArcDirection;
1012 dc->w.ArcDirection = nDirection;
1014 return nOldDirection;
1018 /***********************************************************************
1019 * GetWorldTransform (GDI32.244)
1021 BOOL WINAPI GetWorldTransform( HDC hdc, LPXFORM xform )
1023 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
1025 if (!dc)
1026 return FALSE;
1027 if (!xform)
1028 return FALSE;
1030 *xform = dc->w.xformWorld2Wnd;
1032 return TRUE;
1036 /***********************************************************************
1037 * SetWorldTransform (GDI32.346)
1039 BOOL WINAPI SetWorldTransform( HDC hdc, const XFORM *xform )
1041 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
1043 if (!dc)
1045 SetLastError( ERROR_INVALID_HANDLE );
1046 return FALSE;
1049 if (!xform)
1050 return FALSE;
1052 /* Check that graphics mode is GM_ADVANCED */
1053 if (dc->w.GraphicsMode!=GM_ADVANCED)
1054 return FALSE;
1056 dc->w.xformWorld2Wnd = *xform;
1058 DC_UpdateXforms( dc );
1060 return TRUE;
1064 /****************************************************************************
1065 * ModifyWorldTransform [GDI32.253]
1066 * Modifies the world transformation for a device context.
1068 * PARAMS
1069 * hdc [I] Handle to device context
1070 * xform [I] XFORM structure that will be used to modify the world
1071 * transformation
1072 * iMode [I] Specifies in what way to modify the world transformation
1073 * Possible values:
1074 * MWT_IDENTITY
1075 * Resets the world transformation to the identity matrix.
1076 * The parameter xform is ignored.
1077 * MWT_LEFTMULTIPLY
1078 * Multiplies xform into the world transformation matrix from
1079 * the left.
1080 * MWT_RIGHTMULTIPLY
1081 * Multiplies xform into the world transformation matrix from
1082 * the right.
1084 * RETURNS STD
1086 BOOL WINAPI ModifyWorldTransform( HDC hdc, const XFORM *xform,
1087 DWORD iMode )
1089 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
1091 /* Check for illegal parameters */
1092 if (!dc)
1094 SetLastError( ERROR_INVALID_HANDLE );
1095 return FALSE;
1097 if (!xform)
1098 return FALSE;
1100 /* Check that graphics mode is GM_ADVANCED */
1101 if (dc->w.GraphicsMode!=GM_ADVANCED)
1102 return FALSE;
1104 switch (iMode)
1106 case MWT_IDENTITY:
1107 dc->w.xformWorld2Wnd.eM11 = 1.0f;
1108 dc->w.xformWorld2Wnd.eM12 = 0.0f;
1109 dc->w.xformWorld2Wnd.eM21 = 0.0f;
1110 dc->w.xformWorld2Wnd.eM22 = 1.0f;
1111 dc->w.xformWorld2Wnd.eDx = 0.0f;
1112 dc->w.xformWorld2Wnd.eDy = 0.0f;
1113 break;
1114 case MWT_LEFTMULTIPLY:
1115 CombineTransform( &dc->w.xformWorld2Wnd, xform,
1116 &dc->w.xformWorld2Wnd );
1117 break;
1118 case MWT_RIGHTMULTIPLY:
1119 CombineTransform( &dc->w.xformWorld2Wnd, &dc->w.xformWorld2Wnd,
1120 xform );
1121 break;
1122 default:
1123 return FALSE;
1126 DC_UpdateXforms( dc );
1128 return TRUE;
1132 /****************************************************************************
1133 * CombineTransform [GDI32.20]
1134 * Combines two transformation matrices.
1136 * PARAMS
1137 * xformResult [O] Stores the result of combining the two matrices
1138 * xform1 [I] Specifies the first matrix to apply
1139 * xform2 [I] Specifies the second matrix to apply
1141 * REMARKS
1142 * The same matrix can be passed in for more than one of the parameters.
1144 * RETURNS STD
1146 BOOL WINAPI CombineTransform( LPXFORM xformResult, const XFORM *xform1,
1147 const XFORM *xform2 )
1149 XFORM xformTemp;
1151 /* Check for illegal parameters */
1152 if (!xformResult || !xform1 || !xform2)
1153 return FALSE;
1155 /* Create the result in a temporary XFORM, since xformResult may be
1156 * equal to xform1 or xform2 */
1157 xformTemp.eM11 = xform1->eM11 * xform2->eM11 +
1158 xform1->eM12 * xform2->eM21;
1159 xformTemp.eM12 = xform1->eM11 * xform2->eM12 +
1160 xform1->eM12 * xform2->eM22;
1161 xformTemp.eM21 = xform1->eM21 * xform2->eM11 +
1162 xform1->eM22 * xform2->eM21;
1163 xformTemp.eM22 = xform1->eM21 * xform2->eM12 +
1164 xform1->eM22 * xform2->eM22;
1165 xformTemp.eDx = xform1->eDx * xform2->eM11 +
1166 xform1->eDy * xform2->eM21 +
1167 xform2->eDx;
1168 xformTemp.eDy = xform1->eDx * xform2->eM12 +
1169 xform1->eDy * xform2->eM22 +
1170 xform2->eDy;
1172 /* Copy the result to xformResult */
1173 *xformResult = xformTemp;
1175 return TRUE;
1179 /***********************************************************************
1180 * SetDCHook (GDI.190)
1182 /* ### start build ### */
1183 extern WORD CALLBACK GDI_CallTo16_word_wwll(FARPROC16,WORD,WORD,LONG,LONG);
1184 /* ### stop build ### */
1185 BOOL16 WINAPI SetDCHook( HDC16 hdc, FARPROC16 hookProc, DWORD dwHookData )
1187 DC *dc = (DC *)GDI_GetObjPtr( hdc, DC_MAGIC );
1188 if (!dc) return FALSE;
1191 * Note: We store the original SEGPTR 'hookProc' as we need to be
1192 * able to return it verbatim in GetDCHook,
1194 * On the other hand, we still call THUNK_Alloc and store the
1195 * 32-bit thunk into another DC member, because THUNK_Alloc
1196 * recognizes the (typical) case that the 'hookProc' is indeed
1197 * the 16-bit API entry point of a built-in routine (e.g. DCHook16)
1199 * We could perform that test every time the hook is about to
1200 * be called (or else we could live with the 32->16->32 detour),
1201 * but this way is the most efficient ...
1204 dc->hookProc = hookProc;
1205 dc->dwHookData = dwHookData;
1207 THUNK_Free( (FARPROC)dc->hookThunk );
1208 dc->hookThunk = (DCHOOKPROC)
1209 THUNK_Alloc( hookProc, (RELAY)GDI_CallTo16_word_wwll );
1211 GDI_HEAP_UNLOCK( hdc );
1212 return TRUE;
1216 /***********************************************************************
1217 * GetDCHook (GDI.191)
1219 DWORD WINAPI GetDCHook( HDC16 hdc, FARPROC16 *phookProc )
1221 DC *dc = (DC *)GDI_GetObjPtr( hdc, DC_MAGIC );
1222 if (!dc) return 0;
1223 *phookProc = dc->hookProc;
1224 GDI_HEAP_UNLOCK( hdc );
1225 return dc->dwHookData;
1229 /***********************************************************************
1230 * SetHookFlags (GDI.192)
1232 WORD WINAPI SetHookFlags16(HDC16 hDC, WORD flags)
1234 DC* dc = (DC*)GDI_GetObjPtr( hDC, DC_MAGIC );
1236 if( dc )
1238 WORD wRet = dc->w.flags & DC_DIRTY;
1240 /* "Undocumented Windows" info is slightly confusing.
1243 TRACE("hDC %04x, flags %04x\n",hDC,flags);
1245 if( flags & DCHF_INVALIDATEVISRGN )
1246 dc->w.flags |= DC_DIRTY;
1247 else if( flags & DCHF_VALIDATEVISRGN || !flags )
1248 dc->w.flags &= ~DC_DIRTY;
1249 GDI_HEAP_UNLOCK( hDC );
1250 return wRet;
1252 return 0;
1255 /***********************************************************************
1256 * SetICMMode (GDI32.318)
1258 INT WINAPI SetICMMode(HDC hdc, INT iEnableICM)
1260 /*FIXME Asuming that ICM is always off, and cannot be turned on */
1261 if (iEnableICM == ICM_OFF) return ICM_OFF;
1262 if (iEnableICM == ICM_ON) return 0;
1263 if (iEnableICM == ICM_QUERY) return ICM_OFF;
1264 return 0;
1268 /***********************************************************************
1269 * GetColorSpace (GDI32.165)
1271 HCOLORSPACE WINAPI GetColorSpace(HDC hdc)
1273 /*FIXME Need to to whatever GetColorSpace actually does */
1274 return 0;
1277 /***********************************************************************
1278 * CreateColorSpaceA (GDI32.???)
1280 HCOLORSPACE WINAPI CreateColorSpaceA( LPLOGCOLORSPACEA lpLogColorSpace )
1282 FIXME( "stub\n" );
1283 return 0;
1286 /***********************************************************************
1287 * CreateColorSpaceW (GDI32.???)
1289 HCOLORSPACE WINAPI CreateColorSpaceW( LPLOGCOLORSPACEW lpLogColorSpace )
1291 FIXME( "stub\n" );
1292 return 0;
1295 /***********************************************************************
1296 * DeleteColorSpace (GDI32.???)
1298 BOOL WINAPI DeleteColorSpace( HCOLORSPACE hColorSpace )
1300 FIXME( "stub\n" );
1302 return TRUE;
1305 /***********************************************************************
1306 * SetColorSpace (GDI32.???)
1308 HCOLORSPACE WINAPI SetColorSpace( HDC hDC, HCOLORSPACE hColorSpace )
1310 FIXME( "stub\n" );
1312 return hColorSpace;
1315 /***********************************************************************
1316 * GetBoundsRect16 (GDI.194)
1318 UINT16 WINAPI GetBoundsRect16(HDC16 hdc, LPRECT16 rect, UINT16 flags)
1320 return DCB_RESET | DCB_DISABLE; /* bounding rectangle always empty and disabled*/
1323 /***********************************************************************
1324 * GetBoundsRect (GDI32.147)
1326 UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
1328 FIXME("(): stub\n");
1329 return DCB_RESET; /* bounding rectangle always empty */
1332 /***********************************************************************
1333 * SetBoundsRect16 (GDI.193)
1335 UINT16 WINAPI SetBoundsRect16(HDC16 hdc, const RECT16* rect, UINT16 flags)
1337 if ( (flags & DCB_ACCUMULATE) || (flags & DCB_ENABLE) )
1338 FIXME("(%04x, %p, %04x): stub\n", hdc, rect, flags );
1340 return DCB_RESET | DCB_DISABLE; /* bounding rectangle always empty and disabled*/
1343 /***********************************************************************
1344 * SetBoundsRect (GDI32.307)
1346 UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
1348 FIXME("(): stub\n");
1349 return DCB_DISABLE; /* bounding rectangle always empty */
1353 /***********************************************************************
1354 * GetRelAbs (GDI32.218)
1356 INT WINAPI GetRelAbs( HDC hdc, DWORD dwIgnore )
1358 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
1359 if (!dc) return 0;
1360 return dc->w.relAbsMode;
1363 /***********************************************************************
1364 * Death (GDI.121)
1366 * Disables GDI, switches back to text mode.
1367 * We don't have to do anything here,
1368 * just let console support handle everything
1370 void WINAPI Death16(HDC16 hDC)
1372 MESSAGE("Death(%04x) called. Application enters text mode...\n", hDC);
1375 /***********************************************************************
1376 * Resurrection (GDI.122)
1378 * Restores GDI functionality
1380 void WINAPI Resurrection16(HDC16 hDC,
1381 WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1383 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n", hDC, w1, w2, w3, w4, w5, w6);
1386 /***********************************************************************
1387 * GetLayout (GDI32.321)
1389 * Gets left->right or right->left text layout flags of a dc.
1390 * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same
1393 DWORD WINAPI GetLayout(HDC hdc)
1395 FIXME("(%08x): stub\n", hdc);
1396 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1397 return 0;
1400 /***********************************************************************
1401 * SetLayout (GDI32.450)
1403 * Sets left->right or right->left text layout flags of a dc.
1404 * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same
1407 DWORD WINAPI SetLayout(HDC hdc, DWORD layout)
1409 FIXME("(%08x,%08lx): stub\n", hdc, layout);
1410 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1411 return 0;