diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 5fb1b89..31c6e86 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -1822,6 +1822,12 @@ let strokefill () = let strokefillevenodd () = addop Cpdfdraw.FillStrokeEvenOdd +let clip () = + addop Cpdfdraw.Clip + +let clipevenodd () = + addop Cpdfdraw.ClipEvenOdd + let closepath () = addop Cpdfdraw.ClosePath @@ -2706,9 +2712,11 @@ and specs = ("-fillcol", Arg.String setfill, " Set fill colour"); ("-stroke", Arg.Unit stroke, " Stroke"); ("-fill", Arg.Unit fill, " Fill"); - ("-filleo", Arg.Unit fill, " Fill, even odd"); + ("-filleo", Arg.Unit fillevenodd, " Fill, even odd"); ("-strokefill", Arg.Unit strokefill, " Stroke and fill"); ("-strokefilleo", Arg.Unit strokefillevenodd, " Stroke and fill, even odd"); + ("-clip", Arg.Unit clip, " Clip"); + ("-clipeo", Arg.Unit clipevenodd, " Clip, even odd"); ("-close", Arg.Unit closepath, " Close path"); ("-thick", Arg.String setthickness, " Set stroke thickness"); ("-cap", Arg.String setcap, " Set cap"); diff --git a/cpdfdraw.ml b/cpdfdraw.ml index 294cdf7..3ddc321 100644 --- a/cpdfdraw.ml +++ b/cpdfdraw.ml @@ -27,6 +27,8 @@ type drawops = | Stroke | FillStroke | FillStrokeEvenOdd + | Clip + | ClipEvenOdd | SoftXObject of drawops list | HardXObject of drawops list @@ -58,7 +60,9 @@ let rec ops_of_drawop = function | Stroke -> [Pdfops.Op_S] | FillStroke -> [Pdfops.Op_B] | FillStrokeEvenOdd -> [Pdfops.Op_B'] - | SetLineThickness t -> [Pdfops.Op_w t] + | Clip -> [Pdfops.Op_W; Pdfops.Op_n] + | ClipEvenOdd -> [Pdfops.Op_W'] + | SetLineThickness t -> [Pdfops.Op_w t; Pdfops.Op_n] | SetLineCap c -> [Pdfops.Op_J c] | SetLineJoin j -> [Pdfops.Op_j j] | SetMiterLimit m -> [Pdfops.Op_M m] diff --git a/cpdfdraw.mli b/cpdfdraw.mli index 06ffd26..387c27f 100644 --- a/cpdfdraw.mli +++ b/cpdfdraw.mli @@ -25,6 +25,8 @@ type drawops = | Stroke | FillStroke | FillStrokeEvenOdd + | Clip + | ClipEvenOdd | SoftXObject of drawops list | HardXObject of drawops list