Teletext and Closed Caption page render functions
High Level Decoding » Exporting formatted Teletext and Closed Caption pages

## Functions

void | vbi_draw_vt_page_region (vbi_page *pg, vbi_pixfmt fmt, void *canvas, int rowstride, int column, int row, int width, int height, int reveal, int flash_on)
_vbi_inline void | vbi_draw_vt_page (vbi_page *pg, vbi_pixfmt fmt, void *canvas, int reveal, int flash_on)
void | vbi_draw_cc_page_region (vbi_page *pg, vbi_pixfmt fmt, void *canvas, int rowstride, int column, int row, int width, int height)
_vbi_inline void | vbi_draw_cc_page (vbi_page *pg, vbi_pixfmt fmt, void *canvas)
void | vbi_get_max_rendered_size (int *w, int *h)
void | vbi_get_vt_cell_size (int *w, int *h)
int | vbi_print_page_region (vbi_page *pg, char *buf, int size, const char *format, vbi_bool table, vbi_bool ltr, int column, int row, int width, int height)
_vbi_inline int | vbi_print_page (vbi_page *pg, char *buf, int size, const char *format, vbi_bool table, vbi_bool ltr)
void | vbi_set_brightness (vbi_decoder *vbi, int brightness)
void | vbi_set_contrast (vbi_decoder *vbi, int contrast)

## Detailed Description

These are functions to render Teletext and Closed Caption pages directly into memory, essentially a more direct interface to the functions of some important export modules.

## Function Documentation

## vbi_draw_vt_page_region()

void vbi_draw_vt_page_region | ( | vbi_page * | pg,
|  | vbi_pixfmt | fmt,
|  | void * | canvas,
|  | int | rowstride,
|  | int | column,
|  | int | row,
|  | int | width,
|  | int | height,
|  | int | reveal,
|  | int | flash_on )

extern

Parameters

  pg | Source page.
  fmt | Target format. For now only VBI_PIXFMT_RGBA32_LE (vbi_rgba) and VBI_PIXFMT_PAL8 (1-byte palette indices) are permitted.
  canvas | Pointer to destination image (depending on the format, either an array of vbi_rgba or uint8_t), this must be at least rowstride * height * 10 bytes large.
  rowstride | canvas byte distance from line to line. If this is -1, pg->columns * 12 * sizeof(vbi_rgba) bytes will be assumed.
  column | First source column, 0 ... pg->columns - 1.
  row | First source row, 0 ... pg->rows - 1.
  width | Number of columns to draw, 1 ... pg->columns.
  height | Number of rows to draw, 1 ... pg->rows.
  reveal | If FALSE, draw characters flagged 'concealed' (see vbi_char) as space (U+0020).
  flash_on | If FALSE, draw characters flagged 'blink' (see vbi_char) as space (U+0020).

Draw a subsection of a Teletext vbi_page. In this mode one character occupies 12 x 10 pixels. Note this function does not consider transparency (e.g. on boxed pages)

References vbi_char::background, vbi_char::bold, vbi_page::color_map, vbi_page::columns, vbi_char::conceal, vbi_page::drcs, vbi_page::drcs_clut, vbi_char::drcs_clut_offs, vbi_char::flash, vbi_char::foreground, vbi_char::italic, vbi_page::rows, vbi_char::size, vbi_page::text, vbi_char::underline, vbi_char::unicode, and vbi_is_drcs().

Referenced by vbi_draw_vt_page().

## vbi_draw_vt_page()

_vbi_inline void vbi_draw_vt_page | ( | vbi_page * | pg,
|  | vbi_pixfmt | fmt,
|  | void * | canvas,
|  | int | reveal,
|  | int | flash_on )

Parameters

  pg | Source page.
  fmt | Target format. For now only VBI_PIXFMT_RGBA32_LE (vbi_rgba) permitted.
  canvas | Pointer to destination image (currently an array of vbi_rgba). This must be at least pg->columns * pg->rows * 12 * 10 * pixels large, without padding between lines.
  reveal | If FALSE, draw characters flagged 'concealed' (see vbi_char) as space (U+0020).
  flash_on | If FALSE, draw characters flagged 'blink' (see vbi_char) as space (U+0020).

Draw a Teletext vbi_page. In this mode one character occupies 12 x 10 pixels.

References vbi_page::columns, vbi_page::rows, and vbi_draw_vt_page_region().

## vbi_draw_cc_page_region()

void vbi_draw_cc_page_region | ( | vbi_page * | pg,
|  | vbi_pixfmt | fmt,
|  | void * | canvas,
|  | int | rowstride,
|  | int | column,
|  | int | row,
|  | int | width,
|  | int | height )

extern

Parameters

  pg | Source vbi_page, see vbi_fetch_cc_page().
  fmt | Target format. For now only VBI_PIXFMT_RGBA32_LE (vbi_rgba) permitted.
  canvas | Pointer to destination image (currently an array of vbi_rgba), this must be at least rowstride * height * 26 bytes large.
  rowstride | canvas byte distance from line to line. If this is -1, pg->columns * 16 * sizeof(vbi_rgba) bytes will be assumed.
  column | First source column, 0 ... pg->columns - 1.
  row | First source row, 0 ... pg->rows - 1.
  width | Number of columns to draw, 1 ... pg->columns.
  height | Number of rows to draw, 1 ... pg->rows.

