Kitty Graphics Protocol in OCaml
terminal graphics ocaml
at main 1.7 kB view raw
1(*--------------------------------------------------------------------------- 2 Copyright (c) 2025 Anil Madhavapeddy. All rights reserved. 3 SPDX-License-Identifier: ISC 4 ---------------------------------------------------------------------------*) 5 6type t = { 7 source_x : int option; 8 source_y : int option; 9 source_width : int option; 10 source_height : int option; 11 cell_x_offset : int option; 12 cell_y_offset : int option; 13 columns : int option; 14 rows : int option; 15 z_index : int option; 16 placement_id : int option; 17 cursor : Kgp_cursor.t option; 18 unicode_placeholder : bool; 19} 20 21let empty = 22 { 23 source_x = None; 24 source_y = None; 25 source_width = None; 26 source_height = None; 27 cell_x_offset = None; 28 cell_y_offset = None; 29 columns = None; 30 rows = None; 31 z_index = None; 32 placement_id = None; 33 cursor = None; 34 unicode_placeholder = false; 35 } 36 37let make ?source_x ?source_y ?source_width ?source_height ?cell_x_offset 38 ?cell_y_offset ?columns ?rows ?z_index ?placement_id ?cursor 39 ?(unicode_placeholder = false) () = 40 { 41 source_x; 42 source_y; 43 source_width; 44 source_height; 45 cell_x_offset; 46 cell_y_offset; 47 columns; 48 rows; 49 z_index; 50 placement_id; 51 cursor; 52 unicode_placeholder; 53 } 54 55let source_x t = t.source_x 56let source_y t = t.source_y 57let source_width t = t.source_width 58let source_height t = t.source_height 59let cell_x_offset t = t.cell_x_offset 60let cell_y_offset t = t.cell_y_offset 61let columns t = t.columns 62let rows t = t.rows 63let z_index t = t.z_index 64let placement_id t = t.placement_id 65let cursor t = t.cursor 66let unicode_placeholder t = t.unicode_placeholder