Commit Graph

1486 Commits

Author SHA1 Message Date
nick black
3e23ca524f normal: improve coloring 2020-06-12 07:26:44 -04:00
nick black
b119cec29e
normal: finally move to pi/4 rotations #599 2020-06-12 04:15:44 -04:00
nick black
dc49bb943b
demo: destory about screen before restarting #706 2020-06-12 02:21:20 -04:00
nick black
e74e7860c5
demo: explicitly set menu/about colors #705 2020-06-12 02:12:47 -04:00
nick black
a069745c49
notcurses-ncreel: remove unused field 'id' 2020-06-12 00:55:07 -04:00
nick black
3936d1b528
adapt callers of ncvisual_geom() 2020-06-12 00:53:34 -04:00
nick black
70183ee283
Rewrite plot tests using C interface #703
The Plot unit tests were reaching directly into the objects,
which meant the implementations couldn't include anything
we didn't want public. This was annoying, so I've changed it.
This required adding ncdplot_sample() and ncuplot_sample(),
which we should have had anyway.
2020-06-12 00:13:01 -04:00
nick black
185742fd08
Rendering now does tripartite fallback to basecell
Each plane has a "base cell", which like all other cells is
initialized to the null glyph, opaque default foreground color,
and opaque default background color. Prior to this change, at
each cell of a plane, we decided whether to use that cell (the
"viscell") or the base cell depending on whether the viscell had
a non-null glyph. We now evaluate each component independently.
If the viscell has a null glyph, we use the base cell's glyph.
If the viscell has a default foreground, we use the base's fg.
If the viscell has a default background, we use the base's bg.
This was done because (a) it seems more intuitive (if I set a cell
to red, I expect red, not red iff there's a glyph in that cell
for this plane), and (b) because otherwise it was impossible to
do a multicolor overlay without blowing away underlying glyphs
(since without a glyph, you always reduced to the same base cell,
which could have only one fore- and background per render).

Existing code will need to change any instances where cells
lacking glyphs are colored, and those colors are not desired.
Since any such coloring had no effect before, it seems unlikely
that any ought exist (this did bring to light an instance in
the "qrcode" demo where we were staining overmuch of the plane).

