This commit is contained in:
John Whitington 2023-05-12 19:01:59 +01:00
parent 94da81f6a8
commit ae2e8d904f
3 changed files with 22 additions and 1 deletions

View File

@ -1829,6 +1829,18 @@ let addbezier s =
| _ -> error "-bez requires six numbers"
| exception _ -> error "malformed -bez"
let addbezier23 s =
match readfloats s with
| [a; b; c; d] -> addop (Cpdfdraw.Bezier23 (a, b, c, d))
| _ -> error "-bez23 requires four numbers"
| exception _ -> error "malformed -bez23"
let addbezier13 s =
match readfloats s with
| [a; b; c; d] -> addop (Cpdfdraw.Bezier13 (a, b, c, d))
| _ -> error "-bez13 requires four numbers"
| exception _ -> error "malformed -bez13"
let addcircle s =
match readfloats s with
| [x; y; r] ->
@ -2867,6 +2879,8 @@ and specs =
("-to", Arg.String addto, " Move to");
("-line", Arg.String addline, " Add line to");
("-bez", Arg.String addbezier, " Add Bezier curve to path");
("-bez23", Arg.String addbezier23, " Add Bezier v-op to path");
("-bez13", Arg.String addbezier13, " Add Bezier y-op to path");
("-circle", Arg.String addcircle, " Add circle to path");
("-strokecol", Arg.String setstroke, " Set stroke colour");
("-fillcol", Arg.String setfill, " Set fill colour");

View File

@ -10,6 +10,8 @@ type colspec =
type drawops =
| Rect of float * float * float * float
| Bezier of float * float * float * float * float * float
| Bezier23 of float * float * float * float
| Bezier13 of float * float * float * float
| To of float * float
| Line of float * float
| ClosePath
@ -52,7 +54,8 @@ let rec string_of_drawop = function
| Qq o -> "Qq (" ^ string_of_drawops o ^ ")"
| FormXObject (_, _, _, _, _, o) -> "FormXObject (" ^ string_of_drawops o ^ ")"
| TextSection o -> "TextSection (" ^ string_of_drawops o ^ ")"
| Rect _ -> "Rect" | Bezier _ -> "Bezier" | To _ -> "To" | Line _ -> "Line"
| Rect _ -> "Rect" | Bezier _ -> "Bezier" | Bezier23 _ -> "Bezier23"
| Bezier13 _ -> "Bezier13" | To _ -> "To" | Line _ -> "Line"
| ClosePath -> "ClosePath" | SetFill _ -> "SetFill" | SetStroke _ -> "SetStroke"
| SetLineThickness _ -> "SetLineThickness" | SetLineCap _ -> "SetLineCap"
| SetLineJoin _ -> "SetLineJoin" | SetMiterLimit _ -> "SetMiterLimit"
@ -170,6 +173,8 @@ let rec ops_of_drawop pdf endpage filename bates batespad num page = function
| Matrix m -> [Pdfops.Op_cm m]
| Rect (x, y, w, h) -> [Pdfops.Op_re (x, y, w, h)]
| Bezier (a, b, c, d, e, f) -> [Pdfops.Op_c (a, b, c, d, e, f)]
| Bezier23 (a, b, c, d) -> [Pdfops.Op_v (a, b, c, d)]
| Bezier13 (a, b, c, d) -> [Pdfops.Op_y (a, b, c, d)]
| To (x, y) -> [Pdfops.Op_m (x, y)]
| Line (x, y) -> [Pdfops.Op_l (x, y)]
| SetFill x ->

View File

@ -7,6 +7,8 @@ type colspec =
type drawops =
| Rect of float * float * float * float
| Bezier of float * float * float * float * float * float
| Bezier23 of float * float * float * float
| Bezier13 of float * float * float * float
| To of float * float
| Line of float * float
| ClosePath