notcurses/doc/man/man3/notcurses_fade.3.md

72 lines
2.5 KiB
Markdown
Raw Normal View History

2020-01-13 21:29:53 +00:00
% notcurses_fade(3)
% nick black <nickblack@linux.com>
2020-08-16 15:04:43 +00:00
% v1.6.15
2020-01-13 21:29:53 +00:00
# NAME
notcurses_fade - fade ncplanes in and out
# SYNOPSIS
**#include <notcurses/notcurses.h>**
2020-01-13 21:29:53 +00:00
```c
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().
typedef int (*fadecb)(struct notcurses* nc, struct ncplane* ncp, const struct timespec*, void* curry);
2020-01-13 21:29:53 +00:00
```
2020-01-17 14:30:53 +00:00
**bool notcurses_canfade(const struct notcurses* nc);**
2020-01-13 21:29:53 +00:00
2020-01-17 14:30:53 +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-01-17 14:30:53 +00:00
**int ncplane_fadein(struct ncplane* n, const struct timespec* ts, fadecb fader, void* curry);**
**int ncplane_pulse(struct ncplane* n, const struct timespec* ts, fadecb fader, void* curry);**
2020-01-13 21:29:53 +00:00
**struct ncfadectx* ncfadectx_setup(struct ncplane* n);**
**int ncfadectx_iterations(const struct ncfadectx* nctx);**
**int ncplane_fadeout_iteration(struct ncplane* n, struct ncfadectx* nctx, int iter, fadecb fader, void* curry);**
**int ncplane_fadein_iteration(struct ncplane* n, struct ncfadectx* nctx, int iter, fadecb fader, void* curry);**
**void ncfadectx_free(struct ncfadectx* nctx);**
2020-01-13 21:29:53 +00:00
# DESCRIPTION
**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
**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
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
**clock_nanosleep(2)**,
**notcurses(3)**,
**notcurses_plane(3)**