Commit Graph

561 Commits

Author SHA1 Message Date
nick black
cab19cf790 Cursor work (placement, drop RETAIN_CURSOR) #953
notcurses_enable_cursor() now accepts placement arguments.
both it and notcurses_disable_cursor() now return int rather
than void. add notcurses_cursor_move_yx().
2020-08-25 03:11:50 -04:00
nick black
df33f381e5 c++ wrappers: cursor_{en,dis}able, iprefix() #952 2020-08-25 01:41:06 -04:00
nick black
4dd1d6a4c8 Annihilate nc_err_e and all infrastructure #948 2020-08-24 17:20:29 -04:00
nick black
026b94969d cffi heap allocations are zero-initialized #942 2020-08-23 22:27:50 -04:00
Nick Black
73dc0a7d69
Zoo 2, electric boogaloo (#939)
* Reimplement the widget zoo demo. The previous PoC
  was a multithreaded monster with behavior dependent
  on screen geometry. Replace it with a single thread state
  machine. Closes #936.
* Support titles for ncplot. Adds title to the ncplot_options
  struct, which may be NULL. Closes #941 .
* Properly color ncplot according to maxchannels and
  minchannels. Closes #940
* Add tools/function-table.sh script for generating public API list.
2020-08-23 12:44:53 -04:00
nick black
32d352173b
ncdirect_flush: struct ncdirect is const 2020-08-23 01:00:00 -04:00
nick black
14d6129007 take-no-prisoners overhaul of ncplane_puttext() #829 2020-08-22 12:51:32 -04:00
nick black
5c533c9f1a
ncplot: support legend styling 2020-08-21 07:34:50 -04:00
nick black
6bb8f447b5
add ncdirect_flush() #926 2020-08-21 02:27:58 -04:00
Nick Black
359ad1d36d
Generalized mergedown #779 (#932)
* Rename ncplane_mergedown -> ncplane_mergedown_simple()
* New ncplane_mergedown(), fully general projection of src to dst
2020-08-20 23:51:35 -04:00
nick black
567ad27455
add comment to ncdirect_putstr() about flushing #926 2020-08-20 22:41:45 -04:00
nick black
706d492ecd add channels_set_*_palindex() 2020-08-20 21:07:20 -04:00
nick black
2e5a8b78d5
add trivial new iprefix() 2020-08-20 17:37:12 -04:00
Nick Black
e1cf346ddb
internalize highgradient_sized implementation #920 (#922)
internalize highgradient_sized implementation #920
2020-08-19 13:15:26 -04:00
nick black
1e334fa63e
new 'gradients' PoC #920 2020-08-19 12:33:47 -04:00
nick black
05da44b06b
hide blending functions #917 2020-08-18 08:41:55 -04:00
José Luis Cruz
3e3c8c1514
minor fix: use already defined variable 2020-08-18 14:09:01 +02:00
José Luis Cruz
c4498e485e
proposal to remove the comment and update the type
Maybe the type may reflect that it's not supposed to be a long now.

Although for what I've learnt about C, in practice it will probably still be a long. And I can't be sure whether in some platforms where it will indeed be a short the code will keep compiling, so maybe it's safer just to remove the outdated comment, or whatever you decide.

I'm just finding things while I work in the bindings =) And I was surprised to learn about the little guarantees C gives regarding the types sizes...
2020-08-17 20:54:15 +02:00
nick black
a2c95814b7 Remove cell_simple_p()
Get notcurses-tetris working again, since its collision
detection relied on simple vs non-simple EGCs, which are
no longer an operative concept. Closes #899.
2020-08-16 15:57:32 -04:00
nick black
18d79c195d
python: get us linking once more... 2020-08-16 10:02:14 -04:00
nick black
f9eed1c412 palette_size is unsigned #891 2020-08-16 01:51:34 -04:00
nick black
16ff667325 blissful endianness-opacity
not caring about endianness is the opiate of the masses.
happy, happy masses. remove endianness.h and all its baleful
influence by explicitly breaking up the cell structure. #892
2020-08-16 01:44:36 -04:00
nick black
7811663223 inlined EGCs + styling unit tests #830 2020-08-15 17:38:20 -04:00
nick black
3b76db1166 fuck the bullshit it's time to throw down 2020-08-15 17:38:20 -04:00
nick black
40e85c4143 rotate: use cell_extended_gcluster() #830 2020-08-15 17:38:20 -04:00
nick black
3f142961b3 comments 2020-08-15 17:38:20 -04:00
nick black
226c00c74d egcelide: detect endianness, define NCSTYLE_* accordingly 2020-08-15 17:38:20 -04:00
nick black
fb8efe03e0 cell_strdup(): fix for inline egcs 2020-08-15 17:38:20 -04:00
nick black
b0f7f36995 egc inlining #830 2020-08-15 17:38:20 -04:00
nick black
26899f3544
s/8 bit/8-bit/g 2020-08-13 11:56:18 -04:00
José Luis Cruz
e596f9230f fix ncpixel alpha mask 2020-08-13 11:55:36 -04:00
nick black
52103af364
Cell: overlap RGB and palette indices #884 2020-08-13 11:35:53 -04:00
Nick Black
c3508d524b
ncplane_puttext() work for longer lines (#880)
* The zoo demo made manifest that we had some serious problems handling sequences of longer lines in ncplane_puttext(). This remedies most of the problems, though it's not yet perfect. #871
* Guard notcurses* for NULL in log*() #878 #879
* Fix memory leak in ncdirect_dump_plane()
2020-08-12 02:43:52 -04:00
Nick Black
e7ad2829e9
Merge branch 'master' into joseluis-patch-1 2020-08-11 16:46:18 -04:00
joseLuís
7070e532d6 fix typos 2020-08-11 17:04:09 +02:00
joseLuís
7abda11404 add comments for ncpixel functions 2020-08-11 16:59:39 +02:00
José Luis Cruz
7bd29c9c17
fix return types
I bet those two return types shoud be unsigned
2020-08-11 11:56:25 +02:00
joseLuís
7790913d2f fix typos & improve comments 2020-08-11 11:38:30 +02:00
Nick Black
11d6a4eb89
New reel layout algorithm #818 (#870)
New reel layout algorithm based on trimming and sifting. Fixes the original issue of #818, though I'm not marking that bug fixed until I've resolved the little issues remaining with this one.
Back off CMake version dependency, see if we can get by with 3.11.4 for EPEL8 #851
Simplify tablet drawing tremendously by separating tablet border and data planes. Callbacks no longer need worry about the borders; they can simply fill the plane they're handed. #833
Improve notcurses_debug() a bit
Add ncplane_new_named() and friends to expose plane naming to the user.
Add internal ncplane_genocide() to kill a plane and all its bound descendents
New industrial-strength ncreel unit testing
notcurses-ncreel now accepts -ln for log level n
Add ncplane_parent() and ncplane_parent_const()
2020-08-09 17:40:59 -04:00
joseLuís
2842ffb751 add remaining channel functions 2020-08-08 10:53:32 -04:00
nick black
3bb95824fc update some terminology 2020-08-08 10:53:32 -04:00
nick black
9ae3fe4728 update some terminology 2020-08-07 16:31:50 -04:00
nick black
4c822f80a9
comment and move ncpixel API 2020-08-07 14:34:00 -04:00
José Luis Cruz
7aef3e4fca fix typo
foreground > background
2020-08-07 13:23:36 -04:00
nick black
c618096083
ncselector_redraw(): don't call notcurses_render() #627 2020-08-05 21:26:32 -04:00
nick black
ead60d06cc
unexport cell_egc_idx() 2020-08-02 23:45:58 -04:00
Marek Habersack
2fabe85e6a [C++] API sync
Been a while, apologies :)

Added:
  * Direct: fg_palindex (`ncdirect_fg_palindex`)
  * Direct: bg_palindex (`ncdirect_bg_palindex`)
  * Direct: get_palette_size (`ncdirect_palette_size`)
  * Direct: putstr (`ncdirect_putstr`)
  * Direct: hline_interp (`ncdirect_hline_interp`)
  * Direct: vline_interp (`ncdirect_vline_interp`)
  * Direct: box (`ncdirect_box`)
  * Direct: rounded_box (`ncdirect_rounded_box`)
  * Direct: double_box (`ncdirect_double_box`)
  * Direct: canopen_images (`ncdirect_canopen_images`)
  * Direct: canutf8 (`ncdirect_canutf8`)
  * Menu: get_mouse_selected (`ncmenu_mouse_selected`)
  * NotCurses: version_components (`notcurses_version_components`)
  * NotCurses: str_blitter (`notcurses_str_blitter`)
  * NotCurses: str_scalemode (`notcurses_str_scalemode`)
  * NotCurses: lex_margins (`notcurses_lex_margins`)
  * NotCurses: lex_blitter (`notcurses_lex_blitter`)
  * NotCurses: lex_scalemode (`notcurses_lex_scalemode`)
  * NotCurses: render_to_file (`notcurses_render_to_file`)
  * Plane: putstr_stainable (`ncplane_putstr_stainable`)
  * Plane: printf_stainable (`ncplane_printf_stainable`)
  * Plane: vprintf_stainable (`ncplane_vprintf_stainable`)
  * Reel: offer_input (`ncreel_offer_input`)

Changed:
  * Direct: set_fg_alpha uses `unsigned alpha`
  * Direct: set_bg_alpha uses `unsigned alpha`
  * Plane: set_fg_alpha uses `unsigned alpha`
  * Plane: set_bg_alpha uses `unsigned alpha`
  * Root: made `error_guard` and `error_guard_cond` static
2020-08-01 00:27:20 -04:00
nick black
835a62361d
cell_nobackground_p(): load time, 5% perf win =] =] =] #838 2020-07-31 23:55:14 -04:00
nick black
2dcab374c4 mojibake: fix some row overruns #842 2020-07-31 23:05:09 -04:00
nick black
78a7b4d255 constify ncreader_options->egc 2020-07-30 03:50:44 -04:00
nick black
b8e6458de1
Revert "start working through notcurses.h with inlined utf8 #830"
This reverts commit 17b6706d3e. It
belonged on a branch, and was not intended for master. #830
2020-07-30 00:38:42 -04:00
nick black
17b6706d3e
start working through notcurses.h with inlined utf8 #830 2020-07-29 02:16:21 -04:00
nick black
7174a84e94 zoo: add multiselector 2020-07-29 01:15:50 -04:00
nick black
bac02bccd0
selector/multiselect: kill itemcount options field #831 2020-07-28 22:42:49 -04:00
nick black
17e8f62eb9
cell_no{fore/back}ground() was never intended for export 2020-07-25 21:53:50 -04:00
nick black
6ea968c522 declare ncmenu_mouse_selected() #819 2020-07-23 22:33:21 -04:00
nick black
97571e86af ncplane_putegc_yx() copies directly as opposed to going through putc() #797 2020-07-20 03:20:44 -04:00
nick black
104bbfef50
add notcurses_lex_blitter() 2020-07-19 21:53:01 -04:00
nick black
765ff89a3b
notcurses_str_blitter(): rewrite using objects 2020-07-19 21:41:22 -04:00
nick black
37ceb753bf
notcurses-view: print blitter name #805 2020-07-19 02:54:53 -04:00
Nick Black
dbc83c41b3
linuxconsole PoC (#791)
* use ioctl(KDGETMODE) to detect Linux console
* diagnostic on KDGETMODE
* add logdebug()
* unit test for notcurses_drop_planes(), add ncplane_putnstr_aligned()
* linuxconsole PoC
* linuxconsole: dump unicode->font table
* linuxconsole: explode glyphs
* linuxconsole: show 7 glyphs per 'line'
* linuxconjammer: shim console font with half blocks
* signals: handler for SIGTERM
* man pages: update notcurses_init() for options
* add NCOPTION_NO_FONT_CHANGES #201
2020-07-13 01:21:41 -04:00
nick black
5cf912feb6
ncplane_printf_stainable() and _vfprintf_stainable() #754 2020-07-10 23:58:37 -04:00
nick black
4a97c139e6
add ncplane_putstr_stainable() #754 2020-07-10 23:43:47 -04:00
nick black
a6b002fa77 add ncdirect box-drawing functions #753 2020-07-10 18:41:25 -04:00
nick black
96c6dc8e16 add ncdirect_canopen_images() and ncdirect_canutf8() #753 2020-07-10 18:41:25 -04:00
nick black
c783244185 ncdirect_hline_interp(), ncdirect_vline_interp(), dirlines PoC #753 2020-07-10 18:41:25 -04:00
nick black
750f88b70a split direct into its own header 2020-07-10 18:41:25 -04:00
nick black
3ef1a3a07d
add notcurses_version_components() 2020-07-09 02:17:55 -04:00
Nick Black
162f9910c2
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627

* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 02:02:23 -04:00
nick black
479dd00739
ncreel: purge {tblr}off fields; these are ncplane properties #627 2020-07-06 15:59:29 -04:00
nick black
b6330d142b
add notcurses_render_file() #491 2020-07-05 07:14:07 -04:00
nick black
b829398538 ncdirect_render_image: accept ncalign_e parameter #759 2020-07-03 21:24:00 -04:00
nick black
4863c7e3df
ncdirect_image_render: restore NCBLIT_2x2 #751 2020-07-01 01:14:42 -04:00
nick black
229079696d ncvisual refactoring to support ncdirect 2020-06-30 00:18:02 -04:00
nick black
354152b48b
Redefine CELL_ALPHA_ in their natural forms
CELL_ALPHA_OPAQUE et al were defined as 0..3, meaning
CELL_ALPHA_SHIFT had to be used to compare them to their
channel representations. Instead, define them in said
representation outright, eliminating the need to shift while
retaining arithmetic properties, and zero initialization for
CELL_ALPHA_OPAQUE. Eliminate CELL_ALPHA_SHIFT #738.
2020-06-28 01:53:42 -04:00
Marek Habersack
63b64ff624 [C++] API sync
Added:
  * Direct: render_image (`ncdirect_render_image`)
  * NotCurses: can_truecolor (`notcurses_cantruecolor`)
  * Plane: home (`ncplane_home`)
  * Plane: perimeter_rounded (`ncplane_perimeter_rounded`)
  * Plane: perimeter_double (`ncplane_perimeter_double`)
  * Plane: is_fg_default (`ncplane_fg_default_p`)
  * Plane: is_bg_default (`ncplane_bg_default_p`)
  * Plot: sample (`nc{d,u}plot_sample`)
  * Visual: geom (`ncvisual_geom`)

Fixed:
  * Plot: {set,add}_sample - `x` coord is always `uint64_t`
2020-06-23 08:03:48 -04:00
nick black
4a3d436e5b
drone: update builders 2020-06-19 14:10:18 -04:00
nick black
79d3ae67e4
add notcurses_cantruecolor() 2020-06-18 11:04:29 -04:00
nick black
355021de56
ncneofetch: print ram/processes #550 2020-06-18 01:34:07 -04:00
nick black
d084513172
ncvisual_geom: account for scaling #726 2020-06-17 21:30:47 -04:00
nick black
7ca5a7e82c
ncneofetch: create info plane #550 2020-06-17 19:39:37 -04:00
Nick Black
0084dbaa6d
qrcode generalization #699 (#713)
Add convenience function ncplane_home(). Add an ncblitter_e param
to ncplane_qrcode(), and split int maxversion into value-result
int* ymax and int* xmax. Write the actual sizes of the resulting
visual into these parameters. Update the qrcode demo. Add the
qrcode PoC. Update demos to ncplane_home(), where possible.

ncplane_qrcode() now takes an ncblitter_e and two value-result int*s
in the place of a single value int. The final size of the displayed qrcode
is written to *ymax and *xmax. If the code can't fit within the specified
dimensions, an error is returned. Standard rules for pluggable blitters
apply regarding fallback etc. #699
2020-06-13 22:24:50 -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
f98acad7f6
add NCPLOT_OPTIONS_DETECTMAXONLY #610 2020-06-09 12:02:42 -04:00
nick black
a10ba4dac6
highgradient: degrade to gradient #700 #696 2020-06-09 06:08:29 -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
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
Marek Habersack
4d2e4e82d3 [C++] API sync
Changed:

 * Visual: tiny reformatting to fit the overall ncpp style
 * Visual: added error guard in `render`
 * Visual: error_guard update in `rotate`

Added:

 * Visual: simple_streamer (`ncvisual_simple_streamer`)
 * Visual: polyfill (`ncvisual_polyfill_yx`)
 * Visual: at (`ncvisual_at_yx`)
 * Visual: set (`ncvisual_set_yx`)
2020-06-07 20:22:13 -04:00
nick black
b2dcc50606
notcurses_options: fold bools into flags 2020-06-07 05:08:46 -04:00
nick black
465f4694b8
rename pixel -> ncpixel 2020-06-06 23:14: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
633ef1f76c
add beginnings of yield demo 2020-06-05 15:14:07 -04:00
nick black
b172d2b97e
NCVISUAL_OPTION_MAYDEGRADE -> NCVISUAL_OPTION_NODEGRADE, doc 'em 2020-06-05 08:05:02 -04:00
nick black
9a0f0c66fe
ncblit: accept an ncvisual_options #680 2020-06-05 03:47:13 -04:00
nick black
b72a386aa3
ncplane_dup(): adjust for marginalia #679 2020-06-05 01:30:29 -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