File: pdfunits.ml

package info (click to toggle)
camlpdf 2.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,272 kB
  • sloc: ml: 20,816; ansic: 9,525; makefile: 100; sh: 23
file content (22 lines) | stat: -rw-r--r-- 473 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
type t = PdfPoint | Inch | Centimetre | Millimetre

let points x = function
  | PdfPoint -> x
  | Inch -> x *. 72.
  | Centimetre -> x *. 28.3465
  | Millimetre -> x *. 2.83465

let inches x = function
  | Inch -> x
  | PdfPoint -> x /. 72.
  | Centimetre -> x /. 2.54
  | Millimetre -> x /. 25.4

let centimetres x = function
  | Centimetre -> x
  | Inch -> x *. 2.54
  | Millimetre -> x /. 10.
  | PdfPoint -> x /. 28.3456

let millimetres x u =
  centimetres x u *. 10.