Scroll to navigation

TICKIT_RENDERBUFFER_HLINE_AT(3) Library Functions Manual TICKIT_RENDERBUFFER_HLINE_AT(3)

NAME

tickit_renderbuffer_hline_at, tickit_renderbuffer_vline_at - create line regions

SYNOPSIS

#include <tickit.h>

void tickit_renderbuffer_hline_at(TickitRenderBuffer *rb,
        int line, int startcol, int endcol,
        TickitLineStyle style, TickitLineCaps caps);
void tickit_renderbuffer_vline_at(TickitRenderBuffer *rb,
        int startline, int endline, int col,
        TickitLineStyle style, TickitLineCaps caps);

Link with -ltickit.

DESCRIPTION

tickit_renderbuffer_hline_at() creates a horizontal line segment on the given line between the given columns; both inclusive. tickit_renderbuffer_vline_at() creates a vertical line segment on the given column between the given lines; both inclusive.

The style argument should be one of the following TickitLineStyle constants:

A single thin line
A pair of double thin lines
A single thick line

Note that as line drawing is performed using the Unicode line-drawing characters, not every possible combination of line segments of differing styles meeting in a cell is supported by Unicode. The following sets of styles may be relied upon:

  • Any possible combination of only SINGLE segments, THICK segments, or both.
  • Any combination of only DOUBLE segments, except cells that only have one of the four borders occupied.
  • Any combination of SINGLE and DOUBLE segments except where the style changes between SINGLE to DOUBLE on a vertical or horizontal run.

Other combinations are not directly supported (i.e. any combination of DOUBLE and THICK in the same cell, or any attempt to change from SINGLE to DOUBLE in either the vertical or horizontal direction). To handle these cases, a cell may be rendered with a substitution character which replaces a DOUBLE or THICK segment with a SINGLE one within that cell. The effect will be the overall shape of the line is retained, but close to the edge or corner it will have the wrong segment type.

Conceptually, every cell involved in line drawing has a potential line segment type at each of its four borders to its neighbours. Horizontal lines are drawn though the vertical centre of each cell, and vertical lines are drawn through the horizontal centre.

There is a choice of how to handle the ends of line segments, as to whether the segment should go to the centre of each cell, or should continue through the entire body of the cell and stop at the boundary. By default line segments will start and end at the centre of the cells, so that horizontal and vertical lines meeting in a cell will form a neat corner. When drawing isolated lines such as horizontal or vertical rules, it is preferable that the line go right through the cells at the start and end. To control this behaviour, the caps bitmask argument should be one of the following TickitLineCaps constants:

indicates that the line should consume the entire start cell
indicates that the line should consume the entire end cell
is a convenient shortcut specifying both behaviours

RETURN VALUE

This function returns no value.

SEE ALSO

tickit_renderbuffer_new(3), tickit_renderbuffer_blit(3), tickit_renderbuffer_flush_to_term(3), tickit_renderbuffer(7), tickit(7)