This closes #395, the last big open worry regarding our API.
2020-06-11 23:10:03 -04:00
nick black
4391c661be
don't pull logging into plot #703 2020-06-10 09:47:24 -04:00
nick black
f98acad7f6
add NCPLOT_OPTIONS_DETECTMAXONLY #610 2020-06-09 12:02:42 -04:00
nick black
2b89b0850c
jungle/normal: improve behavior under ASCII mode #696 2020-06-09 07:24:47 -04:00
nick black
a10ba4dac6
highgradient: degrade to gradient #700 #696 2020-06-09 06:08:29 -04:00
nick black
20322fe805
demo improvements for ASCII mode (#696)
* eagle: use new ncvisual_geom() to properly zoom
* qrcode: skip for now (#699)
* luigi: draw with spaces, not full blocks
2020-06-09 05:12:30 -04:00
nick black
af46077775
ncvisual_geom: take degradation into account #697
In order to properly determine the scaling of an ncvisual to
be rendered, ncvisual_geom() needs know the blitting method.
For this reason, it took an ncblitter_e argument. It also,
however, needs handle degradation, which means knowing whether
NCVISUAL_OPTIONS_NODEGRADE is in use. It thus really wants the
struct ncvisual_options. Pass and accept it. Closes #697, and
fixes the "yield" demo in ASCII mode (#696).
2020-06-09 05:00:08 -04:00
nick black
827c2f2013
ncplot: don't print spaces #695 2020-06-09 04:46:54 -04:00
nick black
0e1617811f
eagle: require UTF8 for now #697 #696 2020-06-09 04:45:00 -04:00
nick black
09f3f9097d
input: extract most of main() into input_demo() 2020-06-08 05:14:22 -04:00
nick black
1cd3ffc89a
outro: transparent legend at borrom #687 2020-06-08 04:57:26 -04:00
nick black
1ffd871784
blocks poc: handle std coredump-free #645 2020-06-08 04:37:42 -04:00
nick black
a3369d77a9
outro: plug memory leak post-fade 2020-06-08 03:33:48 -04:00
nick black
c8caa23090
brailleblitter: honor transparency #649 2020-06-08 03:19:42 -04:00
Nick Black
28431914a8
First go at ncplane_puttext() (#690)
Very simple take at ncplane_puttext(), a new function for linebroken text. Also some very basic unit tests. I doubt this works very well yet, but it handles the simplest cases #682. Added nclog(), internal function for logging. #520
2020-06-08 03:01:58 -04:00
nick black
7736e4a7dc all: don't put legend so far away from plane 2020-06-08 01:31:42 -04:00
nick black
841c0a4b8f
quadblitter: respect transparency #686 2020-06-07 19:46:03 -04:00
nick black
10cbaedc77
visual: implement NC_SCALE on both paths #683 2020-06-07 19:32:13 -04:00
nick black
f1da9406f9
view: plug small memory leak 2020-06-07 19:13:32 -04:00
nick black
7e6ec274bb
view: clear standard plane between renders #685 2020-06-07 18:59:22 -04:00
nick black
6e7996f1a8
notcurses_init: properly check flags for unknowns 2020-06-07 16:11:21 -04:00
nick black
b2dcc50606
notcurses_options: fold bools into flags 2020-06-07 05:08:46 -04:00
nick black
e2b43092c3
outro: fade in samoa while fading out changes #652 2020-06-07 03:22:14 -04:00
nick black
700d59dbad
yield demo: don't stain menu 2020-06-07 00:51:50 -04:00
nick black
71f6b7b02e
USAGE: pixel -> ncpixel 2020-06-06 23:39:52 -04:00
nick black
465f4694b8
rename pixel -> ncpixel 2020-06-06 23:14:24 -04:00
nick black
9f97b7b969
demo HUD: unify blur 2020-06-06 22:32:16 -04:00
nick black
77362a50f4
yield demo looks hot, hot, hot! 2020-06-06 22:14:06 -04:00
nick black
990f401427
ncvisual_set_yx() 2020-06-06 21:39:24 -04:00
nick black
d863220e23
add pixels PoC 2020-06-06 21:38:05 -04:00
nick black
fb13b148e9
add Pixel API 2020-06-06 19:34:48 -04:00
nick black
2c417ddb0c
yield demo: punch up with polyfills 2020-06-06 05:11:45 -04:00
nick black
cb521e3de7
allglyph: always have room for the legend 2020-06-06 03:10:18 -04:00
nick black
633ef1f76c
add beginnings of yield demo 2020-06-05 15:14:07 -04:00
nick black
787e66a4c8
fallin': use NCBLIT_2x2 2020-06-05 13:01:36 -04:00
nick black
595a697146
notcurses-view: space now pauses #603 2020-06-05 11:51:05 -04:00
nick black
050b44628a
punch up luigi and purpdrank with NCBLIT_2x2 2020-06-05 11:50:50 -04:00
nick black
b172d2b97e
NCVISUAL_OPTION_MAYDEGRADE -> NCVISUAL_OPTION_NODEGRADE, doc 'em 2020-06-05 08:05:02 -04:00
nick black
deda0ff681
mention notcurses_reader.3 in notcurses.3 2020-06-05 05:56:29 -04:00
nick black
cd2cc6f340
allglyph: add a counter showing the current glyph 2020-06-05 04:51:04 -04:00
nick black
84ae45ef39
remove all libsixel crap #200 2020-06-05 04:19:56 -04:00
nick black
9a0f0c66fe
ncblit: accept an ncvisual_options #680 2020-06-05 03:47:13 -04:00
nick black
358c9a5c73
normal: grab a square region to avoid flickering #678 2020-06-05 02:31:57 -04:00
nick black
d73c12be6f
ncvisual_from_plane: argument inversion error #678 2020-06-05 02:31:36 -04:00
nick black
5a1b1146d3
jungle demo: eliminate plot bleedthrough 2020-06-05 01:34:16 -04:00
nick black
b72a386aa3
ncplane_dup(): adjust for marginalia #679 2020-06-05 01:30:29 -04:00
nick black
e268301a42
demo: reset standard plane base char for each demo #675 2020-06-05 01:12:48 -04:00
nick black
deb3c8bfcb
outro: kill rendering turds #675 2020-06-05 01:12:35 -04:00
nick black
e1d34c4f43
ncplane_highgradient: only pass a single channel #676 2020-06-05 00:36:42 -04:00
Nick Black
de23139111
Open some whoopass on ncvisual rotation (#677)
Whip the ol' llama's ass (fix ncvisual rotation)

* notcurses: flush cursor change requests #673
* rotator: verify ncplane_rgba and ncblit_rgba
* ncblit: rename, accept ncblitter_e #674
* rotator: render from rgba
* rotator: get to rotation
* rotator: add a pi/4 turn at the end
* normal: reuse incoming plane for rendering #672
* rotator poc: rotate a fullplane gradient #672
* normal demo: place visual correctly
* rotator: verify ncplane_rgba and ncblit_rgba
* ncblit: rename, accept ncblitter_e #674
* rotator: render from rgba
* rotator: add a pi/4 turn at the end
* normal: reuse incoming plane for rendering #672
* rotator poc: rotate a fullplane gradient #672
* normal demo: place visual correctly
* rotator poc: throw some red into gradient
* rotator poc: done #662
* oiio: ncvisual_resize() needs set ibuf pointer #662
* normal: only need erase at top of loop
* visual poc: shorter delay
* normal demo: center rendered visual
* comment ncvisual_resize() call
* ncvisual_rotate: call ncvisual_details_seed()
* ffmpeg ncvisual: fix rotation #662
2020-06-04 22:47:38 -04:00
nick black
dbe779365b ncplane_rgba(): correct order sampling colors #672 2020-06-04 19:59:15 -04:00
nick black
12fce6ddb7 notcurses: flush cursor change requests #673 2020-06-04 14:55:32 -04:00
nick black
df8d4951e6
oiio: new streamer api 2020-06-03 22:27:35 -04:00
nick black
1b0a4cb41a normal demo: fill in all lines 2020-06-03 22:21:56 -04:00
nick black
e92b46421a
quadblitter: pick closer inductance pixel #667 2020-06-03 17:40:30 -04:00
nick black
0b06fa5cd4
quadblitter: trilerp on induction #667 2020-06-03 17:35:33 -04:00
nick black
a8beaf8e56
notcurses-view: switch between blitters with 0--8 #671 2020-06-03 17:00:48 -04:00
nick black
c0f820db94
notcurses-view: select blitter with numbers #671 2020-06-03 16:32:27 -04:00
nick black
75f458d69a
ncplane_yx: results are relative to bound plane 2020-06-03 12:17:51 -04:00
nick black
6d5e027be9
notcurses-demo: compactify usage message #669 2020-06-03 11:14:05 -04:00
nick black
bc6305b08e
notcurses_debug: handle bound planes 2020-06-03 09:02:37 -04:00
nick black
d41c6d3627
notcurses-ncreel: add </>/* operators 2020-06-03 08:58:48 -04:00
nick black
b65437a53f
O(1) plane bondage #670
Make ncplane_reparent() O(1).
Make ncplane_delete() O(1)
O(1) link severance for planes bound to deleted plane.
Allglyph demo requires UTF8.
2020-06-03 08:37:29 -04:00
nick black
e99abeae01 ncplane_destroy: remove plane from bound list 2020-06-03 07:37:42 -04:00
nick black
1c05994a05
normal: plug memory leaks on exit paths #624 2020-06-03 04:50:09 -04:00
nick black
e32e4d9744
egcpool_stash: exit on strdup() failure #624 2020-06-03 04:44:13 -04:00
nick black
96a47de845
merge cell unit tests 2020-06-03 04:25:31 -04:00
nick black
7d41d30043
allglyphs: colorize 2020-06-03 03:27:41 -04:00
nick black
8c8d862d23
allglyph: only render at end of line 2020-06-03 03:22:43 -04:00
nick black
c55e4bb7bf
xray: allow video to show through (blend bg) 2020-06-03 03:10:41 -04:00
nick black
9d9caf28cd
notcurses_debug: show binding information #656 2020-06-02 22:55:01 -04:00
nick black
35bda058b0
uniblock demo: simplify, maaaaaaaan 2020-06-02 22:49:18 -04:00
nick black
5ff84cb9dd
add 'a'llglyphs demo #668 2020-06-02 21:42:52 -04:00
nick black
2abe8ca5a8 lerp: toss one into the prediv 2020-06-02 18:33:04 -04:00
nick black
efa51e9cf2 quadrant blitter #648
Novel blitter using Unicode quadrant glyphs. 2:1 cell aspect ratio, but
double the horizonal resolution of the half block blitter.
2020-06-02 18:33:04 -04:00
nick black
e462ea2bef
ncvisual_rotate: check result of ncvisual_resize() 2020-06-01 23:53:35 -04:00
nick black
15bd5cfd56
notcurses-view: properly handle resize
Since notcurses-view is now rendering to the standard plane, and
ncvisual is no longer bound to a plane, there's no need to call
ncplane_resize() (and doing so fails, since you can't resize the
standard plane). Remove the call, leave the check. Fixes resizing.
2020-06-01 22:34:12 -04:00
nick black
6cadea3138
outro: keep riser on top 2020-06-01 17:00:50 -04:00
nick black
23001ab792
geomdata -> notcurses_blitters if it must be public 2020-06-01 16:18:06 -04:00
nick black
2d0ca67fc5
scan-build fix -- assign r on all paths (ncvisual_stream) 2020-06-01 15:22:46 -04:00
nick black
cc46571a43
Restore raise(SIGKILL) to execv error paths #636 2020-06-01 11:53:26 -04:00
nick black
aef66efb4e
ncvisual_stream: honor first ncvisual_decode() 2020-06-01 10:34:03 -04:00
nick black
4fb012a12d
ncreel_destroy(): use ncreel_del() directly #664 2020-06-01 10:03:04 -04:00
nick black
38c0509d86
notcurses_init: properly initialize rstate cursor
When we first begin operations, we need emit a cursor homing, which
we were not doing for the first line. As a result, the first row
didn't show up until you rendered something else, and even then
didn't show up unless you changed it (as it was otherwise undamaged).
This explains a lot of mystery behavior in notcurses-demo that I've
long told myself I'd hallucinated or imagined. Hurrah! but also
supershittytothemax! Thanks Marek Habersack for pointing out something
which led to an experiment which led to chasing this down once and
forever. Closes #619, w00t!
2020-06-01 09:42:22 -04:00
nick black
002f65fb54
init_lang(): properly invoke setlocale() for LANG 2020-06-01 09:16:05 -04:00
nick black
e3c14ed569
plot: color labels correctly 2020-06-01 09:00:46 -04:00
nick black
0cda775900
metric: use FE_TONEAREST instead of TOWARDZERO #615 2020-06-01 08:25:59 -04:00
nick black
343b4d144e
demo: purge use_oiio/use_nomm 2020-06-01 06:21:38 -04:00
nick black
ec1af2d090 oiio: fix image rendering 2020-06-01 04:44:02 -04:00
nick black
4f5c8ef3d7 eagle/outro support for non-multimedia builds 2020-06-01 04:44:02 -04:00
nick black
2d3fef115e ncfadectx_setup(): remove timespec param #659 2020-06-01 04:44:02 -04:00
nick black
3deeecdf2e fade: finish out proposed API, basic unit tests #659 2020-06-01 04:44:02 -04:00
nick black
74e8e9c3d9 fade: move more reproduced code into common area #659 2020-06-01 04:44:02 -04:00
nick black
0766dd08e7 fade: factor out duplicated maxsteps determination #659 2020-06-01 04:44:02 -04:00
nick black
3ff083b73f Fade API: move control of delays into callback 2020-06-01 04:44:02 -04:00
nick black
be35dee206 reuse and destroy new plane in OIIO streamer #660 2020-06-01 04:44:02 -04:00
nick black
607353d96c reuse and destroy newly-created plane in ncvisual_stream() #660 2020-06-01 04:44:02 -04:00
nick black
a617598f13 notcurses_drop_planes(): fix up links #661 2020-06-01 00:33:24 -04:00
nick black
e879bf8f93
let outro demo run on no-multimedia builds 2020-05-31 23:15:43 -04:00
nick black
8709387590 Implement CELL_ALPHA_BLEND for all blitters #652 2020-05-31 21:56:09 -04:00
nick black
6a9bbad91e
Visual C++ constructor test #538 2020-05-29 19:59:46 -04:00
nick black
0331ae4c4c
introduce NCVISUAL_OPTION_BLEND #652 2020-05-29 14:53:53 -04:00
nick black
acd956393b
subproc: remove debugging cruft 2020-05-29 09:03:20 -04:00
nick black
33318254b2
absorb first ncvisual_decode into ncvisual_from_file() #655 2020-05-29 08:39:11 -04:00
nick black
10b134b596
outro: render the first frame of samoa along with changes #652 2020-05-29 08:15:47 -04:00
nick black
8da22e4425
zaxis: reset links in the direction of travel 2020-05-29 08:14:36 -04:00
nick black
f47bde1c4e
Graceful fallback among blitters #637
If we're in ASCII mode, no blitter except for NCBLIT_1x1 is going to
work. Whenever NCBLIT_DEFAULT is provided, select NCBLIT_1x1 if we're
in ASCII mode. Add NCVISUAL_OPTIONS_MAYDEGRADE and
NCPLOT_OPTIONS_MAYDEGRADE. Both serve to allow smooth degradation when a
blitter other than NCBLIT_DEFAULT has been provided. Closes #637.

Make calc_gradient_cell() static inline so our templated ncppplot
implementation can use it (ugh). When using NCBLIT_1x1 for plots in
ASCII mode, use space rather than full block, and invert colors.

Use NCBLIT_DEFAULT in the demo for the FPS plot.
2020-05-29 01:24:34 -04:00
nick black
33c0e7fa2c
banner: reset stderr after printing any warnings 2020-05-28 23:30:43 -04:00
nick black
cce55f1d4e
ncplot: fix top row calculations #642 2020-05-28 23:23:05 -04:00
Nick Black
ebcba82d4b
Fully general ncvisual layer (#647)
This represents an essentially complete rewrite of ncvisual and associated code. It had two major goals:

Improve the ncvisual API based off lessons learned, pursuant to the upcoming API freeze. In particular, I wanted to:

decouple ncvisuals from ncplanes. It should be possible to render a ncvisual to multiple planes, with different scaling each time. It should be possible to create an ncvisual without a plane, etc.
normalize the various ways of constructing an ncvisual -- file, memory, plane, etc.
Support multiple blitters, from 7-bit ASCII to Sixel. This required writing the blitters in several cases, and they're not yet in their final implementations (but the API is fine)
I have not yet unified Plots and Visuals, and might not, given that the Plot code works fine. We could at this point implement Plots in terms of Visuals, though -- the blitter backend range has been unified. Sixel is not yet implemented, though it is listed.

There is a new POC tool, blitter. It renders its arguments using all possible blitter+scaling combinations. Another new POC, resize, displays its argument, then resizes it to the screen size and displays that, explicitly making use of ncvisual_resize() rather than a scaling parameter to ncvisual_render().

This also eliminates some memory leaks and bugs we were seeing in trunk, and brings in Sixel scaffolding.

The C++ wrapper will also need patching back up; I cut most of it down while wrestling with this crap, urk.

Closes #638, #562, and #622.
2020-05-28 21:16:58 -04:00
nick black
b80ac3d241
demo: move HUD/about to top of screen 2020-05-26 05:27:25 -04:00
Marek Habersack
b5d8549bb3 [C++] Allow multiple instances of NotCurses
This is to make it possible, in the future, to create multiple instances
of `NotCurses` for multiple terminals.  The first instance of
`NotCurses` becomes the default one, so that any instances of other
classes that aren't explicitly created with a pointer to another
`NotCurses` instance still work as expected.

Note that currently trying to call `notcurses_init` twice results in the
following error for me:

    0x55555559bfc0 is already registered for signals
    Couldn't drop signals: 0x55555559bfc0 != 0x5555555b6720
    terminate called after throwing an instance of 'ncpp::init_error*'

    Program received signal SIGABRT, Aborted.

The error is signalled by `setup_signals` and the pointer shown in the
message points to the first `struct notcurses` instance created.
2020-05-26 04:34:31 -04:00
nick black
e097723a63
subproc: on older linux, fall back to fork() 2020-05-24 04:00:22 -04:00
nick black
8971bda0c2 ncpp: stop() resets _instance, add unit test #538 2020-05-24 03:34:46 -04:00
nick black
4347cd956a merge in master changes 2020-05-24 03:34:46 -04:00
nick black
9675ed251e
eagle demo: work with ascii mode #634 2020-05-23 22:43:08 -04:00
Marek Habersack
9ca8d9c9c6 Correctly cast ncpp::Plane to ncplane*
Fixes: https://github.com/dankamongmen/notcurses/issues/616

SIGSEGV was caused by an invalid cast.

Short explanation: PEBKAC

Long explanation: `Selector.hh`, `Plot.hh` and `MultiSelector.hh` did
not include `Plane.hh`, they merely declared `class Plane;` because
inclusion of `Plane.hh` would cause circular dependencies to appear and
the compiler would be unhappy.  On top of that, yours truly wrenched the
compiler's hands and caused it to believe that a pointer to `Plane` is
really a pointer to `ncplane*` which was quite a silly thing to do as
the compiler, not having included `Plane.hh` and thus not knowing full
definition of the type, wasn't able to look up the type cast operator in
`Plane`.

Don't abuse `reinterpret_cast`, kids!
2020-05-23 20:26:13 -04:00
nick black
ba8d80d444
procroller: don't recurse on argv[0], whoops 2020-05-22 09:16:41 -04:00
nick black
cce9384ab8
ncmetric: adapt PREFIXFMT to multibyte #630 2020-05-22 06:46:23 -04:00
nick black
4e9f46e063
Correct scaling in qrcode_rows() 2020-05-22 05:50:41 -04:00
nick black
e682b4fae8
qrcode: only render sufficiently small codes #629 2020-05-22 05:46:49 -04:00
nick black
f425944bba
FreeBSD: move back to getrandom(); read_random() is kernelspace 2020-05-22 05:32:47 -04:00
nick black
2b5546fc4c
plot: make 8x1 the default glyph geometry 2020-05-22 01:47:23 -04:00
nick black
7215bf92ad
throw somed attributes on a few functions 2020-05-21 21:10:04 -04:00
nick black
7e12436196
reader poc: fix Plane memory leak #624 2020-05-21 18:08:19 -04:00
nick black
57fb7fc96a
sgr poc: don't put critical logic in assert() #624 2020-05-21 18:03:36 -04:00
nick black
f9f76046d5
sgr poc: don't put critical logic in assert() #624 2020-05-21 18:02:53 -04:00
nick black
4ab0e67155
tetris: rely on c++ exceptions #621 2020-05-21 17:37:39 -04:00
nick black
37a4114f42
O(1) z-axis moves #623
Replace the singly-linked z-axis with a doubly-linked list,
and reimplement all z-axis moves as O(1) functions.
Eliminate ncplane_move_{above/below}_unsafe(), as there are no
longer unsafe moves.
2020-05-20 15:32:27 -04:00
nick black
2edb7fe690
handle clang11 -Wc99-designator 2020-05-19 23:01:48 -04:00
nick black
3119a87801 init_banner(): need use stdio directly for styling 2020-05-19 22:53:06 -04:00
nick black
99bd3fd597
recenter post-rotation in normal demo #617 2020-05-19 19:39:16 -04:00
nick black
bcdf513e31
direct poc: exit out on bad ncdirect_cursor_up() 2020-05-19 09:08:10 -04:00
nick black
e5b1c2cdea
view/demo/tetris: NCOPTION_INHIBIT_SETLOCALE 2020-05-19 08:52:36 -04:00
nick black
818ec25778
notcurses_stop: call del_curterm, plug memory leak 2020-05-19 08:51:09 -04:00
nick black
7f2888269f
all PoCs: use NCOPTION_INHIBIT_SETLOCALE 2020-05-19 08:44:39 -04:00
nick black
381263e9fe
Unify interrogate_terminfo() #614 2020-05-19 07:32:26 -04:00
nick black
30412d54ce
ncreel: fix up rendering, reel display #618 2020-05-19 07:02:25 -04:00
nick black
8ff3402166
move terminfo cache into its own shared struct #614 2020-05-19 05:49:49 -04:00
nick black
bd4d4ef321 import init_banner() outfactoring 2020-05-19 04:02:34 -04:00
nick black
390dc208ba freebsd: use read_random() 2020-05-19 03:37:26 -04:00
nick black
321908d824
ncplane_vprintf_prep(): remove dumb comment #612 2020-05-18 14:57:20 -04:00
nick black
e80ac4ddb9
normal demo: work with odd number of columns :/ 2020-05-17 10:26:48 -04:00