Module Hardcaml_waveterm_kernel.Draw

Graphics drawing api to a 2d array of integers.

Most functions take a bounds parameter which is a Rect.t to which drawing is clipped and also serves as an origin for any coordinates.

type piece =
  1. | TL
  2. | BR
  3. | BL
  4. | TR
  5. | V
  6. | H
  7. | T
  8. | Tu
  9. | C
  10. | F
  11. | TH
  12. | BH
  13. | LH
  14. | RH
  15. | QTL
  16. | QBR
  17. | QBL
  18. | QTR
  19. | Up_arrow
  20. | Down_arrow
val sexp_of_piece : piece -> Sexplib0.Sexp.t
val unicode_of_piece : piece -> Base.int

unicode value of piece

drawing context

val init : rows:Base.int -> cols:Base.int -> ctx
val rows : ctx -> Base.int
val cols : ctx -> Base.int
val get_bounds : ctx -> Rect.t

get context size

val clear : ctx -> Base.unit

clear display

val fill : ctx:ctx -> style:Style.t -> bounds:Rect.t -> Base.char -> Base.unit

fill bounds with char given style

val draw_int : ctx:ctx -> style:Style.t -> bounds:Rect.t -> r:Base.int -> c:Base.int -> Base.int -> Base.unit

draw int (representing unicode value)

val draw_piece : ctx:ctx -> style:Style.t -> bounds:Rect.t -> r:Base.int -> c:Base.int -> piece -> Base.unit

draw piece

val draw_char : ctx:ctx -> style:Style.t -> bounds:Rect.t -> r:Base.int -> c:Base.int -> Base.char -> Base.unit

draw char

val draw_string : ctx:ctx -> style:Style.t -> bounds:Rect.t -> r:Base.int -> c:Base.int -> Base.string -> Base.unit

draw string (nothing fancy - horizontal, no breaks)

val draw_box : ctx:ctx -> style:Style.t -> bounds:Rect.t -> Base.string -> Base.unit

draw box outline with label

val get : ctx:ctx -> bounds:Rect.t -> r:Base.int -> c:Base.int -> Base.int * Style.t

get value and style at point

val inv : ?style:Style.t -> ctx:ctx -> bounds:Rect.t -> r:Base.int -> c:Base.int -> Base.unit -> Base.unit

invert fg and bg at point. Or force to given style if provided.

val bold : ctx:ctx -> bounds:Rect.t -> r:Base.int -> c:Base.int -> Base.unit

set bold on point