2 * Windows 16 bit device driver graphics functions
4 * Copyright 1997 John Harvey
10 #include "debugtools.h"
12 DEFAULT_DEBUG_CHANNEL(win16drv)
14 /**********************************************************************
18 WIN16DRV_MoveToEx(DC *dc,INT x,INT y,LPPOINT pt)
22 pt->x = dc->w.CursPosX;
23 pt->y = dc->w.CursPosY;
30 /***********************************************************************
34 WIN16DRV_LineTo( DC *dc, INT x, INT y )
37 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
39 points[0].x = dc->w.DCOrgX + XLPTODP( dc, dc->w.CursPosX );
40 points[0].y = dc->w.DCOrgY + YLPTODP( dc, dc->w.CursPosY );
41 points[1].x = dc->w.DCOrgX + XLPTODP( dc, x );
42 points[1].y = dc->w.DCOrgY + YLPTODP( dc, y );
43 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
44 OS_POLYLINE, 2, points,
47 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
55 /***********************************************************************
59 WIN16DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
61 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
65 TRACE("In WIN16DRV_Rectangle, x %d y %d DCOrgX %d y %d\n",
66 left, top, dc->w.DCOrgX, dc->w.DCOrgY);
67 TRACE("In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
68 dc->vportOrgX, dc->vportOrgY);
69 points[0].x = XLPTODP(dc, left);
70 points[0].y = YLPTODP(dc, top);
72 points[1].x = XLPTODP(dc, right);
73 points[1].y = YLPTODP(dc, bottom);
74 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
75 OS_RECTANGLE, 2, points,
78 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
85 /***********************************************************************
89 WIN16DRV_Polygon(DC *dc, const POINT* pt, INT count )
91 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
96 if(count < 2) return TRUE;
97 if(pt[0].x != pt[count-1].x || pt[0].y != pt[count-1].y)
98 count++; /* Ensure polygon is closed */
100 points = HEAP_xalloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
101 for (i = 0; i < count - 1; i++)
103 points[i].x = XLPTODP( dc, pt[i].x );
104 points[i].y = YLPTODP( dc, pt[i].y );
106 points[count-1].x = points[0].x;
107 points[count-1].y = points[0].y;
108 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
109 OS_WINDPOLYGON, count, points,
112 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
113 HeapFree( GetProcessHeap(), 0, points );
118 /***********************************************************************
122 WIN16DRV_Polyline(DC *dc, const POINT* pt, INT count )
124 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
129 if(count < 2) return TRUE;
131 points = HEAP_xalloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
132 for (i = 0; i < count; i++)
134 points[i].x = XLPTODP( dc, pt[i].x );
135 points[i].y = YLPTODP( dc, pt[i].y );
137 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
138 OS_POLYLINE, count, points,
141 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
142 HeapFree( GetProcessHeap(), 0, points );
148 /***********************************************************************
152 WIN16DRV_Ellipse(DC *dc, INT left, INT top, INT right, INT bottom)
154 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
157 TRACE("In WIN16DRV_Ellipse, x %d y %d DCOrgX %d y %d\n",
158 left, top, dc->w.DCOrgX, dc->w.DCOrgY);
159 TRACE("In WIN16DRV_Ellipse, VPortOrgX %d y %d\n",
160 dc->vportOrgX, dc->vportOrgY);
161 points[0].x = XLPTODP(dc, left);
162 points[0].y = YLPTODP(dc, top);
164 points[1].x = XLPTODP(dc, right);
165 points[1].y = YLPTODP(dc, bottom);
167 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
168 OS_ELLIPSE, 2, points,
171 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);