package lambda-term

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module LTerm_drawSource

Drawing

Sourcetype elem = {
  1. char : Zed_char.t;
    (*

    The Zed_char.t character.

    *)
  2. bold : bool;
    (*

    Whether the character is in bold or not.

    *)
  3. underline : bool;
    (*

    Whether the character is underlined or not.

    *)
  4. reverse : bool;
    (*

    Whether the character is in reverse video mode or not.

    *)
  5. foreground : LTerm_style.color;
    (*

    The foreground color.

    *)
  6. background : LTerm_style.color;
    (*

    The background color.

    *)
}

Type of a element in a matrix of styled characters.

Sourcetype point' =
  1. | Elem of elem
  2. | WidthHolder of int
Sourcetype point = point' ref

Type of a point in a matrix of styled characters.

Sourcetype matrix = point array array

Type of a matrix of points. The matrix is indexed by lines then columns, i.e. to access the point at line l and column c in matrix m you should use m.(l).(c).

Sourceval make_matrix : LTerm_geom.size -> matrix

matrix size creates a matrix of the given size containing only blank characters.

Sourceval set_style : point -> LTerm_style.t -> unit

set_style point style sets fields of point according to fields of style. For example:

  set_style point { LTerm_style.none with LTerm_style.bold = Some true }

will have the following effect:

  point.bold <- true
Sourcetype context

Type of contexts. A context is used for drawing.

context m s creates a context from a matrix m of size s. It raises Invalid_argument if s is not the size of m.

Sourceexception Out_of_bounds

Exception raised when trying to access a point that is outside the bounds of a context.

size ctx returns the size of the given context.

sub ctx rect creates a sub-context from the given context. It raises Out_of_bounds if the rectangle is not contained in the given context.

Sourceval clear : context -> unit

clear ctx clears the given context. It resets all styles to their default and sets characters to spaces.

Sourceval fill : context -> ?style:LTerm_style.t -> Zed_char.t -> unit

fill ctx ch fills the given context with ch.

Sourceval fill_style : context -> LTerm_style.t -> unit

fill_style style fills the given context with style.

Sourceval point : context -> int -> int -> point

point ctx row column returns the point at given position in ctx. It raises Out_of_bounds if the coordinates are outside the given context.

Sourceval draw_char_matrix : matrix -> int -> int -> ?style:LTerm_style.t -> Zed_char.t -> unit

draw_char_matrix matrix row column ?style ch sets the character at given coordinates to ch. It does nothing if the given coordinates are outside the bounds of the context.

Sourceval draw_char : context -> int -> int -> ?style:LTerm_style.t -> Zed_char.t -> unit

draw_char ctx row column ?style ch sets the character at given coordinates to ch. It does nothing if the given coordinates are outside the bounds of the context.

Sourceval draw_string : context -> int -> int -> ?style:LTerm_style.t -> Zed_string.t -> unit

draw_string ctx row column ?style str draws the given string at given coordinates. This does not affect styles. str may contains newlines.

Sourceval draw_styled : context -> int -> int -> ?style:LTerm_style.t -> LTerm_text.t -> unit

draw_styled ctx row column ?style text draws the given styled text at given coordinates.

Sourceval draw_string_aligned : context -> int -> LTerm_geom.horz_alignment -> ?style:LTerm_style.t -> Zed_string.t -> unit

Draws a string with the given alignment.

Sourceval draw_styled_aligned : context -> int -> LTerm_geom.horz_alignment -> ?style:LTerm_style.t -> LTerm_text.t -> unit

Draws a styled string with the given aglienment.

Sourcetype connection =
  1. | Blank
    (*

    No connection.

    *)
  2. | Light
    (*

    Connection with a light line.

    *)
  3. | Heavy
    (*

    Connection with a heavy line.

    *)

Type of an connection in a piece that can be connected to other pieces.

Sourcetype piece = {
  1. top : connection;
  2. bottom : connection;
  3. left : connection;
  4. right : connection;
}

Type of a piece, given by its four connection.

Sourceval draw_piece : context -> int -> int -> ?style:LTerm_style.t -> piece -> unit

Draws a piece. It may modify pieces around it.

Sourceval draw_hline : context -> int -> int -> int -> ?style:LTerm_style.t -> connection -> unit

draw_hline ctx row column length connection draws an horizontal line.

Sourceval draw_vline : context -> int -> int -> int -> ?style:LTerm_style.t -> connection -> unit

draw_hline ctx row column length connection draws a vertical line.

Sourceval draw_frame : context -> LTerm_geom.rect -> ?style:LTerm_style.t -> connection -> unit

Draws a rectangle.

Sourceval draw_frame_labelled : context -> LTerm_geom.rect -> ?style:LTerm_style.t -> ?alignment:LTerm_geom.horz_alignment -> Zed_string.t -> connection -> unit

Draws a rectangle with a label on the top row.

OCaml

Innovation. Community. Security.