2020-01-13 21:29:53 +00:00
|
|
|
% notcurses_fade(3)
|
|
|
|
% nick black <nickblack@linux.com>
|
2021-01-21 07:44:00 +00:00
|
|
|
% v2.1.6
|
2020-01-13 21:29:53 +00:00
|
|
|
|
|
|
|
# NAME
|
|
|
|
|
|
|
|
notcurses_fade - fade ncplanes in and out
|
|
|
|
|
|
|
|
# SYNOPSIS
|
|
|
|
|
2020-04-19 22:46:32 +00:00
|
|
|
**#include <notcurses/notcurses.h>**
|
2020-01-13 21:29:53 +00:00
|
|
|
|
|
|
|
```c
|
2020-06-01 07:53:44 +00:00
|
|
|
struct ncfadectx;
|
|
|
|
|
2020-01-17 14:30:53 +00:00
|
|
|
// Called for each delta performed in a fade on ncp. If anything but 0 is
|
|
|
|
// returned, the fading operation ceases immediately, and that value is
|
|
|
|
// propagated out. If provided and not NULL, the faders will not themselves
|
|
|
|
// call notcurses_render().
|
2020-06-01 07:53:44 +00:00
|
|
|
typedef int (*fadecb)(struct notcurses* nc, struct ncplane* ncp, const struct timespec*, void* curry);
|
2020-01-13 21:29:53 +00:00
|
|
|
```
|
|
|
|
|
2020-11-06 21:44:06 +00:00
|
|
|
**bool notcurses_canfade(const struct notcurses* ***nc***);**
|
2020-01-13 21:29:53 +00:00
|
|
|
|
2020-11-06 21:44:06 +00:00
|
|
|
**int ncplane_fadeout(struct ncplane* ***n***, const struct timespec* ***ts***, fadecb ***fader***, void* ***curry***);**
|
2020-01-13 21:29:53 +00:00
|
|
|
|
2020-11-06 21:44:06 +00:00
|
|
|
**int ncplane_fadein(struct ncplane* ***n***, const struct timespec* ***ts***, fadecb ***fader***, void* ***curry***);**
|
2020-01-17 14:30:53 +00:00
|
|
|
|
2020-11-06 21:44:06 +00:00
|
|
|
**int ncplane_pulse(struct ncplane* ***n***, const struct timespec* ***ts***, fadecb ***fader***, void* ***curry***);**
|
2020-01-13 21:29:53 +00:00
|
|
|
|
2020-11-06 21:44:06 +00:00
|
|
|
**struct ncfadectx* ncfadectx_setup(struct ncplane* ***n***);**
|
2020-06-01 07:53:44 +00:00
|
|
|
|
2020-11-06 21:44:06 +00:00
|
|
|
**int ncfadectx_iterations(const struct ncfadectx* ***nctx***);**
|
2020-06-01 07:53:44 +00:00
|
|
|
|
2020-11-06 21:44:06 +00:00
|
|
|
**int ncplane_fadeout_iteration(struct ncplane* ***n***, struct ncfadectx* ***nctx***, int ***iter***, fadecb ***fader***, void* ***curry***);**
|
2020-06-01 07:53:44 +00:00
|
|
|
|
2020-11-06 21:44:06 +00:00
|
|
|
**int ncplane_fadein_iteration(struct ncplane* ***n***, struct ncfadectx* ***nctx***, int ***iter***, fadecb ***fader***, void* ***curry***);**
|
2020-06-01 07:53:44 +00:00
|
|
|
|
2020-11-06 21:44:06 +00:00
|
|
|
**void ncfadectx_free(struct ncfadectx* ***nctx***);**
|
2020-06-01 07:53:44 +00:00
|
|
|
|
2020-01-13 21:29:53 +00:00
|
|
|
# DESCRIPTION
|
|
|
|
|
2020-06-01 07:53:44 +00:00
|
|
|
**ncplane_fadeout**, **ncplane_fadein**, and **ncplane_pulse** are simple
|
|
|
|
APIs for fading planes in and out. Fades require either RGB support or
|
|
|
|
palette reprogramming support from the terminal (the RGB method is
|
|
|
|
preferred, and will be used whenever possible). The **ts** parameter
|
|
|
|
specifies the total amount of time for the fade operation. The operation
|
|
|
|
itself is time-adaptive (i.e. if it finds itself falling behind, it will
|
|
|
|
skip iterations; if it is proceeding too quickly, it will sleep).
|
|
|
|
|
|
|
|
These are wrappers around the more flexible **ncfadectx** API. Create an
|
|
|
|
**ncfadectx** with **ncfadectx_setup**. The number of possible state changes
|
|
|
|
(iterations) can be accessed with **ncfadectx_iterations**. A state can be
|
|
|
|
reached with **ncplane_fadeout_iteration** or **ncplane_fadein_iteration**.
|
|
|
|
Finally, destroy the **ncfadectx** with **ncfadectx_free**.
|
|
|
|
|
2020-01-13 21:29:53 +00:00
|
|
|
# RETURN VALUES
|
|
|
|
|
2020-06-01 07:53:44 +00:00
|
|
|
**ncplane_fadeout_iteration** and **ncplane_fadein_iteration** will propagate
|
|
|
|
out any non-zero return value from the callback **fader**.
|
|
|
|
|
2020-01-13 21:29:53 +00:00
|
|
|
# BUGS
|
|
|
|
|
2020-06-01 07:53:44 +00:00
|
|
|
Palette reprogramming can affect other contents of the terminal in complex
|
|
|
|
ways. This is not a problem when the RGB method is used.
|
|
|
|
|
2020-01-13 21:29:53 +00:00
|
|
|
# SEE ALSO
|
|
|
|
|
2020-06-01 07:53:44 +00:00
|
|
|
**clock_nanosleep(2)**,
|
2020-05-09 00:56:39 +00:00
|
|
|
**notcurses(3)**,
|
|
|
|
**notcurses_plane(3)**
|