2 * Enhanced MetaFile driver graphics functions
4 * Copyright 1999 Huw D M Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wine/port.h"
28 #include "enhmfdrv/enhmetafiledrv.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile);
33 /**********************************************************************
37 EMFDRV_MoveTo(PHYSDEV dev, INT x, INT y)
41 emr.emr.iType = EMR_MOVETOEX;
42 emr.emr.nSize = sizeof(emr);
46 return EMFDRV_WriteRecord( dev, &emr.emr );
49 /***********************************************************************
53 EMFDRV_LineTo( PHYSDEV dev, INT x, INT y )
58 EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
60 emr.emr.iType = EMR_LINETO;
61 emr.emr.nSize = sizeof(emr);
65 if(!EMFDRV_WriteRecord( dev, &emr.emr ))
68 GetCurrentPositionEx(physDev->hdc, &pt);
70 bounds.left = min(x, pt.x);
71 bounds.top = min(y, pt.y);
72 bounds.right = max(x, pt.x);
73 bounds.bottom = max(y, pt.y);
75 EMFDRV_UpdateBBox( dev, &bounds );
81 /***********************************************************************
85 EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
86 INT xstart, INT ystart, INT xend, INT yend, DWORD iType )
88 INT temp, xCentre, yCentre, i;
89 double angleStart, angleEnd;
90 double xinterStart, yinterStart, xinterEnd, yinterEnd;
93 EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
95 if(left == right || top == bottom) return FALSE;
97 if(left > right) {temp = left; left = right; right = temp;}
98 if(top > bottom) {temp = top; top = bottom; bottom = temp;}
100 if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) {
105 emr.emr.iType = iType;
106 emr.emr.nSize = sizeof(emr);
107 emr.rclBox.left = left;
108 emr.rclBox.top = top;
109 emr.rclBox.right = right;
110 emr.rclBox.bottom = bottom;
111 emr.ptlStart.x = xstart;
112 emr.ptlStart.y = ystart;
117 /* Now calculate the BBox */
118 xCentre = (left + right + 1) / 2;
119 yCentre = (top + bottom + 1) / 2;
126 /* invert y co-ords to get angle anti-clockwise from x-axis */
127 angleStart = atan2( -(double)ystart, (double)xstart);
128 angleEnd = atan2( -(double)yend, (double)xend);
130 /* These are the intercepts of the start/end lines with the arc */
132 xinterStart = (right - left + 1)/2 * cos(angleStart) + xCentre;
133 yinterStart = -(bottom - top + 1)/2 * sin(angleStart) + yCentre;
134 xinterEnd = (right - left + 1)/2 * cos(angleEnd) + xCentre;
135 yinterEnd = -(bottom - top + 1)/2 * sin(angleEnd) + yCentre;
137 if(angleStart < 0) angleStart += 2 * M_PI;
138 if(angleEnd < 0) angleEnd += 2 * M_PI;
139 if(angleEnd < angleStart) angleEnd += 2 * M_PI;
141 bounds.left = min(xinterStart, xinterEnd);
142 bounds.top = min(yinterStart, yinterEnd);
143 bounds.right = max(xinterStart, xinterEnd);
144 bounds.bottom = max(yinterStart, yinterEnd);
146 for(i = 0; i <= 8; i++) {
147 if(i * M_PI / 2 < angleStart) /* loop until we're past start */
149 if(i * M_PI / 2 > angleEnd) /* if we're past end we're finished */
152 /* the arc touches the rectangle at the start of quadrant i, so adjust
153 BBox to reflect this. */
157 bounds.right = right;
166 bounds.bottom = bottom;
171 /* If we're drawing a pie then make sure we include the centre */
172 if(iType == EMR_PIE) {
173 if(bounds.left > xCentre) bounds.left = xCentre;
174 else if(bounds.right < xCentre) bounds.right = xCentre;
175 if(bounds.top > yCentre) bounds.top = yCentre;
176 else if(bounds.bottom < yCentre) bounds.right = yCentre;
178 if(!EMFDRV_WriteRecord( dev, &emr.emr ))
180 EMFDRV_UpdateBBox( dev, &bounds );
185 /***********************************************************************
189 EMFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
190 INT xstart, INT ystart, INT xend, INT yend )
192 return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart,
193 xend, yend, EMR_ARC );
196 /***********************************************************************
200 EMFDRV_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
201 INT xstart, INT ystart, INT xend, INT yend )
203 return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart,
204 xend, yend, EMR_PIE );
208 /***********************************************************************
212 EMFDRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
213 INT xstart, INT ystart, INT xend, INT yend )
215 return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart,
216 xend, yend, EMR_CHORD );
219 /***********************************************************************
223 EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
227 EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
229 TRACE("%d,%d - %d,%d\n", left, top, right, bottom);
231 if(left == right || top == bottom) return FALSE;
233 if(left > right) {temp = left; left = right; right = temp;}
234 if(top > bottom) {temp = top; top = bottom; bottom = temp;}
236 if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) {
241 emr.emr.iType = EMR_ELLIPSE;
242 emr.emr.nSize = sizeof(emr);
243 emr.rclBox.left = left;
244 emr.rclBox.top = top;
245 emr.rclBox.right = right;
246 emr.rclBox.bottom = bottom;
248 EMFDRV_UpdateBBox( dev, &emr.rclBox );
249 return EMFDRV_WriteRecord( dev, &emr.emr );
252 /***********************************************************************
256 EMFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
260 EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
262 TRACE("%d,%d - %d,%d\n", left, top, right, bottom);
264 if(left == right || top == bottom) return FALSE;
266 if(left > right) {temp = left; left = right; right = temp;}
267 if(top > bottom) {temp = top; top = bottom; bottom = temp;}
269 if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) {
274 emr.emr.iType = EMR_RECTANGLE;
275 emr.emr.nSize = sizeof(emr);
276 emr.rclBox.left = left;
277 emr.rclBox.top = top;
278 emr.rclBox.right = right;
279 emr.rclBox.bottom = bottom;
281 EMFDRV_UpdateBBox( dev, &emr.rclBox );
282 return EMFDRV_WriteRecord( dev, &emr.emr );
285 /***********************************************************************
289 EMFDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right,
290 INT bottom, INT ell_width, INT ell_height )
294 EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
296 if(left == right || top == bottom) return FALSE;
298 if(left > right) {temp = left; left = right; right = temp;}
299 if(top > bottom) {temp = top; top = bottom; bottom = temp;}
301 if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) {
306 emr.emr.iType = EMR_ROUNDRECT;
307 emr.emr.nSize = sizeof(emr);
308 emr.rclBox.left = left;
309 emr.rclBox.top = top;
310 emr.rclBox.right = right;
311 emr.rclBox.bottom = bottom;
312 emr.szlCorner.cx = ell_width;
313 emr.szlCorner.cy = ell_height;
315 EMFDRV_UpdateBBox( dev, &emr.rclBox );
316 return EMFDRV_WriteRecord( dev, &emr.emr );
319 /***********************************************************************
323 EMFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
327 emr.emr.iType = EMR_SETPIXELV;
328 emr.emr.nSize = sizeof(emr);
333 if (EMFDRV_WriteRecord( dev, &emr.emr )) {
335 bounds.left = bounds.right = x;
336 bounds.top = bounds.bottom = y;
337 EMFDRV_UpdateBBox( dev, &bounds );
343 /**********************************************************************
346 * Helper for EMFDRV_Poly{line|gon}
349 EMFDRV_Polylinegon( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
356 size = sizeof(EMRPOLYLINE) + sizeof(POINTL) * (count - 1);
358 emr = HeapAlloc( GetProcessHeap(), 0, size );
359 emr->emr.iType = iType;
360 emr->emr.nSize = size;
362 emr->rclBounds.left = emr->rclBounds.right = pt[0].x;
363 emr->rclBounds.top = emr->rclBounds.bottom = pt[0].y;
365 for(i = 1; i < count; i++) {
366 if(pt[i].x < emr->rclBounds.left)
367 emr->rclBounds.left = pt[i].x;
368 else if(pt[i].x > emr->rclBounds.right)
369 emr->rclBounds.right = pt[i].x;
370 if(pt[i].y < emr->rclBounds.top)
371 emr->rclBounds.top = pt[i].y;
372 else if(pt[i].y > emr->rclBounds.bottom)
373 emr->rclBounds.bottom = pt[i].y;
377 memcpy(emr->aptl, pt, count * sizeof(POINTL));
379 ret = EMFDRV_WriteRecord( dev, &emr->emr );
381 EMFDRV_UpdateBBox( dev, &emr->rclBounds );
382 HeapFree( GetProcessHeap(), 0, emr );
387 /**********************************************************************
388 * EMFDRV_Polylinegon16
390 * Helper for EMFDRV_Poly{line|gon}
392 * This is not a legacy function!
393 * We are using SHORT integers to save space.
396 EMFDRV_Polylinegon16( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
403 /* check whether all points fit in the SHORT int POINT structure */
404 for(i = 0; i < count; i++) {
405 if( ((pt[i].x+0x8000) & ~0xffff ) ||
406 ((pt[i].y+0x8000) & ~0xffff ) )
410 size = sizeof(EMRPOLYLINE16) + sizeof(POINTS) * (count - 1);
412 emr = HeapAlloc( GetProcessHeap(), 0, size );
413 emr->emr.iType = iType;
414 emr->emr.nSize = size;
416 emr->rclBounds.left = emr->rclBounds.right = pt[0].x;
417 emr->rclBounds.top = emr->rclBounds.bottom = pt[0].y;
419 for(i = 1; i < count; i++) {
420 if(pt[i].x < emr->rclBounds.left)
421 emr->rclBounds.left = pt[i].x;
422 else if(pt[i].x > emr->rclBounds.right)
423 emr->rclBounds.right = pt[i].x;
424 if(pt[i].y < emr->rclBounds.top)
425 emr->rclBounds.top = pt[i].y;
426 else if(pt[i].y > emr->rclBounds.bottom)
427 emr->rclBounds.bottom = pt[i].y;
431 for(i = 0; i < count; i++ ) {
432 emr->apts[i].x = pt[i].x;
433 emr->apts[i].y = pt[i].y;
436 ret = EMFDRV_WriteRecord( dev, &emr->emr );
438 EMFDRV_UpdateBBox( dev, &emr->rclBounds );
439 HeapFree( GetProcessHeap(), 0, emr );
444 /**********************************************************************
448 EMFDRV_Polyline( PHYSDEV dev, const POINT* pt, INT count )
450 if( EMFDRV_Polylinegon16( dev, pt, count, EMR_POLYLINE16 ) )
452 return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYLINE );
455 /**********************************************************************
459 EMFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
461 if(count < 2) return FALSE;
462 if( EMFDRV_Polylinegon16( dev, pt, count, EMR_POLYGON16 ) )
464 return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYGON );
468 /**********************************************************************
469 * EMFDRV_PolyPolylinegon
471 * Helper for EMFDRV_PolyPoly{line|gon}
474 EMFDRV_PolyPolylinegon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polys,
477 EMRPOLYPOLYLINE *emr;
478 DWORD cptl = 0, poly, size;
484 bounds.left = bounds.right = pt[0].x;
485 bounds.top = bounds.bottom = pt[0].y;
488 for(poly = 0; poly < polys; poly++) {
489 cptl += counts[poly];
490 for(point = 0; point < counts[poly]; point++) {
491 if(bounds.left > pts->x) bounds.left = pts->x;
492 else if(bounds.right < pts->x) bounds.right = pts->x;
493 if(bounds.top > pts->y) bounds.top = pts->y;
494 else if(bounds.bottom < pts->y) bounds.bottom = pts->y;
499 size = sizeof(EMRPOLYPOLYLINE) + (polys - 1) * sizeof(DWORD) +
500 (cptl - 1) * sizeof(POINTL);
502 emr = HeapAlloc( GetProcessHeap(), 0, size );
504 emr->emr.iType = iType;
505 emr->emr.nSize = size;
506 emr->rclBounds = bounds;
509 memcpy(emr->aPolyCounts, counts, polys * sizeof(DWORD));
510 memcpy(emr->aPolyCounts + polys, pt, cptl * sizeof(POINTL));
511 ret = EMFDRV_WriteRecord( dev, &emr->emr );
513 EMFDRV_UpdateBBox( dev, &emr->rclBounds );
514 HeapFree( GetProcessHeap(), 0, emr );
518 /**********************************************************************
519 * EMFDRV_PolyPolyline
522 EMFDRV_PolyPolyline(PHYSDEV dev, const POINT* pt, const DWORD* counts, DWORD polys)
524 return EMFDRV_PolyPolylinegon( dev, pt, (const INT *)counts, polys,
528 /**********************************************************************
532 EMFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polys )
534 return EMFDRV_PolyPolylinegon( dev, pt, counts, polys, EMR_POLYPOLYGON );
538 /**********************************************************************
539 * EMFDRV_ExtFloodFill
542 EMFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType )
546 emr.emr.iType = EMR_EXTFLOODFILL;
547 emr.emr.nSize = sizeof(emr);
551 emr.iMode = fillType;
553 return EMFDRV_WriteRecord( dev, &emr.emr );
557 /*********************************************************************
560 BOOL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush )
563 DWORD size, rgnsize, index;
566 index = EMFDRV_CreateBrushIndirect( dev, hbrush );
567 if(!index) return FALSE;
569 rgnsize = GetRegionData( hrgn, 0, NULL );
570 size = rgnsize + offsetof(EMRFILLRGN,RgnData);
571 emr = HeapAlloc( GetProcessHeap(), 0, size );
573 GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
575 emr->emr.iType = EMR_FILLRGN;
576 emr->emr.nSize = size;
577 emr->rclBounds.left = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.left;
578 emr->rclBounds.top = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.top;
579 emr->rclBounds.right = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.right - 1;
580 emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
581 emr->cbRgnData = rgnsize;
582 emr->ihBrush = index;
584 ret = EMFDRV_WriteRecord( dev, &emr->emr );
586 EMFDRV_UpdateBBox( dev, &emr->rclBounds );
587 HeapFree( GetProcessHeap(), 0, emr );
590 /*********************************************************************
593 BOOL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
596 DWORD size, rgnsize, index;
599 index = EMFDRV_CreateBrushIndirect( dev, hbrush );
600 if(!index) return FALSE;
602 rgnsize = GetRegionData( hrgn, 0, NULL );
603 size = rgnsize + offsetof(EMRFRAMERGN,RgnData);
604 emr = HeapAlloc( GetProcessHeap(), 0, size );
606 GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
608 emr->emr.iType = EMR_FRAMERGN;
609 emr->emr.nSize = size;
610 emr->rclBounds.left = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.left;
611 emr->rclBounds.top = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.top;
612 emr->rclBounds.right = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.right - 1;
613 emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
614 emr->cbRgnData = rgnsize;
615 emr->ihBrush = index;
616 emr->szlStroke.cx = width;
617 emr->szlStroke.cy = height;
619 ret = EMFDRV_WriteRecord( dev, &emr->emr );
621 EMFDRV_UpdateBBox( dev, &emr->rclBounds );
622 HeapFree( GetProcessHeap(), 0, emr );
626 /*********************************************************************
627 * EMFDRV_PaintInvertRgn
629 * Helper for EMFDRV_{Paint|Invert}Rgn
631 static BOOL EMFDRV_PaintInvertRgn( PHYSDEV dev, HRGN hrgn, DWORD iType )
638 rgnsize = GetRegionData( hrgn, 0, NULL );
639 size = rgnsize + offsetof(EMRINVERTRGN,RgnData);
640 emr = HeapAlloc( GetProcessHeap(), 0, size );
642 GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
644 emr->emr.iType = iType;
645 emr->emr.nSize = size;
646 emr->rclBounds.left = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.left;
647 emr->rclBounds.top = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.top;
648 emr->rclBounds.right = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.right - 1;
649 emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
650 emr->cbRgnData = rgnsize;
652 ret = EMFDRV_WriteRecord( dev, &emr->emr );
654 EMFDRV_UpdateBBox( dev, &emr->rclBounds );
655 HeapFree( GetProcessHeap(), 0, emr );
659 /**********************************************************************
663 EMFDRV_PaintRgn( PHYSDEV dev, HRGN hrgn )
665 return EMFDRV_PaintInvertRgn( dev, hrgn, EMR_PAINTRGN );
668 /**********************************************************************
672 EMFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn )
674 return EMFDRV_PaintInvertRgn( dev, hrgn, EMR_INVERTRGN );
677 /**********************************************************************
681 EMFDRV_SetBkColor( PHYSDEV dev, COLORREF color )
685 emr.emr.iType = EMR_SETBKCOLOR;
686 emr.emr.nSize = sizeof(emr);
689 return EMFDRV_WriteRecord( dev, &emr.emr ) ? color : CLR_INVALID;
693 /**********************************************************************
694 * EMFDRV_SetTextColor
697 EMFDRV_SetTextColor( PHYSDEV dev, COLORREF color )
701 emr.emr.iType = EMR_SETTEXTCOLOR;
702 emr.emr.nSize = sizeof(emr);
705 return EMFDRV_WriteRecord( dev, &emr.emr ) ? color : CLR_INVALID;
708 /**********************************************************************
711 BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
712 const RECT *lprect, LPCWSTR str, UINT count,
715 EMREXTTEXTOUTW *pemr;
718 EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
721 const UINT textAlign = GetTextAlign(physDev->hdc);
723 nSize = sizeof(*pemr) + ((count+1) & ~1) * sizeof(WCHAR) + count * sizeof(INT);
725 TRACE("%s count %d nSize = %ld\n", debugstr_wn(str, count), count, nSize);
726 pemr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nSize);
728 pemr->emr.iType = EMR_EXTTEXTOUTW;
729 pemr->emr.nSize = nSize;
731 pemr->iGraphicsMode = GetGraphicsMode(physDev->hdc);
732 pemr->exScale = pemr->eyScale = 1.0; /* FIXME */
734 pemr->emrtext.ptlReference.x = x;
735 pemr->emrtext.ptlReference.y = y;
736 pemr->emrtext.nChars = count;
737 pemr->emrtext.offString = sizeof(*pemr);
738 memcpy((char*)pemr + pemr->emrtext.offString, str, count * sizeof(WCHAR));
739 pemr->emrtext.fOptions = flags;
741 pemr->emrtext.rcl.left = pemr->emrtext.rcl.top = 0;
742 pemr->emrtext.rcl.right = pemr->emrtext.rcl.bottom = -1;
744 pemr->emrtext.rcl.left = lprect->left;
745 pemr->emrtext.rcl.top = lprect->top;
746 pemr->emrtext.rcl.right = lprect->right;
747 pemr->emrtext.rcl.bottom = lprect->bottom;
750 pemr->emrtext.offDx = pemr->emrtext.offString + ((count+1) & ~1) * sizeof(WCHAR);
754 memcpy((char*)pemr + pemr->emrtext.offDx, lpDx, count * sizeof(INT));
755 for (i = 0; i < count; i++) {
756 textWidth += lpDx[i];
758 GetTextExtentPoint32W(physDev->hdc, str, count, &strSize);
759 textHeight = strSize.cy;
763 INT *dx = (INT *)((char*)pemr + pemr->emrtext.offDx);
765 for (i = 0; i < count; i++) {
766 GetTextExtentPoint32W(physDev->hdc, str + i, 1, &charSize);
768 textWidth += charSize.cx;
769 textHeight = max(textHeight, charSize.cy);
773 switch (textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER)) {
775 pemr->rclBounds.left = x - (textWidth / 2) - 1;
776 pemr->rclBounds.right = x + (textWidth / 2) + 1;
780 pemr->rclBounds.left = x - textWidth - 1;
781 pemr->rclBounds.right = x;
784 default: { /* TA_LEFT */
785 pemr->rclBounds.left = x;
786 pemr->rclBounds.right = x + textWidth + 1;
790 switch (textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE)) {
793 GetTextMetricsW(physDev->hdc, &tm);
794 /* Play safe here... it's better to have a bounding box */
795 /* that is too big than too small. */
796 pemr->rclBounds.top = y - textHeight - 1;
797 pemr->rclBounds.bottom = y + tm.tmDescent + 1;
801 pemr->rclBounds.top = y - textHeight - 1;
802 pemr->rclBounds.bottom = y;
805 default: { /* TA_TOP */
806 pemr->rclBounds.top = y;
807 pemr->rclBounds.bottom = y + textHeight + 1;
811 ret = EMFDRV_WriteRecord( dev, &pemr->emr );
813 EMFDRV_UpdateBBox( dev, &pemr->rclBounds );
814 HeapFree( GetProcessHeap(), 0, pemr );
818 /**********************************************************************
819 * EMFDRV_SetArcDirection
821 INT EMFDRV_SetArcDirection(PHYSDEV dev, INT arcDirection)
823 EMRSETARCDIRECTION emr;
825 emr.emr.iType = EMR_SETARCDIRECTION;
826 emr.emr.nSize = sizeof(emr);
827 emr.iArcDirection = arcDirection;
829 EMFDRV_WriteRecord(dev, &emr.emr);
831 /* We don't know the old arc direction and we don't care... */