File: matrix_set.ml

package info (click to toggle)
ocaml-cairo2 0.6.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 716 kB
  • sloc: ml: 2,955; ansic: 2,132; makefile: 24; sh: 17
file content (23 lines) | stat: -rw-r--r-- 657 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
open Cairo

let () =
  let cr = create (Image.create Image.ARGB32 ~w:100 ~h:100) in
  let m = { xx = 1.; xy = 2.; yx = 3.; yy = 4.; x0 = 5.; y0 = 6. } in
  set_matrix cr m;
  assert(get_matrix cr = m)

(* Font *)
let () =
  let m1 = Matrix.init_identity() in
  let m2 = Matrix.init_translate 10. 20. in
  let ff = Font_face.create Upright Normal in
  let fo = Font_options.create() in
  let sf = Scaled_font.create ff m1 m2 fo in
  assert(Scaled_font.get_font_matrix sf = m1);
  assert(Scaled_font.get_ctm sf = Matrix.init_identity());
  assert(Scaled_font.get_font_options sf = fo)


(* Local Variables: *)
(* compile-command: "make -k -C.." *)
(* End: *)