pub type NcDirect = ncdirect;
Expand description

Minimal notcurses instance for styling text.

Implementations

New NcDirect with the default options.

Initializes a direct-mode notcurses context on the tty.

Direct mode supports a limited subset of notcurses routines, and neither supports nor requires notcurses_render. This can be used to add color and styling to text in the standard output paradigm.

Safety

You must not create multiple NcDirect instances at the same time, on the same thread. You must stop the current one before creating a new one.

C style function: ncdirect_init().

New NcDirect with optional flags.

Safety

You must not create multiple NcDirect instances at the same time, on the same thread. You must stop the current one before creating a new one.

C style function: ncdirect_init().

Releases this NcDirect and any associated resources.

Safety

You must not call this method repeatedly on the same NcDirect instance.

C style function: ncdirect_stop().

Clears the screen.

C style function: ncdirect_clear().

Forces a flush.

C style function: ncdirect_flush().

Takes the result of render_frame and writes it to the output.

C style function: ncdirect_raster_frame().

Renders an image using the specified blitter and scaling, but doesn’t write the result.

The image may be arbitrarily many rows – the output will scroll – but will only occupy the column of the cursor, and those to the right.

To actually write (and free) this, invoke ncdirect_raster_frame().

max_y' and 'max_x (cell geometry, not pixel), if greater than 0, are used for scaling; the terminal’s geometry is otherwise used.

C style function: ncdirect_render_frame().

Displays an image using the specified blitter and scaling.

The image may be arbitrarily many rows – the output will scroll – but will only occupy the column of the cursor, and those to the right.

