tangled
alpha
login
or
join now
anil.recoil.org
/
ocaml-kgp
0
fork
atom
Kitty Graphics Protocol in OCaml
terminal
graphics
ocaml
0
fork
atom
overview
issues
pulls
pipelines
TODO
anil.recoil.org
3 months ago
f81838f1
f7ae9d02
1/1
build.yml
success
2m 44s
+6
-5
3 changed files
expand all
collapse all
unified
split
TODO.md
example
example.ml
tiny_anim.ml
+1
TODO.md
reviewed
···
1
1
+
- Support zlib via decompress or similar
+1
-1
example/example.ml
reviewed
···
3
3
SPDX-License-Identifier: ISC
4
4
---------------------------------------------------------------------------*)
5
5
6
6
-
(* Kitty Graphics Protocol Demo - Matching kgp/examples/demo *)
6
6
+
(* Kitty Graphics Protocol Demo *)
7
7
8
8
module K = Kgp
9
9
+4
-4
example/tiny_anim.ml
reviewed
···
31
31
(* Clear any existing images *)
32
32
send (K.delete ~free:true ~quiet:`Errors_only `All_visible) ~data:"";
33
33
34
34
-
(* Step 1: Transmit base frame (red) - matching Go's sequence *)
34
34
+
(* Step 1: Transmit base frame (red) *)
35
35
let red_frame = solid_color_rgba ~width ~height ~r:255 ~g:0 ~b:0 ~a:255 in
36
36
send
37
37
(K.transmit ~image_id ~format:`Rgba32 ~width ~height ~quiet:`Errors_only ())
38
38
~data:red_frame;
39
39
40
40
-
(* Step 2: Add frame (orange) with 100ms gap - like Go *)
40
40
+
(* Step 2: Add frame (orange) with 100ms gap *)
41
41
let orange_frame =
42
42
solid_color_rgba ~width ~height ~r:255 ~g:165 ~b:0 ~a:255
43
43
in
···
65
65
~quiet:`Errors_only ())
66
66
~data:green_frame;
67
67
68
68
-
(* Step 5: Create placement - exactly like Go *)
68
68
+
(* Step 5: Create placement *)
69
69
send
70
70
(K.display ~image_id
71
71
~placement:
···
74
74
~quiet:`Errors_only ())
75
75
~data:"";
76
76
77
77
-
(* Step 6: Start animation - exactly like Go (NO root frame gap) *)
77
77
+
(* Step 6: Start animation *)
78
78
send (K.animate ~image_id (K.Animation.set_state ~loops:1 `Run)) ~data:"";
79
79
80
80
print_endline "";