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_LineTo( DC *dc, INT x, INT y )
21 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
23 points[0].x = dc->DCOrgX + XLPTODP( dc, dc->CursPosX );
24 points[0].y = dc->DCOrgY + YLPTODP( dc, dc->CursPosY );
25 points[1].x = dc->DCOrgX + XLPTODP( dc, x );
26 points[1].y = dc->DCOrgY + YLPTODP( dc, y );
27 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
28 OS_POLYLINE, 2, points,
31 win16drv_SegPtr_DrawMode, dc->hClipRgn);
39 /***********************************************************************
43 WIN16DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
45 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
49 TRACE("In WIN16DRV_Rectangle, x %d y %d DCOrgX %d y %d\n",
50 left, top, dc->DCOrgX, dc->DCOrgY);
51 TRACE("In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
52 dc->vportOrgX, dc->vportOrgY);
53 points[0].x = XLPTODP(dc, left);
54 points[0].y = YLPTODP(dc, top);
56 points[1].x = XLPTODP(dc, right);
57 points[1].y = YLPTODP(dc, bottom);
58 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
59 OS_RECTANGLE, 2, points,
62 win16drv_SegPtr_DrawMode, dc->hClipRgn);
69 /***********************************************************************
73 WIN16DRV_Polygon(DC *dc, const POINT* pt, INT count )
75 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
80 if(count < 2) return TRUE;
81 if(pt[0].x != pt[count-1].x || pt[0].y != pt[count-1].y)
82 count++; /* Ensure polygon is closed */
84 points = HeapAlloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
85 if(points == NULL) return FALSE;
87 for (i = 0; i < count - 1; i++)
89 points[i].x = XLPTODP( dc, pt[i].x );
90 points[i].y = YLPTODP( dc, pt[i].y );
92 points[count-1].x = points[0].x;
93 points[count-1].y = points[0].y;
94 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
95 OS_WINDPOLYGON, count, points,
98 win16drv_SegPtr_DrawMode, dc->hClipRgn);
99 HeapFree( GetProcessHeap(), 0, points );
104 /***********************************************************************
108 WIN16DRV_Polyline(DC *dc, const POINT* pt, INT count )
110 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
115 if(count < 2) return TRUE;
117 points = HeapAlloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
118 if(points == NULL) return FALSE;
120 for (i = 0; i < count; i++)
122 points[i].x = XLPTODP( dc, pt[i].x );
123 points[i].y = YLPTODP( dc, pt[i].y );
125 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
126 OS_POLYLINE, count, points,
129 win16drv_SegPtr_DrawMode, dc->hClipRgn);
130 HeapFree( GetProcessHeap(), 0, points );
136 /***********************************************************************
140 WIN16DRV_Ellipse(DC *dc, INT left, INT top, INT right, INT bottom)
142 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
145 TRACE("In WIN16DRV_Ellipse, x %d y %d DCOrgX %d y %d\n",
146 left, top, dc->DCOrgX, dc->DCOrgY);
147 TRACE("In WIN16DRV_Ellipse, VPortOrgX %d y %d\n",
148 dc->vportOrgX, dc->vportOrgY);
149 points[0].x = XLPTODP(dc, left);
150 points[0].y = YLPTODP(dc, top);
152 points[1].x = XLPTODP(dc, right);
153 points[1].y = YLPTODP(dc, bottom);
155 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
156 OS_ELLIPSE, 2, points,
159 win16drv_SegPtr_DrawMode, dc->hClipRgn);