The render/raster process can be split by using [render_frame][#method.render_frame] and [raster_frame][#method.raster_frame].

C style function: ncdirect_render_image().

Sets the foreground NcPaletteIndex.

C style function: ncdirect_set_fg_palindex().

Sets the background NcPaletteIndex.

C style function: ncdirect_set_bg_palindex().

Returns the number of simultaneous colors claimed to be supported, if there is color support.

Note that several terminal emulators advertise more colors than they actually support, downsampling internally.

C style function: ncdirect_palette_size().

Sets the foreground NcRgb.

C style function: ncdirect_set_fg_rgb().

Sets the background NcRgb.

C style function: ncdirect_set_bg_rgb().

Returns the current styling.

C style function: ncdirect_styles().

Removes the specified styles.

C style function: ncdirect_off_styles().

Adds the specified styles.

C style function: ncdirect_on_styles().

Sets just the specified styles.

C style function: ncdirect_set_styles().

Returns an NcStyle with the supported curses-style attributes.

The attribute is only indicated as supported if the terminal can support it together with color.

For more information, see the “ncv” capability in terminfo(5).

C style function: ncdirect_supported_styles().

Indicates to use the “default color” for the foreground.

C style function: ncdirect_set_fg_default().

Indicates to use the “default color” for the background.

C style function: ncdirect_set_bg_default().

Is there support for acquiring the cursor’s current position?

Requires the u7 terminfo capability, and that we are connected to an actual terminal.

Can we reliably use Unicode braille?

C style function: ncdirect_canbraille().

Can we set the “hardware” palette?

Requires the “ccc” terminfo capability.

C style function: ncdirect_canchangecolor().

Can we fade?

Requires either the “rgb” or “ccc” terminfo capability.

C style function: ncdirect_canfade().

Can we reliably use Unicode halfblocks?

C style function: ncdirect_canhalfblock().

Can we load images?

Requires being built against FFmpeg/OIIO.

C style function: ncdirect_canopen_images().

Can we load videos?

Requires being built against FFmpeg/OIIO.

C style function: ncdirect_canopen_videos().

Can we reliably use Unicode quadrants?

C style function: ncdirect_canquadrant().

Can we reliably use Unicode sextants?

C style function: ncdirect_cansextant().

Can we directly specify RGB values per cell, or only use palettes?

C style function: ncdirect_cantruecolor().

Is our encoding UTF-8?

Requires LANG being set to a UTF8 locale.

C style function: ncdirect_canutf8().

Returns the NcCapabilities.

C style function: ncdirect_capabilities().

Checks for pixel support.

Returns false for no support, or true if pixel output is supported.

This function must successfully return before NCBLIT_PIXEL is available.

Must not be called concurrently with either input or rasterization.

C style function: [ncdirect_check_pixel_support()][c_api::ncdirect_check-pixel_support].

Disables the terminal’s cursor, if supported.

C style function: ncdirect_cursor_disable().

Enables the terminal’s cursor, if supported.

C style function: ncdirect_cursor_enable().

Moves the cursor down any number of rows.

C style function: ncdirect_cursor_down().

Moves the cursor left any number of columns.

C style function: ncdirect_cursor_left().

Moves the cursor right any number of columns.

C style function: ncdirect_cursor_right().

Moves the cursor up any number of rows.

C style function: ncdirect_cursor_up().

Sets the cursor to the specified row y, column x.

C style function: ncdirect_cursor_move_yx().

Sets the cursor to the specified row y.

(No equivalent C style function)

Sets the cursor to the specified column x.

(No equivalent C style function)

Gets the cursor (y, x) position, when supported.

This requires writing to the terminal, and then reading from it. If the terminal doesn’t reply, or doesn’t reply in a way we understand, the results might be detrimental.

C style function: ncdirect_cursor_yx().

Pushes the cursor location to the terminal’s stack.

The depth of this stack, and indeed its existence, is terminal-dependent.

C style function: ncdirect_cursor_push().

Pops the cursor location from the terminal’s stack.

The depth of this stack, and indeed its existence, is terminal-dependent.

C style function: ncdirect_cursor_pop().

Gets the current number of rows.

C style function: ncdirect_dim_y().

Gets the current number of columns.

C style function: ncdirect_dim_x().

Gets the current number of rows and columns.

C style function: ncdirect_dim_y().

Returns the name of the detected terminal.

C style function: ncdirect_detected_terminal().

Returns a char representing a single unicode point.

If an event is processed, the return value is the id field from that event.

Provide a None time to block at length, a time of 0 for non-blocking operation, and otherwise a timespec to bound blocking.

C style function: ncdirect_get().

Reads input blocking until an event is processed or a signal is received.

Will optionally write the event details in input.

In the case of a valid read, a char is returned.

C style function: ncdirect_get_blocking().

Reads input without blocking.

In the case of a valid read, a char is returned.

If no event is ready, returns 0.

C style function: ncdirect_get_nblock().

Get a file descriptor suitable for input event poll()ing.

When this descriptor becomes available, you can call NcDirect. get_nblock, and input ought be ready.

This file descriptor is not necessarily the file descriptor associated with stdin (but it might be!).

C style function: ncdirect_inputready_fd().

Outputs the string according to the channels, and returns the total number of characters written on success.

Note that it does not explicitly flush output buffers, so it will not necessarily be immediately visible.

It will fail if the NcDirect context and the foreground channel are both marked as using the default color.

C style function: ncdirect_putstr().

Reads a (heap-allocated) line of text using the Readline library.

Initializes Readline the first time it’s called.

For input to be echoed to the terminal, it is necessary that the flag NcDirectFlag::INHIBIT_CBREAK be provided to the constructor.

C style function: ncdirect_readline().

Draws a box with its upper-left corner at the current cursor position, having dimensions ylen * xlen.

See NcPlane.box for more information.

The minimum box size is 2x2, and it cannot be drawn off-screen.

wchars is an array of 6 characters: UL, UR, LL, LR, HL, VL.

C style function: ncdirect_box().

NcDirect.box with the double box-drawing characters.

C style function: ncdirect_double_box().

NcDirect.box with the rounded box-drawing characters.

C style function: ncdirect_rounded_box().

Draws horizontal lines using the specified NcChannelss, interpolating between them as we go.

All lines start at the current cursor position.

The string at egc may not use more than one column.

For a horizontal line, len cannot exceed the screen width minus the cursor’s offset.

C style function: ncdirect_hline_interp().

Draws horizontal lines using the specified NcChannelss, interpolating between them as we go.

All lines start at the current cursor position.

The string at egc may not use more than one column.

For a vertical line, len may be as long as you’d like; the screen will scroll as necessary.

C style function: ncdirect_vline_interp().