This commit is contained in:
John Whitington 2022-12-15 14:20:41 +00:00
parent bd4e4df3a0
commit 1d43118a09
3 changed files with 40 additions and 0 deletions

View File

@ -1778,6 +1778,16 @@ let addline s =
let endpath () = let endpath () =
drawops := Cpdfdraw.EndPath::!drawops drawops := Cpdfdraw.EndPath::!drawops
let setthickness s = ()
let setcap s = ()
let setjoin s = ()
let setmiter s = ()
let setdash s = ()
(* Parse a control file, make an argv, and then make Arg parse it. *) (* Parse a control file, make an argv, and then make Arg parse it. *)
let rec make_control_argv_and_parse filename = let rec make_control_argv_and_parse filename =
control_args := !control_args @ parse_control_file filename control_args := !control_args @ parse_control_file filename
@ -2563,6 +2573,11 @@ and specs =
("-stroke", Arg.String setstroke, " Set stroke colour"); ("-stroke", Arg.String setstroke, " Set stroke colour");
("-fill", Arg.String setfill, " Set fill colour"); ("-fill", Arg.String setfill, " Set fill colour");
("-end", Arg.Unit endpath, " End path"); ("-end", Arg.Unit endpath, " End path");
("-thick", Arg.String setthickness, " Set stroke thickness");
("-cap", Arg.String setcap, " Set cap");
("-join", Arg.String setjoin, " Set join");
("-miter", Arg.String setmiter, " Set miter limit");
("-dash", Arg.String setdash, " Set dash pattern");
(* These items are undocumented *) (* These items are undocumented *)
("-remove-unused-resources", Arg.Unit (setop RemoveUnusedResources), ""); ("-remove-unused-resources", Arg.Unit (setop RemoveUnusedResources), "");
("-stay-on-error", Arg.Unit setstayonerror, ""); ("-stay-on-error", Arg.Unit setstayonerror, "");

View File

@ -12,6 +12,11 @@ type drawops =
| Line of float * float | Line of float * float
| Fill of drawops_colspec | Fill of drawops_colspec
| Stroke of drawops_colspec | Stroke of drawops_colspec
| SetLineThickness of float
| SetLineCap of int
| SetLineJoin of int
| SetMiterLimit of float
| SetDashPattern of float list * float
| EndPath | EndPath
type state = type state =
@ -59,6 +64,21 @@ let ops_of_drawop = function
| _, NoCol -> [Pdfops.Op_f] | _, NoCol -> [Pdfops.Op_f]
| _, _ -> [Pdfops.Op_B'] | _, _ -> [Pdfops.Op_B']
end end
| SetLineThickness t ->
state.linewidth <- t;
[Pdfops.Op_w t]
| SetLineCap c ->
state.linecap <- c;
[Pdfops.Op_J c]
| SetLineJoin j ->
state.linejoin <- j;
[Pdfops.Op_j j]
| SetMiterLimit m ->
state.miterlimit <- m;
[Pdfops.Op_M m]
| SetDashPattern (x, y) ->
state.dashpattern <- (x, y);
[Pdfops.Op_d (x, y)]
let ops_of_drawops drawops = flatten (map ops_of_drawop drawops) let ops_of_drawops drawops = flatten (map ops_of_drawop drawops)

View File

@ -10,6 +10,11 @@ type drawops =
| Line of float * float | Line of float * float
| Fill of drawops_colspec | Fill of drawops_colspec
| Stroke of drawops_colspec | Stroke of drawops_colspec
| SetLineThickness of float
| SetLineCap of int
| SetLineJoin of int
| SetMiterLimit of float
| SetDashPattern of float list * float
| EndPath | EndPath
type state = type state =