package camlpdf

  1. Overview
  2. Docs

Parsing and Evaluating PDF Functions.

type calculator =
  1. | If of calculator list
  2. | IfElse of calculator list * calculator list
  3. | Bool of bool
  4. | Float of float
  5. | Int of int32
  6. | Abs
  7. | Add
  8. | Atan
  9. | Ceiling
  10. | Cos
  11. | Cvi
  12. | Cvr
  13. | Div
  14. | Exp
  15. | Floor
  16. | Idiv
  17. | Ln
  18. | Log
  19. | Mod
  20. | Mul
  21. | Neg
  22. | Round
  23. | Sin
  24. | Sqrt
  25. | Sub
  26. | Truncate
  27. | And
  28. | Bitshift
  29. | Eq
  30. | Ge
  31. | Gt
  32. | Le
  33. | Lt
  34. | Ne
  35. | Not
  36. | Or
  37. | Xor
  38. | Copy
  39. | Exch
  40. | Pop
  41. | Dup
  42. | Index
  43. | Roll
type sampled = {
  1. size : int list;
  2. order : int;
  3. encode : float list;
  4. decode : float list;
  5. bps : int;
  6. samples : int32 array;
}
and interpolation = {
  1. c0 : float list;
  2. c1 : float list;
  3. n : float;
}
and stitching = {
  1. functions : t list;
  2. bounds : float list;
  3. stitch_encode : float list;
}
and pdf_fun_kind =
  1. | Interpolation of interpolation
  2. | Stitching of stitching
  3. | Sampled of sampled
  4. | Calculator of calculator list
and t = {
  1. func : pdf_fun_kind;
  2. domain : float list;
  3. range : float list option;
}

The type of functions.

val parse_function : Pdf.t -> Pdf.pdfobject -> t

Parse a function given a document and function object.

exception BadFunctionEvaluation of string

Raised from eval_function (see below) in the case of inputs which don't match the evaluation

val eval_function : t -> float list -> float list

Evaluate a function given a list of inputs.

val pdfobject_of_function : Pdf.t -> t -> Pdf.pdfobject

Flatten a function to its PDF representation

val print_function : t -> unit

Print a function to Standard Output. For debug only.