|
1 | 1 | (** |
2 | 2 | Kicad modules Signatures *) |
3 | 3 |
|
4 | | - |
5 | | -type orientation = Orient_H | Orient_V (** *) |
6 | 4 | (** orientation of a text *) |
| 5 | +type orientation = Orient_H | Orient_V (** *) |
7 | 6 |
|
8 | 7 | (** absolute coordinates in the drawing *) |
9 | | -type coord = Coord of int*int |
| 8 | +type coord = Coord of int * int |
10 | 9 |
|
11 | | -type size = Size of int (** *) |
12 | 10 | (** font size of a text *) |
| 11 | +type size = Size of int (** *) |
13 | 12 |
|
14 | | -type justify = J_left | J_right | J_center | J_bottom | J_top (** *) |
15 | 13 | (** Text justification of a text *) |
| 14 | +type justify = J_left | J_right | J_center | J_bottom | J_top (** *) |
16 | 15 |
|
17 | | -type style = Bold | Italic | BoldItalic | NoStyle (** *) |
18 | 16 | (** Style of a text *) |
| 17 | +type style = Bold | Italic | BoldItalic | NoStyle (** *) |
19 | 18 |
|
20 | | -type kolor = [`NoColor | `Black | `Green | `Red | `Blue | `Brown ] |
21 | 19 | (** Color of the text. These are the colors appearing in Kicad schematics *) |
| 20 | +type kolor = [`NoColor | `Black | `Green | `Red | `Blue | `Brown] |
22 | 21 |
|
23 | | -type transfo = ((int * int) * (int * int)) |
24 | 22 | (** Transformation matrix of a relative coordinate around an absolute coordinate. |
25 | 23 | The matrix is layed out as a pair of lines of pairs *) |
| 24 | +type transfo = (int * int) * (int * int) |
26 | 25 |
|
27 | 26 | module type Painter = sig |
28 | 27 | (** A module able to paint a canvas with several graphic primitives |
29 | 28 | and then to process the canvas into a picture file format. The |
30 | 29 | functions are supposed to be pure *) |
31 | 30 |
|
32 | | - type t |
33 | 31 | (** the canvas of the painter *) |
| 32 | + type t |
34 | 33 |
|
35 | | - val paint_text: ?kolor: kolor -> String.t -> orientation -> coord -> size -> justify -> style -> t -> t |
| 34 | + val paint_text : |
| 35 | + ?kolor:kolor |
| 36 | + -> String.t |
| 37 | + -> orientation |
| 38 | + -> coord |
| 39 | + -> size |
| 40 | + -> justify |
| 41 | + -> style |
| 42 | + -> t |
| 43 | + -> t |
36 | 44 | (** [paint ?kolor text orient coord size justification style canvas] |
37 | 45 | adds a [text] with the given [orient], [size], [justification] |
38 | 46 | and [style] at the given [coord] to [canvas]. |
39 | 47 | @return the modified canvas *) |
40 | 48 |
|
41 | | - val paint_line: ?kolor: kolor -> ?width: size -> coord -> coord -> t -> t |
| 49 | + val paint_line : ?kolor:kolor -> ?width:size -> coord -> coord -> t -> t |
42 | 50 | (** [paint_line ?kolor width start end canvas] paints a line with |
43 | 51 | the given [kolor] and [width] between [start] and [stop] on |
44 | 52 | [canvas]. |
45 | 53 | @return the modified canvas *) |
46 | 54 |
|
47 | | - val paint_circle: ?kolor: kolor -> ?fill: kolor -> coord -> int -> t -> t |
| 55 | + val paint_circle : ?kolor:kolor -> ?fill:kolor -> coord -> int -> t -> t |
48 | 56 | (** [paint_circle ?kolor center radius canvas] paints a circle |
49 | 57 | filled with the given [kolor] defined by [center] and [radius] on |
50 | 58 | [canvas]. |
51 | 59 | @return the modified canvas *) |
52 | 60 |
|
53 | | - val paint_rect: ?kolor: kolor -> ?fill: kolor -> coord -> coord -> t -> t |
| 61 | + val paint_rect : ?kolor:kolor -> ?fill:kolor -> coord -> coord -> t -> t |
54 | 62 | (** [paint_rect ?kolor corner1 corner2 canvas] paints a rectangle |
55 | 63 | filled with the given [kolor] defined by [corner1] and [corner2] |
56 | 64 | on [canvas]. |
57 | 65 | @return the modified canvas *) |
58 | 66 |
|
59 | | - val paint_image: coord -> float -> Buffer.t -> t -> t |
| 67 | + val paint_image : coord -> float -> Buffer.t -> t -> t |
60 | 68 | (** [paint_image corner scale png canvas] paints a [png] image |
61 | 69 | filled at [corner], scaled at [scale] on [canvas]. |
62 | 70 | @return the |
63 | 71 | modified canvas *) |
64 | 72 |
|
65 | | - val paint_arc: ?kolor: kolor -> ?fill: kolor -> coord -> coord -> coord -> int -> t -> t |
| 73 | + val paint_arc : |
| 74 | + ?kolor:kolor -> ?fill:kolor -> coord -> coord -> coord -> int -> t -> t |
66 | 75 | (** [paint_arc ?kolor center start end radius canvas] paints an arc filled |
67 | 76 | with [kolor] between [start] and [end] of [radius] around center on |
68 | 77 | [canvas]. |
69 | 78 | @return the modified canvas *) |
70 | 79 |
|
71 | | - val set_canevas_size: int -> int -> t -> t |
| 80 | + val set_canevas_size : int -> int -> t -> t |
72 | 81 | (** [set_canevas x y canvas] set the size of the canevas |
73 | 82 |
|
74 | 83 | @return the modified canvas *) |
75 | 84 |
|
76 | | - val get_context: unit -> t |
| 85 | + val get_context : unit -> t |
77 | 86 | (** [get_context ()] |
78 | 87 | @return a new painting canvas *) |
79 | | - |
80 | 88 | end |
81 | 89 |
|
82 | 90 | module type SchPainter = sig |
83 | 91 | (** A module able to paint a schematic file in a painter context *) |
84 | 92 |
|
85 | | - type schContext |
86 | 93 | (** the schematic context *) |
| 94 | + type schContext |
87 | 95 |
|
88 | | - type painterContext |
89 | 96 | (** the underlying context *) |
| 97 | + type painterContext |
90 | 98 |
|
91 | 99 | val initial_context : unit -> schContext |
92 | 100 | (** [initial_context ()] |
93 | 101 | @return an new empty context *) |
94 | 102 |
|
95 | | - val add_lib: string -> schContext -> schContext |
| 103 | + val add_lib : string -> schContext -> schContext |
96 | 104 | (** [add_lib line context] parse the content of [line] provided to |
97 | 105 | libs to the [context]. |
98 | 106 | @return the updated context *) |
99 | 107 |
|
100 | | - val parse_line : |
101 | | - String.t -> schContext -> schContext |
| 108 | + val parse_line : String.t -> schContext -> schContext |
102 | 109 | (** [parse_line line context] parse a new [line] of schematic and |
103 | 110 | update [context]. |
104 | 111 | @return the updated context *) |
105 | 112 |
|
106 | | - val output_context: schContext -> painterContext |
| 113 | + val output_context : schContext -> painterContext |
107 | 114 | (** [output_context context output] write the [context] as a image |
108 | 115 | format to [output] *) |
109 | | - |
110 | 116 | end |
111 | 117 |
|
112 | | -module type CompPainter = |
113 | | -sig |
| 118 | +module type CompPainter = sig |
114 | 119 | (** The library that is able to read component libraries and |
115 | 120 | memorize the read components. Then when passed a drawing context |
116 | 121 | and a component to paint it can paint the component on demand to |
117 | 122 | the drawing context *) |
118 | 123 |
|
119 | | - type t |
120 | 124 | (** A component Library manager *) |
| 125 | + type t |
121 | 126 |
|
122 | | - type drawContext |
123 | 127 | (** A drawing context *) |
| 128 | + type drawContext |
124 | 129 |
|
125 | | - val lib: unit -> t |
| 130 | + val lib : unit -> t |
126 | 131 | (** [lib ()] |
127 | 132 | @return an empty new component manager *) |
128 | 133 |
|
129 | | - val append_lib: string -> t -> t |
| 134 | + val append_lib : string -> t -> t |
130 | 135 | (** [append_lib stream context] appends the lib contained in the |
131 | 136 | [stream] to the context. |
132 | 137 | @return the updated context *) |
133 | 138 |
|
134 | | - val plot_comp: t -> string -> int -> coord -> transfo -> drawContext -> drawContext * bool |
| 139 | + val plot_comp : |
| 140 | + t -> string -> int -> coord -> transfo -> drawContext -> drawContext * bool |
135 | 141 | (** [plot_comp lib name partnumber origin transformation context] |
136 | 142 | find in [lib] the component with given [name] and plot the part |
137 | 143 | [partnumber] at [origin] after [transfomation] into the graphical |
138 | 144 | [context] and the fact that the component is multipart. |
139 | 145 | @return the updated graphical context *) |
140 | | - |
141 | 146 | end |
0 commit comments