1    let create_rectangles (width : f32
2                           height : f32
3                           left : f32
4                           right : f32
5                           up : f32
6                           down : f32
7                           rectangles : mut List<Rect>) =
8        let left_rect = Rect left = 0
9                             top = 0
10                            right = left
11                            bottom = height
12       let right_rect = Rect left = width - right
13                             top = 0
14                             right = width
15                             bottom = height
16       let up_rect = Rect left = 0
17                          top = 0
18                          right = width
19                          bottom = up
20       let down_rect = Rect left = 0
21                            top = height - down
22                            right = width
23                            bottom = height
24       rectangles.add left_rect
25                  add right_rect
26                  add up_rect
27                  add down_rect
28   
29   type Border
30       val paint = Paint.new
31       val rectangles = List<Rect>.new
32       let size = get_size_atom self
33       let thickness =
34           (left@atom, right@atom, up@atom, down@atom) |> to_atom
35   
36       (size, thickness)
37       |> to_atom
38       |> bind { (w, h), (l, r, u, d) ->
39           if w == 0 || h == 0 then
40               return
41           else
42               rectangles.clear
43               create_rectangles w.as<f32> h.as<f32>
44                                 l.as<f32> r.as<f32> u.as<f32> d.as<f32>
45                                 rectangles }
46       |> push_token
47   
48       color@atom.bind { v ->
49           let skia_color = vector_to_skia_color v
50           paint.set_color skia_color }
51       |> push_token
52