2 * Windows 16 bit device driver graphics functions
4 * Copyright 1997 John Harvey
12 /**********************************************************************
16 WIN16DRV_MoveToEx(DC *dc,INT x,INT y,LPPOINT pt)
20 pt->x = dc->w.CursPosX;
21 pt->y = dc->w.CursPosY;
28 /***********************************************************************
32 WIN16DRV_LineTo( DC *dc, INT x, INT y )
35 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
37 points[0].x = dc->w.DCOrgX + XLPTODP( dc, dc->w.CursPosX );
38 points[0].y = dc->w.DCOrgY + YLPTODP( dc, dc->w.CursPosY );
39 points[1].x = dc->w.DCOrgX + XLPTODP( dc, x );
40 points[1].y = dc->w.DCOrgY + YLPTODP( dc, y );
41 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
42 OS_POLYLINE, 2, points,
45 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
53 /***********************************************************************
57 WIN16DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
59 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
63 TRACE(win16drv, "In WIN16DRV_Rectangle, x %d y %d DCOrgX %d y %d\n",
64 left, top, dc->w.DCOrgX, dc->w.DCOrgY);
65 TRACE(win16drv, "In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
66 dc->vportOrgX, dc->vportOrgY);
67 points[0].x = XLPTODP(dc, left);
68 points[0].y = YLPTODP(dc, top);
70 points[1].x = XLPTODP(dc, right);
71 points[1].y = YLPTODP(dc, bottom);
72 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
73 OS_RECTANGLE, 2, points,
76 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
83 /***********************************************************************
87 WIN16DRV_Polygon(DC *dc, const POINT* pt, INT count )
89 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
94 if(count < 2) return TRUE;
95 if(pt[0].x != pt[count-1].x || pt[0].y != pt[count-1].y)
96 count++; /* Ensure polygon is closed */
98 points = HEAP_xalloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
99 for (i = 0; i < count - 1; i++)
101 points[i].x = XLPTODP( dc, pt[i].x );
102 points[i].y = YLPTODP( dc, pt[i].y );
104 points[count-1].x = points[0].x;
105 points[count-1].y = points[0].y;
106 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
107 OS_WINDPOLYGON, count, points,
110 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
111 HeapFree( GetProcessHeap(), 0, points );
116 /***********************************************************************
120 WIN16DRV_Polyline(DC *dc, const POINT* pt, INT count )
122 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
127 if(count < 2) return TRUE;
129 points = HEAP_xalloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
130 for (i = 0; i < count; i++)
132 points[i].x = XLPTODP( dc, pt[i].x );
133 points[i].y = YLPTODP( dc, pt[i].y );
135 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
136 OS_POLYLINE, count, points,
139 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
140 HeapFree( GetProcessHeap(), 0, points );
146 /***********************************************************************
150 WIN16DRV_Ellipse(DC *dc, INT left, INT top, INT right, INT bottom)
152 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
155 TRACE(win16drv, "In WIN16DRV_Ellipse, x %d y %d DCOrgX %d y %d\n",
156 left, top, dc->w.DCOrgX, dc->w.DCOrgY);
157 TRACE(win16drv, "In WIN16DRV_Ellipse, VPortOrgX %d y %d\n",
158 dc->vportOrgX, dc->vportOrgY);
159 points[0].x = XLPTODP(dc, left);
160 points[0].y = YLPTODP(dc, top);
162 points[1].x = XLPTODP(dc, right);
163 points[1].y = YLPTODP(dc, bottom);
165 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
166 OS_ELLIPSE, 2, points,
169 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);