File: viewer_common.mli

package info (click to toggle)
js-of-ocaml 5.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 32,020 kB
  • sloc: ml: 91,250; javascript: 57,289; ansic: 315; makefile: 271; lisp: 23; sh: 6; perl: 4
file content (131 lines) | stat: -rw-r--r-- 2,907 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
(* Graph viewer
 * Copyright (C) 2010 Jérôme Vouillon
 * Laboratoire PPS - CNRS Université Paris Diderot
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *)
module F (M : sig
  type color

  type font

  type text

  val white : color

  type ctx

  val save : ctx -> unit

  val restore : ctx -> unit

  val scale : ctx -> sx:float -> sy:float -> unit

  val translate : ctx -> tx:float -> ty:float -> unit

  val begin_path : ctx -> unit

  val close_path : ctx -> unit

  val move_to : ctx -> x:float -> y:float -> unit

  val line_to : ctx -> x:float -> y:float -> unit

  val curve_to :
    ctx -> x1:float -> y1:float -> x2:float -> y2:float -> x3:float -> y3:float -> unit

  val arc :
    ctx -> xc:float -> yc:float -> radius:float -> angle1:float -> angle2:float -> unit

  val rectangle : ctx -> x:float -> y:float -> width:float -> height:float -> unit

  val fill : ctx -> color -> unit

  val stroke : ctx -> color -> unit

  val clip : ctx -> unit

  val draw_text :
    ctx -> float -> float -> text -> font -> color option -> color option -> unit

  type window

  type drawable

  type pixmap

  val get_drawable : window -> drawable

  val make_pixmap : window -> int -> int -> pixmap

  val drawable_of_pixmap : pixmap -> drawable

  val get_context : pixmap -> ctx

  val put_pixmap :
       dst:drawable
    -> x:int
    -> y:int
    -> xsrc:int
    -> ysrc:int
    -> width:int
    -> height:int
    -> pixmap
    -> unit

  (****)

  type rectangle =
    { x : int
    ; y : int
    ; width : int
    ; height : int
    }

  val compute_extents :
       ctx
    -> (color, font, text) Scene.element array
    -> (float * float * float * float) array
end) : sig
  type pixmap

  val make_pixmap : unit -> pixmap

  val invalidate_pixmap : pixmap -> unit

  type st =
    { mutable bboxes : (float * float * float * float) array
    ; scene : (M.color, M.font, M.text) Scene.element array
    ; mutable zoom_factor : float
    ; st_x : float
    ; st_y : float
    ; st_width : float
    ; st_height : float
    ; st_pixmap : pixmap
    }

  val redraw :
       st
    -> float
    -> float
    -> float
    -> M.window
    -> M.rectangle
    -> int
    -> int
    -> int
    -> int
    -> unit
end