Draw a subsection of a Closed Caption vbi_page. In this mode one character occupies 16 x 26 pixels.

References vbi_char::background, vbi_page::color_map, vbi_page::columns, vbi_char::foreground, vbi_char::italic, vbi_page::rows, vbi_page::text, vbi_char::underline, and vbi_char::unicode.

Referenced by vbi_draw_cc_page().

## vbi_draw_cc_page()

_vbi_inline void vbi_draw_cc_page | ( | vbi_page * | pg,
|  | vbi_pixfmt | fmt,
|  | void * | canvas )

Parameters

  pg | Source page.
  fmt | Target format. For now only VBI_PIXFMT_RGBA32_LE (vbi_rgba) permitted.
  canvas | Pointer to destination image (currently an array of vbi_rgba). This must be at least pg->columns * pg->rows * 16 * 26 * pixels large, without padding between lines.

Draw a Closed Caption vbi_page. In this mode one character occupies 16 x 26 pixels.

References vbi_page::columns, vbi_page::rows, and vbi_draw_cc_page_region().

## vbi_get_max_rendered_size()

void vbi_get_max_rendered_size | ( | int * | w,
|  | int * | h )

extern

Parameters

  w |
  h |

Deprecated
  Character cells are 12 x 10 for Teletext and 16 x 26 for Caption. Page size is in vbi_page.

## vbi_get_vt_cell_size()

void vbi_get_vt_cell_size | ( | int * | w,
|  | int * | h )

extern

Parameters

  w |
  h |

Deprecated
  Character cells are 12 x 10 for Teletext and 16 x 26 for Caption.

## vbi_print_page_region()

int vbi_print_page_region | ( | vbi_page * | pg,
|  | char * | buf,
|  | int | size,
|  | const char * | format,
|  | vbi_bool | table,
|  | vbi_bool | rtl,
|  | int | column,
|  | int | row,
|  | int | width,
|  | int | height )

extern

Parameters

  pg | Source page.
  buf | Memory location to hold the output.
  size | Size of the buffer in bytes. The function fails when the data exceeds the buffer capacity.
  format | Character set name for iconv() conversion, for example "ISO-8859-1".

  table

  Scan page in table mode, printing all characters within the source rectangle including runs of spaces at the start and end of rows. When `FALSE`, scan all characters from column, row to column + width - 1, row + height - 1 and all intermediate rows to their full pg->columns width. In this mode runs of spaces at the start and end of rows are collapsed into single spaces, blank lines are suppressed.

  rtl | Currently ignored.
  column | First source column, 0 ... pg->columns - 1.
  row | First source row, 0 ... pg->rows - 1.
  width | Number of columns to print, 1 ... pg->columns.
  height | Number of rows to print, 1 ... pg->rows.

Print a subsection of a Teletext or Closed Caption vbi_page, rows separated by linefeeds "\n", in the desired format. All character attributes and colors will be lost. Graphics characters, DRCS and all characters not representable in the target format will be replaced by spaces.

Returns
  Number of bytes written into buf, a value of zero when some error occurred. In this case buf may contain incomplete data. Note this function does not append a terminating null character.

References vbi_page::columns, vbi_page::rows, vbi_char::size, vbi_page::text, vbi_char::unicode, vbi_is_print(), and vbi_ucs2be().

Referenced by vbi_print_page().

## vbi_print_page()

_vbi_inline int vbi_print_page | ( | vbi_page * | pg,
|  | char * | buf,
|  | int | size,
|  | const char * | format,
|  | vbi_bool | table,
|  | vbi_bool | ltr )

Parameters

  pg | Source page.
  buf | Memory location to hold the output.
  size | Size of the buffer in bytes. The function fails when the data exceeds the buffer capacity.
  format | Character set name for iconv() conversion, for example "ISO-8859-1".
  table | When `FALSE`, runs of spaces at the start and end of rows will be collapsed into single spaces, blank lines are suppressed.
  ltr | Currently ignored, please set to `TRUE`.

Print a Teletext or Closed Caption vbi_page, rows separated by linefeeds "\n", in the desired format. All character attributes and colors will be lost. Graphics characters, DRCS and all characters not representable in the target format will be replaced by spaces.

Returns
  Number of bytes written into buf, a value of zero when some error occurred. In this case buf may contain incomplete data. Note this function does not append a terminating null character.

References vbi_page::columns, vbi_page::rows, and vbi_print_page_region().

## vbi_set_brightness()

void vbi_set_brightness | ( | vbi_decoder * | vbi,
|  | int | brightness )

extern

Parameters

  vbi | Initialized vbi decoding context.
  brightness | 0 dark ... 255 bright, default 128.

Change brightness of text pages, this affects the color palette of pages fetched with vbi_fetch_vt_page() and vbi_fetch_cc_page().

## vbi_set_contrast()

void vbi_set_contrast | ( | vbi_decoder * | vbi,
|  | int | contrast )

extern

Parameters

  vbi | Initialized vbi decoding context.
  contrast | -128 inverse ... 0 none ... 127 maximum, default 64.

Change contrast of text pages, this affects the color palette of pages fetched with vbi_fetch_vt_page() and vbi_fetch_cc_page().