1notcurses_fade(3) notcurses_fade(3)
2
3
4
6 notcurses_fade - fade ncplanes in and out
7
9 #include <notcurses/notcurses.h>
10
11 struct ncfadectx;
12
13 // Called for each delta performed in a fade on ncp. If anything but 0 is
14 // returned, the fading operation ceases immediately, and that value is
15 // propagated out. If provided and not NULL, the faders will not themselves
16 // call notcurses_render().
17 typedef int (*fadecb)(struct notcurses* nc, struct ncplane* ncp, const struct timespec*, void* curry);
18
19 bool notcurses_canfade(const struct notcurses* nc);
20
21 int ncplane_fadeout(struct ncplane* n, const struct timespec* ts,
22 fadecb fader, void* curry);
23
24 int ncplane_fadein(struct ncplane* n, const struct timespec* ts, fadecb
25 fader, void* curry);
26
27 int ncplane_pulse(struct ncplane* n, const struct timespec* ts, fadecb
28 fader, void* curry);
29
30 struct ncfadectx* ncfadectx_setup(struct ncplane* n);
31
32 int ncfadectx_iterations(const struct ncfadectx* nctx);
33
34 int ncplane_fadeout_iteration(struct ncplane* n, struct ncfadectx* nc‐
35 tx, int iter, fadecb fader, void* curry);
36
37 int ncplane_fadein_iteration(struct ncplane* n, struct ncfadectx* nctx,
38 int iter, fadecb fader, void* curry);
39
40 void ncfadectx_free(struct ncfadectx* nctx);
41
43 ncplane_fadeout, ncplane_fadein, and ncplane_pulse are simple APIs for
44 fading planes in and out. Fades require either RGB support or palette
45 reprogramming support from the terminal (the RGB method is preferred,
46 and will be used whenever possible). The ts parameter specifies the
47 total amount of time for the fade operation. The operation itself is
48 time-adaptive (i.e. if it finds itself falling behind, it will skip
49 iterations; if it is proceeding too quickly, it will sleep).
50
51 These are wrappers around the more flexible ncfadectx API. Create an
52 ncfadectx with ncfadectx_setup. The number of possible state changes
53 (iterations) can be accessed with ncfadectx_iterations. A state can be
54 reached with ncplane_fadeout_iteration or ncplane_fadein_iteration.
55 Finally, destroy the ncfadectx with ncfadectx_free.
56
58 ncplane_fadeout_iteration and ncplane_fadein_iteration will propagate
59 out any non-zero return value from the callback fader.
60
62 Palette reprogramming can affect other contents of the terminal in com‐
63 plex ways. This is not a problem when the RGB method is used.
64
66 clock_nanosleep(2), notcurses(3), notcurses_plane(3)
67
69 nick black <nickblack@linux.com>.
70
71
72
73 v2.2.3 notcurses_fade(3)