Fixed GetOpenFileName and GetSaveFileName dialogs.
[wine/testsucceed.git] / graphics / psdrv / graphics.c
blob70a84ce69df3bb6d265eab8cfc00893c2ea578cd
1 /*
2 * PostScript driver graphics functions
4 * Copyright 1998 Huw D M Davies
6 */
7 #include <string.h>
8 #include "windows.h"
9 #include "psdrv.h"
10 #include "debug.h"
11 #include "print.h"
13 /**********************************************************************
14 * PSDRV_MoveToEx
16 BOOL32 PSDRV_MoveToEx(DC *dc, INT32 x, INT32 y, LPPOINT32 pt)
18 TRACE(psdrv, "%d %d\n", x, y);
19 if (pt)
21 pt->x = dc->w.CursPosX;
22 pt->y = dc->w.CursPosY;
24 dc->w.CursPosX = x;
25 dc->w.CursPosY = y;
27 return TRUE;
30 /***********************************************************************
31 * PSDRV_LineTo
33 BOOL32 PSDRV_LineTo(DC *dc, INT32 x, INT32 y)
35 TRACE(psdrv, "%d %d\n", x, y);
37 PSDRV_SetPen(dc);
38 PSDRV_WriteMoveTo(dc, XLPTODP(dc, dc->w.CursPosX),
39 YLPTODP(dc, dc->w.CursPosY));
40 PSDRV_WriteLineTo(dc, XLPTODP(dc, x), YLPTODP(dc, y));
41 PSDRV_WriteStroke(dc);
43 dc->w.CursPosX = x;
44 dc->w.CursPosY = y;
45 return TRUE;
48 /***********************************************************************
49 * PSDRV_Rectangle
51 BOOL32 PSDRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right,
52 INT32 bottom)
54 INT32 width = XLSTODS(dc, right - left);
55 INT32 height = YLSTODS(dc, bottom - top);
58 TRACE(psdrv, "%d %d - %d %d\n", left, top, right, bottom);
60 PSDRV_WriteRectangle(dc, XLPTODP(dc, left), YLPTODP(dc, top),
61 width, height);
63 PSDRV_SetBrush(dc);
64 PSDRV_Writegsave(dc);
65 PSDRV_WriteFill(dc);
66 PSDRV_Writegrestore(dc);
67 PSDRV_SetPen(dc);
68 PSDRV_WriteStroke(dc);
69 return TRUE;
73 /***********************************************************************
74 * PSDRV_Ellipse
76 BOOL32 PSDRV_Ellipse( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
78 INT32 x, y, a, b;
80 TRACE(psdrv, "%d %d - %d %d\n", left, top, right, bottom);
82 x = XLPTODP(dc, (left + right)/2);
83 y = YLPTODP(dc, (top + bottom)/2);
85 a = XLSTODS(dc, (right - left)/2);
86 b = YLSTODS(dc, (bottom - top)/2);
88 PSDRV_WriteEllispe(dc, x, y, a, b);
89 PSDRV_SetBrush(dc);
90 PSDRV_Writegsave(dc);
91 PSDRV_WriteFill(dc);
92 PSDRV_Writegrestore(dc);
93 PSDRV_SetPen(dc);
94 PSDRV_WriteStroke(dc);
95 return TRUE;
99 /***********************************************************************
100 * PSDRV_Polyline
102 BOOL32 PSDRV_Polyline( DC *dc, const LPPOINT32 pt, INT32 count )
104 INT32 i;
105 TRACE(psdrv, "count = %d\n", count);
107 PSDRV_SetPen(dc);
108 PSDRV_WriteMoveTo(dc, XLPTODP(dc, pt[0].x), YLPTODP(dc, pt[0].y));
109 for(i = 1; i < count; i++)
110 PSDRV_WriteLineTo(dc, XLPTODP(dc, pt[i].x), YLPTODP(dc, pt[i].y));
111 PSDRV_WriteStroke(dc);
112 return TRUE;
116 /***********************************************************************
117 * PSDRV_Polygon
119 BOOL32 PSDRV_Polygon( DC *dc, LPPOINT32 pt, INT32 count )
121 INT32 i;
122 TRACE(psdrv, "count = %d\n", count);
123 FIXME(psdrv, "Hack!\n");
125 PSDRV_SetPen(dc);
126 PSDRV_WriteMoveTo(dc, XLPTODP(dc, pt[0].x), YLPTODP(dc, pt[0].y));
127 for(i = 1; i < count; i++)
128 PSDRV_WriteLineTo(dc, XLPTODP(dc, pt[i].x), YLPTODP(dc, pt[i].y));
130 if(pt[0].x != pt[count-1].x || pt[0].y != pt[count-1].y)
131 PSDRV_WriteLineTo(dc, XLPTODP(dc, pt[0].x), YLPTODP(dc, pt[0].y));
133 PSDRV_WriteStroke(dc);
134 return TRUE;