/* Copyright (C) 1989, 1990, 1991 Aladdin Enterprises. All rights reserved.
Distributed by Free Software Foundation, Inc.
This file is part of Ghostscript.
Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
to anyone for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing. Refer
to the Ghostscript General Public License for full details.
Everyone is granted permission to copy, modify and redistribute
Ghostscript, but only under the conditions described in the Ghostscript
General Public License. A copy of this license is supposed to have been
given to you along with Ghostscript so you can know your rights and
responsibilities. It should be in a file named COPYING. Among other
things, the copyright notice and this notice must be preserved on all
/* Path operators for GhostScript */
private int near
common_to(P2(os_ptr
,
int (*)(P3(gs_state
*, floatp
, floatp
))));
private int near
common_arc(P2(os_ptr
,
int (*)(P6(gs_state
*, floatp
, floatp
, floatp
, floatp
, floatp
))));
private int near
common_arct(P2(os_ptr
, float *));
private int near
common_curve(P2(os_ptr
,
int (*)(P7(gs_state
*, floatp
, floatp
, floatp
, floatp
, floatp
, floatp
))));
/* Imported from zmath.c */
extern double degrees_to_radians
, radians_to_degrees
;
znewpath(register os_ptr op
)
{ return gs_newpath(igs
);
zcurrentpoint(register os_ptr op
)
int code
= gs_currentpoint(igs
, &pt
);
if ( code
< 0 ) return code
;
{ return common_to(op
, gs_moveto
);
{ return common_to(op
, gs_rmoveto
);
{ return common_to(op
, gs_lineto
);
{ return common_to(op
, gs_rlineto
);
/* Common code for [r](move/line)to */
common_to(os_ptr op
, int (*add_proc
)(P3(gs_state
*, floatp
, floatp
)))
if ( (code
= num_params(op
, 2, opxy
)) < 0 ||
(code
= (*add_proc
)(igs
, opxy
[0], opxy
[1])) < 0
{ return common_arc(op
, gs_arc
);
{ return common_arc(op
, gs_arcn
);
/* Common code for arc[n] */
int (*aproc
)(P6(gs_state
*, floatp
, floatp
, floatp
, floatp
, floatp
)))
{ float xyra
[5]; /* x, y, r, ang1, ang2 */
if ( (code
= num_params(op
, 5, xyra
)) < 0 ) return code
;
code
= (*aproc
)(igs
, xyra
[0], xyra
[1], xyra
[2], xyra
[3], xyra
[4]);
zarct(register os_ptr op
)
{ int code
= common_arct(op
, (float *)0);
if ( code
< 0 ) return code
;
zarcto(register os_ptr op
)
{ float tanxy
[4]; /* xt1, yt1, xt2, yt2 */
int code
= common_arct(op
, tanxy
);
if ( code
< 0 ) return code
;
make_real(op
- 4, tanxy
[0]);
make_real(op
- 3, tanxy
[1]);
make_real(op
- 2, tanxy
[2]);
make_real(op
- 1, tanxy
[3]);
/* Common code for arct[o] */
common_arct(os_ptr op
, float *tanxy
)
{ float args
[5]; /* x1, y1, x2, y2, r */
if ( (code
= num_params(op
, 5, args
)) < 0 ) return code
;
return gs_arcto(igs
, args
[0], args
[1], args
[2], args
[3], args
[4], tanxy
);
zcurveto(register os_ptr op
)
{ return common_curve(op
, gs_curveto
);
zrcurveto(register os_ptr op
)
{ return common_curve(op
, gs_rcurveto
);
/* Common code for [r]curveto */
int (*add_proc
)(P7(gs_state
*, floatp
, floatp
, floatp
, floatp
, floatp
, floatp
)))
if ( (code
= num_params(op
, 6, opxy
)) < 0 ) return code
;
code
= (*add_proc
)(igs
, opxy
[0], opxy
[1], opxy
[2], opxy
[3], opxy
[4], opxy
[5]);
zclosepath(register os_ptr op
)
{ return gs_closepath(igs
);
/* ------ Initialization procedure ------ */
op_def zpath_op_defs
[] = {
{"0closepath", zclosepath
},
{"0currentpoint", zcurrentpoint
},
{"6rcurveto", zrcurveto
},