Commit da3511fd authored by Alexandre Julliard's avatar Alexandre Julliard

wineps: Implement PolyBezier using the Postscript curveto function.

parent 996b451c
......@@ -411,6 +411,60 @@ BOOL PSDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
/***********************************************************************
* PSDRV_PolyBezier
*/
BOOL PSDRV_PolyBezier( PHYSDEV dev, const POINT *pts, DWORD count )
{
DWORD i;
POINT *dev_pts;
TRACE("\n");
if (!(dev_pts = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*dev_pts) ))) return FALSE;
memcpy( dev_pts, pts, count * sizeof(*dev_pts) );
LPtoDP( dev->hdc, dev_pts, count );
PSDRV_WriteSpool(dev, "%PolyBezier\n",12);
PSDRV_SetPen(dev);
PSDRV_SetClip(dev);
PSDRV_WriteMoveTo(dev, dev_pts[0].x, dev_pts[0].y );
for (i = 1; i < count; i += 3) PSDRV_WriteCurveTo( dev, dev_pts + i );
PSDRV_DrawLine(dev);
PSDRV_ResetClip(dev);
HeapFree( GetProcessHeap(), 0, dev_pts );
return TRUE;
}
/***********************************************************************
* PSDRV_PolyBezierTo
*/
BOOL PSDRV_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD count )
{
DWORD i;
POINT *dev_pts;
TRACE("\n");
count++; /* add initial position */
if (!(dev_pts = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*dev_pts) ))) return FALSE;
GetCurrentPositionEx( dev->hdc, dev_pts );
memcpy( dev_pts + 1, pts, (count - 1) * sizeof(*dev_pts) );
LPtoDP( dev->hdc, dev_pts, count );
PSDRV_WriteSpool(dev, "%PolyBezier\n",12);
PSDRV_SetPen(dev);
PSDRV_SetClip(dev);
PSDRV_WriteMoveTo(dev, dev_pts[0].x, dev_pts[0].y );
for (i = 1; i < count; i += 3) PSDRV_WriteCurveTo( dev, dev_pts + i );
PSDRV_DrawLine(dev);
PSDRV_ResetClip(dev);
HeapFree( GetProcessHeap(), 0, dev_pts );
return TRUE;
}
/***********************************************************************
* PSDRV_SetPixel
*/
COLORREF PSDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
......
......@@ -890,8 +890,8 @@ static const struct gdi_dc_funcs psdrv_funcs =
PSDRV_PaintRgn, /* pPaintRgn */
PSDRV_PatBlt, /* pPatBlt */
PSDRV_Pie, /* pPie */
NULL, /* pPolyBezier */
NULL, /* pPolyBezierTo */
PSDRV_PolyBezier, /* pPolyBezier */
PSDRV_PolyBezierTo, /* pPolyBezierTo */
NULL, /* pPolyDraw */
PSDRV_PolyPolygon, /* pPolyPolygon */
PSDRV_PolyPolyline, /* pPolyPolyline */
......
......@@ -138,6 +138,9 @@ static const char psarc[] = /* x, y, w, h, ang1, ang2 */
"0 0 0.5 %.1f %.1f arc\n"
"tmpmtrx setmatrix\n";
static const char pscurveto[] = /* x1, y1, x2, y2, x3, y3 */
"%d %d %d %d %d %d curveto\n";
static const char psgsave[] =
"gsave\n";
......@@ -501,6 +504,14 @@ BOOL PSDRV_WriteArc(PHYSDEV dev, INT x, INT y, INT w, INT h, double ang1,
return PSDRV_WriteSpool(dev, buf, strlen(buf));
}
BOOL PSDRV_WriteCurveTo(PHYSDEV dev, POINT pts[3])
{
char buf[256];
sprintf(buf, pscurveto, pts[0].x, pts[0].y, pts[1].x, pts[1].y, pts[2].x, pts[2].y );
return PSDRV_WriteSpool(dev, buf, strlen(buf));
}
BOOL PSDRV_WriteSetFont(PHYSDEV dev, const char *name, matrix size, INT escapement)
{
......
......@@ -442,6 +442,8 @@ extern BOOL PSDRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_PatBlt(PHYSDEV dev, struct bitblt_coords *dst, DWORD dwRop) DECLSPEC_HIDDEN;
extern BOOL PSDRV_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_PolyBezier( PHYSDEV dev, const POINT *pts, DWORD count ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD count ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* counts, UINT polygons ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_PolyPolyline( PHYSDEV dev, const POINT* pts, const DWORD* counts, DWORD polylines ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count ) DECLSPEC_HIDDEN;
......@@ -502,6 +504,7 @@ extern BOOL PSDRV_WriteGlyphShow(PHYSDEV dev, LPCSTR g_name) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteSetPen(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteArc(PHYSDEV dev, INT x, INT y, INT w, INT h,
double ang1, double ang2) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteCurveTo(PHYSDEV dev, POINT pts[3]) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteSetColor(PHYSDEV dev, PSCOLOR *color) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteSetBrush(PHYSDEV dev) DECLSPEC_HIDDEN;
extern BOOL PSDRV_WriteFill(PHYSDEV dev) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment