2 * GDI Device Context functions
4 * Copyright 1993 Alexandre Julliard
19 static DeviceCaps
* displayDevCaps
= NULL
;
21 extern void CLIPPING_UpdateGCRegion( DC
* dc
); /* objects/clipping.c */
23 /* Default DC values */
24 static const WIN_DC_INFO DC_defaultValues
=
32 STOCK_BLACK_PEN
, /* hPen */
33 STOCK_WHITE_BRUSH
, /* hBrush */
34 STOCK_SYSTEM_FONT
, /* hFont */
38 STOCK_DEFAULT_PALETTE
, /* hPalette */
39 R2_COPYPEN
, /* ROPmode */
40 ALTERNATE
, /* polyFillMode */
41 BLACKONWHITE
, /* stretchBltMode */
42 ABSOLUTE
, /* relAbsMode */
43 OPAQUE
, /* backgroundMode */
44 RGB( 255, 255, 255 ), /* backgroundColor */
45 RGB( 0, 0, 0 ), /* textColor */
46 0, /* backgroundPixel */
50 TA_LEFT
| TA_TOP
| TA_NOUPDATECP
, /* textAlign */
52 0, /* breakTotalExtra */
57 MM_TEXT
, /* MapMode */
72 /* ROP code to GC function conversion */
73 const int DC_XROPfunction
[16] =
75 GXclear
, /* R2_BLACK */
76 GXnor
, /* R2_NOTMERGEPEN */
77 GXandInverted
, /* R2_MASKNOTPEN */
78 GXcopyInverted
, /* R2_NOTCOPYPEN */
79 GXandReverse
, /* R2_MASKPENNOT */
80 GXinvert
, /* R2_NOT */
81 GXxor
, /* R2_XORPEN */
82 GXnand
, /* R2_NOTMASKPEN */
83 GXand
, /* R2_MASKPEN */
84 GXequiv
, /* R2_NOTXORPEN */
86 GXorInverted
, /* R2_MERGENOTPEN */
87 GXcopy
, /* R2_COPYPEN */
88 GXorReverse
, /* R2_MERGEPENNOT */
89 GXor
, /* R2_MERGEPEN */
94 /***********************************************************************
97 * Fill the device caps structure.
99 void DC_FillDevCaps( DeviceCaps
* caps
)
101 caps
->version
= 0x300;
102 caps
->technology
= DT_RASDISPLAY
;
103 caps
->horzSize
= WidthMMOfScreen(screen
) * screenWidth
/ WidthOfScreen(screen
);
104 caps
->vertSize
= HeightMMOfScreen(screen
) * screenHeight
/ HeightOfScreen(screen
);
105 caps
->horzRes
= screenWidth
;
106 caps
->vertRes
= screenHeight
;
107 caps
->bitsPixel
= screenDepth
;
109 caps
->numBrushes
= 16+6; /* 16 solid + 6 hatched brushes */
110 caps
->numPens
= 16; /* 16 solid pens */
111 caps
->numMarkers
= 0;
113 caps
->numColors
= 1 << caps
->bitsPixel
;
114 caps
->pdeviceSize
= 0;
115 caps
->curveCaps
= CC_CIRCLES
| CC_PIE
| CC_CHORD
| CC_ELLIPSES
|
116 CC_WIDE
| CC_STYLED
| CC_WIDESTYLED
|
117 CC_INTERIORS
| CC_ROUNDRECT
;
118 caps
->lineCaps
= LC_POLYLINE
| LC_MARKER
| LC_POLYMARKER
| LC_WIDE
|
119 LC_STYLED
| LC_WIDESTYLED
| LC_INTERIORS
;
120 caps
->polygonalCaps
= PC_POLYGON
| PC_RECTANGLE
| PC_WINDPOLYGON
|
121 PC_SCANLINE
| PC_WIDE
| PC_STYLED
|
122 PC_WIDESTYLED
| PC_INTERIORS
;
123 caps
->textCaps
= TC_OP_CHARACTER
| TC_OP_STROKE
| TC_CP_STROKE
|
124 TC_IA_ABLE
| TC_UA_ABLE
| TC_SO_ABLE
| TC_RA_ABLE
;
125 caps
->clipCaps
= CP_REGION
;
126 caps
->rasterCaps
= RC_BITBLT
| RC_BANDING
| RC_SCALING
| RC_BITMAP64
|
127 RC_DI_BITMAP
| RC_PALETTE
| RC_DIBTODEV
| RC_BIGFONT
|
128 RC_STRETCHBLT
| RC_STRETCHDIB
| RC_DEVBITS
;
129 caps
->aspectX
= 36; /* ?? */
130 caps
->aspectY
= 36; /* ?? */
132 caps
->logPixelsX
= (int)(caps
->horzRes
* 25.4 / caps
->horzSize
);
133 caps
->logPixelsY
= (int)(caps
->vertRes
* 25.4 / caps
->vertSize
);
134 caps
->sizePalette
= DefaultVisual(display
,DefaultScreen(display
))->map_entries
;
135 caps
->numReserved
= 0;
140 /***********************************************************************
143 * Setup device-specific DC values for a newly created DC.
145 void DC_InitDC( HDC hdc
)
147 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
148 RealizeDefaultPalette( hdc
);
149 SetTextColor( hdc
, dc
->w
.textColor
);
150 SetBkColor( hdc
, dc
->w
.backgroundColor
);
151 SelectObject( hdc
, dc
->w
.hPen
);
152 SelectObject( hdc
, dc
->w
.hBrush
);
153 SelectObject( hdc
, dc
->w
.hFont
);
154 XSetGraphicsExposures( display
, dc
->u
.x
.gc
, False
);
155 XSetSubwindowMode( display
, dc
->u
.x
.gc
, IncludeInferiors
);
156 CLIPPING_UpdateGCRegion( dc
);
160 /***********************************************************************
161 * DC_SetupGCForPatBlt
163 * Setup the GC for a PatBlt operation using current brush.
164 * If fMapColors is TRUE, X pixels are mapped to Windows colors.
165 * Return FALSE if brush is BS_NULL, TRUE otherwise.
167 BOOL
DC_SetupGCForPatBlt( DC
* dc
, GC gc
, BOOL fMapColors
)
173 if (dc
->u
.x
.brush
.style
== BS_NULL
) return FALSE
;
174 if (dc
->u
.x
.brush
.pixel
== -1)
176 /* Special case used for monochrome pattern brushes.
177 * We need to swap foreground and background because
178 * Windows does it the wrong way...
180 val
.foreground
= dc
->w
.backgroundPixel
;
181 val
.background
= dc
->w
.textPixel
;
185 val
.foreground
= dc
->u
.x
.brush
.pixel
;
186 val
.background
= dc
->w
.backgroundPixel
;
188 if (fMapColors
&& COLOR_PixelToPalette
)
190 val
.foreground
= COLOR_PixelToPalette
[val
.foreground
];
191 val
.background
= COLOR_PixelToPalette
[val
.background
];
194 val
.function
= DC_XROPfunction
[dc
->w
.ROPmode
-1];
195 val
.fill_style
= dc
->u
.x
.brush
.fillStyle
;
196 switch(val
.fill_style
)
199 case FillOpaqueStippled
:
200 if (dc
->w
.backgroundMode
==OPAQUE
) val
.fill_style
= FillOpaqueStippled
;
201 val
.stipple
= dc
->u
.x
.brush
.pixmap
;
206 if (fMapColors
&& COLOR_PixelToPalette
)
210 pixmap
= XCreatePixmap( display
, rootWindow
, 8, 8, screenDepth
);
211 image
= XGetImage( display
, dc
->u
.x
.brush
.pixmap
, 0, 0, 8, 8,
212 AllPlanes
, ZPixmap
);
213 for (y
= 0; y
< 8; y
++)
214 for (x
= 0; x
< 8; x
++)
215 XPutPixel( image
, x
, y
,
216 COLOR_PixelToPalette
[XGetPixel( image
, x
, y
)] );
217 XPutImage( display
, pixmap
, gc
, image
, 0, 0, 0, 0, 8, 8 );
218 XDestroyImage( image
);
221 else val
.tile
= dc
->u
.x
.brush
.pixmap
;
229 val
.ts_x_origin
= dc
->w
.DCOrgX
+ dc
->w
.brushOrgX
;
230 val
.ts_y_origin
= dc
->w
.DCOrgY
+ dc
->w
.brushOrgY
;
231 val
.fill_rule
= (dc
->w
.polyFillMode
==WINDING
) ? WindingRule
: EvenOddRule
;
232 XChangeGC( display
, gc
,
233 GCFunction
| GCForeground
| GCBackground
| GCFillStyle
|
234 GCFillRule
| GCTileStipXOrigin
| GCTileStipYOrigin
| mask
,
236 if (pixmap
) XFreePixmap( display
, pixmap
);
241 /***********************************************************************
244 * Setup dc->u.x.gc for drawing operations using current brush.
245 * Return FALSE if brush is BS_NULL, TRUE otherwise.
247 BOOL
DC_SetupGCForBrush( DC
* dc
)
249 return DC_SetupGCForPatBlt( dc
, dc
->u
.x
.gc
, FALSE
);
253 /***********************************************************************
256 * Setup dc->u.x.gc for drawing operations using current pen.
257 * Return FALSE if pen is PS_NULL, TRUE otherwise.
259 BOOL
DC_SetupGCForPen( DC
* dc
)
263 if (dc
->u
.x
.pen
.style
== PS_NULL
) return FALSE
;
265 if ((screenDepth
<= 8) && /* FIXME: Should check for palette instead */
266 ((dc
->w
.ROPmode
== R2_BLACK
) || (dc
->w
.ROPmode
== R2_WHITE
)))
268 val
.function
= GXcopy
;
269 val
.foreground
= COLOR_ToPhysical( NULL
, (dc
->w
.ROPmode
== R2_BLACK
) ?
270 RGB(0,0,0) : RGB(255,255,255) );
274 val
.function
= DC_XROPfunction
[dc
->w
.ROPmode
-1];
275 val
.foreground
= dc
->u
.x
.pen
.pixel
;
277 val
.background
= dc
->w
.backgroundPixel
;
278 val
.fill_style
= FillSolid
;
279 if ((dc
->u
.x
.pen
.style
!=PS_SOLID
) && (dc
->u
.x
.pen
.style
!=PS_INSIDEFRAME
))
281 XSetDashes( display
, dc
->u
.x
.gc
, 0,
282 dc
->u
.x
.pen
.dashes
, dc
->u
.x
.pen
.dash_len
);
283 val
.line_style
= (dc
->w
.backgroundMode
== OPAQUE
) ?
284 LineDoubleDash
: LineOnOffDash
;
286 else val
.line_style
= LineSolid
;
287 val
.line_width
= dc
->u
.x
.pen
.width
;
288 val
.cap_style
= CapRound
;
289 val
.join_style
= JoinBevel
;
290 XChangeGC( display
, dc
->u
.x
.gc
,
291 GCFunction
| GCForeground
| GCBackground
| GCLineWidth
|
292 GCLineStyle
| GCCapStyle
| GCJoinStyle
| GCFillStyle
, &val
);
297 /***********************************************************************
300 * Setup dc->u.x.gc for text drawing operations.
301 * Return FALSE if the font is null, TRUE otherwise.
303 BOOL
DC_SetupGCForText( DC
* dc
)
307 if (!dc
->u
.x
.font
.fstruct
)
309 fprintf( stderr
, "DC_SetupGCForText: fstruct is NULL. Please report this\n" );
312 val
.function
= GXcopy
; /* Text is always GXcopy */
313 val
.foreground
= dc
->w
.textPixel
;
314 val
.background
= dc
->w
.backgroundPixel
;
315 val
.fill_style
= FillSolid
;
316 val
.font
= dc
->u
.x
.font
.fstruct
->fid
;
317 XChangeGC( display
, dc
->u
.x
.gc
,
318 GCFunction
| GCForeground
| GCBackground
| GCFillStyle
|
324 /***********************************************************************
325 * GetDCState (GDI.179)
327 HDC
GetDCState( HDC hdc
)
332 if (!(dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
))) return 0;
333 if (!(handle
= GDI_AllocObject( sizeof(DC
), DC_MAGIC
))) return 0;
334 newdc
= (DC
*) GDI_HEAP_LIN_ADDR( handle
);
336 dprintf_dc(stddeb
, "GetDCState(%04x): returning %04x\n", hdc
, handle
);
338 memset( &newdc
->u
.x
, 0, sizeof(newdc
->u
.x
) );
339 memcpy( &newdc
->w
, &dc
->w
, sizeof(dc
->w
) );
340 memcpy( &newdc
->u
.x
.pen
, &dc
->u
.x
.pen
, sizeof(dc
->u
.x
.pen
) );
341 newdc
->saveLevel
= 0;
342 newdc
->w
.flags
|= DC_SAVED
;
344 newdc
->w
.hGCClipRgn
= 0;
345 newdc
->w
.hVisRgn
= CreateRectRgn( 0, 0, 0, 0 );
346 CombineRgn( newdc
->w
.hVisRgn
, dc
->w
.hVisRgn
, 0, RGN_COPY
);
349 newdc
->w
.hClipRgn
= CreateRectRgn( 0, 0, 0, 0 );
350 CombineRgn( newdc
->w
.hClipRgn
, dc
->w
.hClipRgn
, 0, RGN_COPY
);
352 COLOR_SetMapping( newdc
, dc
->u
.x
.pal
.hMapping
,
353 dc
->u
.x
.pal
.hRevMapping
, dc
->u
.x
.pal
.mappingSize
);
358 /***********************************************************************
359 * SetDCState (GDI.180)
361 void SetDCState( HDC hdc
, HDC hdcs
)
364 HRGN hVisRgn
, hClipRgn
, hGCClipRgn
;
368 if (!(dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
))) return;
369 if (!(dcs
= (DC
*) GDI_GetObjPtr( hdcs
, DC_MAGIC
))) return;
370 if (!dcs
->w
.flags
& DC_SAVED
) return;
371 dprintf_dc(stddeb
, "SetDCState: %04x %04x\n", hdc
, hdcs
);
373 /* Save the regions, font & brush before overwriting everything */
374 hVisRgn
= dc
->w
.hVisRgn
;
375 hClipRgn
= dc
->w
.hClipRgn
;
376 hGCClipRgn
= dc
->w
.hGCClipRgn
;
378 hbrush
= dc
->w
.hBrush
;
379 memcpy( &dc
->w
, &dcs
->w
, sizeof(dc
->w
) );
380 memcpy( &dc
->u
.x
.pen
, &dcs
->u
.x
.pen
, sizeof(dc
->u
.x
.pen
) );
381 dc
->w
.flags
&= ~DC_SAVED
;
383 /* Restore the regions */
384 dc
->w
.hVisRgn
= hVisRgn
;
385 dc
->w
.hClipRgn
= hClipRgn
;
386 dc
->w
.hGCClipRgn
= hGCClipRgn
;
388 dc
->w
.hBrush
= hbrush
;
389 CombineRgn( dc
->w
.hVisRgn
, dcs
->w
.hVisRgn
, 0, RGN_COPY
);
390 SelectClipRgn( hdc
, dcs
->w
.hClipRgn
);
392 SelectObject( hdc
, dcs
->w
.hBrush
);
393 SelectObject( hdc
, dcs
->w
.hFont
);
394 COLOR_SetMapping( dc
, dcs
->u
.x
.pal
.hMapping
,
395 dcs
->u
.x
.pal
.hRevMapping
, dcs
->u
.x
.pal
.mappingSize
);
399 /***********************************************************************
402 int SaveDC( HDC hdc
)
407 dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
410 dc
= (DC
*)GDI_GetObjPtr(hdc
, METAFILE_DC_MAGIC
);
412 MF_MetaParam0(dc
, META_SAVEDC
);
415 if (!(hdcs
= GetDCState( hdc
))) return 0;
416 dcs
= (DC
*) GDI_HEAP_LIN_ADDR( hdcs
);
417 dcs
->header
.hNext
= dc
->header
.hNext
;
418 dc
->header
.hNext
= hdcs
;
419 dprintf_dc(stddeb
, "SaveDC(%04x): returning %d\n", hdc
, dc
->saveLevel
+1 );
420 return ++dc
->saveLevel
;
424 /***********************************************************************
427 BOOL
RestoreDC( HDC hdc
, short level
)
431 dprintf_dc(stddeb
, "RestoreDC: %04x %d\n", hdc
, level
);
432 dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
435 dc
= (DC
*)GDI_GetObjPtr(hdc
, METAFILE_DC_MAGIC
);
436 if (!dc
) return FALSE
;
437 if (level
!= -1) return FALSE
;
438 MF_MetaParam1(dc
, META_RESTOREDC
, level
);
441 if (level
== -1) level
= dc
->saveLevel
;
442 if ((level
< 1) || (level
> (short)dc
->saveLevel
)) return FALSE
;
444 while ((short)dc
->saveLevel
>= level
)
446 HDC hdcs
= dc
->header
.hNext
;
447 if (!(dcs
= (DC
*) GDI_GetObjPtr( hdcs
, DC_MAGIC
))) return FALSE
;
448 dc
->header
.hNext
= dcs
->header
.hNext
;
449 if ((short)--dc
->saveLevel
< level
) SetDCState( hdc
, hdcs
);
456 /***********************************************************************
459 HDC
CreateDC( LPCSTR driver
, LPCSTR device
, LPCSTR output
, const DEVMODE
* initData
)
464 handle
= GDI_AllocObject( sizeof(DC
), DC_MAGIC
);
465 if (!handle
) return 0;
466 dc
= (DC
*) GDI_HEAP_LIN_ADDR( handle
);
468 dprintf_dc(stddeb
, "CreateDC(%s %s %s): returning %04x\n",
469 driver
, device
, output
, handle
);
473 displayDevCaps
= (DeviceCaps
*) xmalloc( sizeof(DeviceCaps
) );
474 DC_FillDevCaps( displayDevCaps
);
478 memcpy( &dc
->w
, &DC_defaultValues
, sizeof(DC_defaultValues
) );
479 memset( &dc
->u
.x
, 0, sizeof(dc
->u
.x
) );
481 dc
->u
.x
.drawable
= rootWindow
;
482 dc
->u
.x
.gc
= XCreateGC( display
, dc
->u
.x
.drawable
, 0, NULL
);
484 dc
->w
.devCaps
= displayDevCaps
;
485 dc
->w
.bitsPerPixel
= displayDevCaps
->bitsPixel
;
486 dc
->w
.hVisRgn
= CreateRectRgn( 0, 0, displayDevCaps
->horzRes
,
487 displayDevCaps
->vertRes
);
490 GDI_HEAP_FREE( handle
);
500 /***********************************************************************
503 HDC
CreateIC( LPCSTR driver
, LPCSTR device
, LPCSTR output
, const DEVMODE
* initData
)
505 /* Nothing special yet for ICs */
506 return CreateDC( driver
, device
, output
, initData
);
510 /***********************************************************************
511 * CreateCompatibleDC (GDI.52)
513 HDC
CreateCompatibleDC( HDC hdc
)
520 handle
= GDI_AllocObject( sizeof(DC
), DC_MAGIC
);
521 if (!handle
) return 0;
522 dc
= (DC
*) GDI_HEAP_LIN_ADDR( handle
);
524 dprintf_dc(stddeb
, "CreateCompatibleDC(%04x): returning %04x\n", hdc
, handle
);
526 /* Create default bitmap */
527 if (!(hbitmap
= CreateBitmap( 1, 1, 1, 1, NULL
)))
529 GDI_HEAP_FREE( handle
);
532 bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hbitmap
, BITMAP_MAGIC
);
535 memcpy( &dc
->w
, &DC_defaultValues
, sizeof(DC_defaultValues
) );
536 memset( &dc
->u
.x
, 0, sizeof(dc
->u
.x
) );
538 dc
->u
.x
.drawable
= bmp
->pixmap
;
539 dc
->u
.x
.gc
= XCreateGC( display
, dc
->u
.x
.drawable
, 0, NULL
);
540 dc
->w
.flags
= DC_MEMORY
;
541 dc
->w
.bitsPerPixel
= 1;
542 dc
->w
.devCaps
= displayDevCaps
;
543 dc
->w
.hBitmap
= hbitmap
;
544 dc
->w
.hFirstBitmap
= hbitmap
;
545 dc
->w
.hVisRgn
= CreateRectRgn( 0, 0, 1, 1 );
549 DeleteObject( hbitmap
);
550 GDI_HEAP_FREE( handle
);
560 /***********************************************************************
563 BOOL
DeleteDC( HDC hdc
)
565 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
566 if (!dc
) return FALSE
;
568 dprintf_dc(stddeb
, "DeleteDC: %04x\n", hdc
);
570 while (dc
->saveLevel
)
573 HDC hdcs
= dc
->header
.hNext
;
574 if (!(dcs
= (DC
*) GDI_GetObjPtr( hdcs
, DC_MAGIC
))) break;
575 dc
->header
.hNext
= dcs
->header
.hNext
;
580 if (!(dc
->w
.flags
& DC_SAVED
))
582 SelectObject( hdc
, STOCK_BLACK_PEN
);
583 SelectObject( hdc
, STOCK_WHITE_BRUSH
);
584 SelectObject( hdc
, STOCK_SYSTEM_FONT
);
585 XFreeGC( display
, dc
->u
.x
.gc
);
588 if (dc
->w
.flags
& DC_MEMORY
) DeleteObject( dc
->w
.hFirstBitmap
);
589 if (dc
->w
.hClipRgn
) DeleteObject( dc
->w
.hClipRgn
);
590 if (dc
->w
.hVisRgn
) DeleteObject( dc
->w
.hVisRgn
);
591 if (dc
->w
.hGCClipRgn
) DeleteObject( dc
->w
.hGCClipRgn
);
593 return GDI_FreeObject( hdc
);
597 /***********************************************************************
600 HDC
ResetDC( HDC hdc
, /* DEVMODE */ void *devmode
)
602 fprintf( stderr
, "ResetDC: empty stub!\n" );
607 /***********************************************************************
608 * GetDeviceCaps (GDI.80)
610 int GetDeviceCaps( HDC hdc
, WORD cap
)
612 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
615 if (cap
> sizeof(DeviceCaps
)-sizeof(WORD
)) return 0;
617 dprintf_dc(stddeb
, "GetDeviceCaps(%04x,%d): returning %d\n",
618 hdc
, cap
, *(WORD
*)(((char *)dc
->w
.devCaps
) + cap
) );
619 return *(WORD
*)(((char *)dc
->w
.devCaps
) + cap
);
623 /***********************************************************************
626 COLORREF
SetBkColor( HDC hdc
, COLORREF color
)
629 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
632 dc
= (DC
*)GDI_GetObjPtr(hdc
, METAFILE_DC_MAGIC
);
633 if (!dc
) return 0x80000000;
634 MF_MetaParam2(dc
, META_SETBKCOLOR
, HIWORD(color
), LOWORD(color
));
638 oldColor
= dc
->w
.backgroundColor
;
639 dc
->w
.backgroundColor
= color
;
640 dc
->w
.backgroundPixel
= COLOR_ToPhysical( dc
, color
);
645 /***********************************************************************
646 * SetTextColor (GDI.9)
648 COLORREF
SetTextColor( HDC hdc
, COLORREF color
)
651 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
654 dc
= (DC
*)GDI_GetObjPtr(hdc
, METAFILE_DC_MAGIC
);
655 if (!dc
) return 0x80000000;
656 MF_MetaParam2(dc
, META_SETTEXTCOLOR
, HIWORD(color
), LOWORD(color
));
660 oldColor
= dc
->w
.textColor
;
661 dc
->w
.textColor
= color
;
662 dc
->w
.textPixel
= COLOR_ToPhysical( dc
, color
);
667 /***********************************************************************
668 * SetTextAlign (GDI.346)
670 WORD
SetTextAlign( HDC hdc
, WORD textAlign
)
673 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
676 if (!(dc
= (DC
*)GDI_GetObjPtr( hdc
, METAFILE_DC_MAGIC
))) return 0;
677 MF_MetaParam1( dc
, META_SETTEXTALIGN
, textAlign
);
680 prevAlign
= dc
->w
.textAlign
;
681 dc
->w
.textAlign
= textAlign
;
686 /***********************************************************************
689 DWORD
GetDCOrg( HDC hdc
)
692 int x
, y
, w
, h
, border
, depth
;
694 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
696 if (dc
->w
.flags
& DC_MEMORY
) return 0;
697 XGetGeometry( display
, dc
->u
.x
.drawable
, &root
,
698 &x
, &y
, &w
, &h
, &border
, &depth
);
699 return MAKELONG( dc
->w
.DCOrgX
+ (WORD
)x
, dc
->w
.DCOrgY
+ (WORD
)y
);
703 /***********************************************************************
706 DWORD
SetDCOrg( HDC hdc
, short x
, short y
)
709 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
711 prevOrg
= dc
->w
.DCOrgX
| (dc
->w
.DCOrgY
<< 16);