2020-03-07 23:36:49 +00:00
|
|
|
#include "main.h"
|
2020-05-06 09:49:22 +00:00
|
|
|
#include <cmath>
|
2020-05-04 15:05:52 +00:00
|
|
|
#include <vector>
|
2020-03-07 23:36:49 +00:00
|
|
|
|
2020-05-04 15:05:52 +00:00
|
|
|
void RotateCW(struct notcurses* nc, struct ncplane* n) {
|
2020-03-07 23:36:49 +00:00
|
|
|
CHECK(0 == notcurses_render(nc));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == ncplane_rotate_cw(n));
|
2020-03-07 23:36:49 +00:00
|
|
|
CHECK(0 == notcurses_render(nc));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == ncplane_rotate_cw(n));
|
2020-03-07 23:36:49 +00:00
|
|
|
CHECK(0 == notcurses_render(nc));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == ncplane_rotate_cw(n));
|
2020-03-07 23:36:49 +00:00
|
|
|
CHECK(0 == notcurses_render(nc));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == ncplane_rotate_cw(n));
|
2020-03-07 23:36:49 +00:00
|
|
|
CHECK(0 == notcurses_render(nc));
|
|
|
|
}
|
|
|
|
|
2020-05-04 15:05:52 +00:00
|
|
|
void RotateCCW(struct notcurses* nc, struct ncplane* n) {
|
2020-03-07 23:36:49 +00:00
|
|
|
CHECK(0 == notcurses_render(nc));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == ncplane_rotate_ccw(n));
|
2020-03-07 23:36:49 +00:00
|
|
|
CHECK(0 == notcurses_render(nc));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == ncplane_rotate_ccw(n));
|
2020-03-07 23:36:49 +00:00
|
|
|
CHECK(0 == notcurses_render(nc));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == ncplane_rotate_ccw(n));
|
2020-03-07 23:36:49 +00:00
|
|
|
CHECK(0 == notcurses_render(nc));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == ncplane_rotate_ccw(n));
|
2020-03-07 23:36:49 +00:00
|
|
|
CHECK(0 == notcurses_render(nc));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Rotate") {
|
2020-05-11 08:57:20 +00:00
|
|
|
if(!enforce_utf8()){
|
|
|
|
return;
|
|
|
|
}
|
2020-06-16 03:58:43 +00:00
|
|
|
auto nc_ = testing_notcurses();
|
2020-05-17 11:57:21 +00:00
|
|
|
if(!nc_){
|
|
|
|
return;
|
|
|
|
}
|
2020-03-07 23:36:49 +00:00
|
|
|
int dimy, dimx;
|
|
|
|
struct ncplane* n_ = notcurses_stddim_yx(nc_, &dimy, &dimx);
|
|
|
|
REQUIRE(n_);
|
|
|
|
|
|
|
|
uint64_t ul, ur, ll, lr;
|
|
|
|
ul = ur = ll = lr = 0;
|
2020-09-17 19:34:28 +00:00
|
|
|
channels_set_fg_rgb(&ul, 0x40f040);
|
|
|
|
channels_set_bg_rgb(&ul, 0x40f040);
|
|
|
|
channels_set_fg_rgb(&ll, 0xf040f0);
|
|
|
|
channels_set_bg_rgb(&ll, 0xf040f0);
|
|
|
|
channels_set_fg_rgb(&ur, 0x40f040);
|
|
|
|
channels_set_bg_rgb(&ur, 0x40f040);
|
|
|
|
channels_set_fg_rgb(&lr, 0xf040f0);
|
|
|
|
channels_set_bg_rgb(&lr, 0xf040f0);
|
2020-03-07 23:36:49 +00:00
|
|
|
|
|
|
|
SUBCASE("RotateTransparentCW") {
|
2020-09-18 08:01:19 +00:00
|
|
|
struct ncplane* testn = ncplane_new(n_, 8, 16, dimy / 2, dimx / 2, nullptr, nullptr);
|
2020-03-07 23:36:49 +00:00
|
|
|
uint64_t channels = 0;
|
|
|
|
CHECK(0 == channels_set_fg_alpha(&channels, CELL_ALPHA_TRANSPARENT));
|
|
|
|
CHECK(0 == channels_set_bg_alpha(&channels, CELL_ALPHA_TRANSPARENT));
|
2020-04-18 04:09:14 +00:00
|
|
|
REQUIRE(0 >= ncplane_set_base(testn, "", 0, channels));
|
2020-03-07 23:36:49 +00:00
|
|
|
cell tl = CELL_TRIVIAL_INITIALIZER; cell tr = CELL_TRIVIAL_INITIALIZER;
|
|
|
|
cell bl = CELL_TRIVIAL_INITIALIZER; cell br = CELL_TRIVIAL_INITIALIZER;
|
|
|
|
cell hl = CELL_TRIVIAL_INITIALIZER; cell vl = CELL_TRIVIAL_INITIALIZER;
|
|
|
|
CHECK(-1 < cell_prime(testn, &tl, "█", 0, ul));
|
|
|
|
CHECK(-1 < cell_prime(testn, &tr, "█", 0, ur));
|
|
|
|
CHECK(-1 < cell_prime(testn, &bl, "█", 0, ll));
|
|
|
|
CHECK(-1 < cell_prime(testn, &br, "█", 0, lr));
|
|
|
|
CHECK(-1 < cell_prime(testn, &hl, "█", 0, ll));
|
|
|
|
CHECK(-1 < cell_prime(testn, &vl, "█", 0, lr));
|
|
|
|
CHECK(0 == ncplane_perimeter(testn, &tl, &tr, &bl, &br, &hl, &vl, 0));
|
|
|
|
RotateCW(nc_, testn);
|
|
|
|
cell_release(testn, &tl); cell_release(testn, &tr);
|
|
|
|
cell_release(testn, &bl); cell_release(testn, &br);
|
|
|
|
cell_release(testn, &hl); cell_release(testn, &vl);
|
|
|
|
CHECK(0 == ncplane_destroy(testn));
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("RotateGradientCW") {
|
|
|
|
// should be a square, and should remain a square through rotations
|
2020-09-18 08:01:19 +00:00
|
|
|
struct ncplane* testn = ncplane_new(n_, 8, 16, dimy / 2, dimx / 2, nullptr, nullptr);
|
2020-03-29 09:26:56 +00:00
|
|
|
REQUIRE(0 < ncplane_gradient_sized(testn, " ", 0, ul, ur, ll, lr, 8, 16));
|
2020-03-07 23:36:49 +00:00
|
|
|
RotateCW(nc_, testn);
|
|
|
|
CHECK(0 == ncplane_destroy(testn));
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("RotateRectangleCW") {
|
|
|
|
// should be a square, and should remain a square through rotations
|
2020-09-18 08:01:19 +00:00
|
|
|
struct ncplane* testn = ncplane_new(n_, 8, 32, dimy / 2, dimx / 2, nullptr, nullptr);
|
2020-03-29 09:26:56 +00:00
|
|
|
REQUIRE(0 < ncplane_gradient_sized(testn, " ", 0, ul, ur, ll, lr, 8, 32));
|
2020-03-07 23:36:49 +00:00
|
|
|
RotateCW(nc_, testn);
|
|
|
|
CHECK(0 == ncplane_destroy(testn));
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("RotateGradientCCW") {
|
|
|
|
// should be a square, and should remain a square through rotations
|
2020-09-18 08:01:19 +00:00
|
|
|
struct ncplane* testn = ncplane_new(n_, 8, 16, dimy / 2, dimx / 2, nullptr, nullptr);
|
2020-03-29 09:26:56 +00:00
|
|
|
REQUIRE(0 < ncplane_gradient_sized(testn, " ", 0, ul, ur, ll, lr, 8, 16));
|
2020-03-07 23:36:49 +00:00
|
|
|
RotateCCW(nc_, testn);
|
|
|
|
CHECK(0 == ncplane_destroy(testn));
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("RotateRectangleCCW") {
|
|
|
|
// should be a square, and should remain a square through rotations
|
2020-09-18 08:01:19 +00:00
|
|
|
struct ncplane* testn = ncplane_new(n_, 8, 32, 0, 0, nullptr, nullptr);
|
2020-03-29 09:26:56 +00:00
|
|
|
REQUIRE(0 < ncplane_gradient_sized(testn, " ", 0, ul, ur, ll, lr, 8, 32));
|
2020-03-07 23:36:49 +00:00
|
|
|
RotateCCW(nc_, testn);
|
|
|
|
CHECK(0 == ncplane_destroy(testn));
|
|
|
|
}
|
|
|
|
|
2020-05-04 15:05:52 +00:00
|
|
|
// use half of each dimension
|
|
|
|
SUBCASE("RotateRGBACW") {
|
2020-05-07 03:16:00 +00:00
|
|
|
int height = dimy / 2;
|
|
|
|
int width = dimx / 2;
|
|
|
|
std::vector<uint32_t> rgba(width * height, 0xffbbccff);
|
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-29 01:16:58 +00:00
|
|
|
for(int i = 0 ; i < height * width / 2 ; ++i){
|
|
|
|
CHECK(0xffbbccff == rgba[i]);
|
|
|
|
}
|
|
|
|
auto ncv = ncvisual_from_rgba(rgba.data(), height, width * 4, width);
|
2020-05-04 15:05:52 +00:00
|
|
|
REQUIRE(ncv);
|
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-29 01:16:58 +00:00
|
|
|
ncvisual_options opts{};
|
|
|
|
auto rendered = ncvisual_render(nc_, ncv, &opts);
|
|
|
|
REQUIRE(rendered);
|
2020-06-06 09:11:45 +00:00
|
|
|
uint32_t* rgbaret = ncplane_rgba(rendered, NCBLIT_DEFAULT, 0, 0, -1, -1);
|
2020-05-07 03:16:00 +00:00
|
|
|
REQUIRE(rgbaret);
|
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-29 01:16:58 +00:00
|
|
|
for(int i = 0 ; i < height * width / 2 ; ++i){
|
2020-06-28 05:53:42 +00:00
|
|
|
if(rgbaret[i] & CELL_BG_RGB_MASK){
|
2020-06-05 06:31:36 +00:00
|
|
|
CHECK(rgbaret[i] == rgba[i]);
|
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-29 01:16:58 +00:00
|
|
|
}
|
2020-05-07 03:16:00 +00:00
|
|
|
}
|
|
|
|
free(rgbaret);
|
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-29 01:16:58 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
2020-05-07 03:50:24 +00:00
|
|
|
for(int x = 0 ; x < width ; ++x){
|
2020-08-15 23:25:08 +00:00
|
|
|
uint16_t stylemask;
|
2020-05-07 03:50:24 +00:00
|
|
|
uint64_t channels;
|
2020-08-15 23:25:08 +00:00
|
|
|
char* c = notcurses_at_yx(nc_, 0, x, &stylemask, &channels);
|
2020-05-07 03:50:24 +00:00
|
|
|
REQUIRE(c);
|
|
|
|
CHECK(0 == strcmp(c, " "));
|
2020-09-17 19:34:28 +00:00
|
|
|
if(channels_fg_rgb(channels) & CELL_BG_RGB_MASK){
|
|
|
|
CHECK(0xffccbb == channels_fg_rgb(channels));
|
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-29 01:16:58 +00:00
|
|
|
}
|
2020-09-17 19:34:28 +00:00
|
|
|
if(channels_bg_rgb(channels) & CELL_BG_RGB_MASK){
|
|
|
|
CHECK(0xffccbb == channels_bg_rgb(channels));
|
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-29 01:16:58 +00:00
|
|
|
}
|
2020-05-07 03:50:24 +00:00
|
|
|
free(c);
|
|
|
|
}
|
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-29 01:16:58 +00:00
|
|
|
opts.n = rendered;
|
|
|
|
// FIXME check pixels after all rotations
|
2020-05-13 02:57:28 +00:00
|
|
|
CHECK(0 == ncvisual_rotate(ncv, M_PI / 2));
|
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-29 01:16:58 +00:00
|
|
|
CHECK(ncvisual_render(nc_, ncv, &opts));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
2020-05-13 02:57:28 +00:00
|
|
|
CHECK(0 == ncvisual_rotate(ncv, M_PI / 2));
|
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-29 01:16:58 +00:00
|
|
|
CHECK(ncvisual_render(nc_, ncv, &opts));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
2020-05-13 02:57:28 +00:00
|
|
|
CHECK(0 == ncvisual_rotate(ncv, M_PI / 2));
|
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-29 01:16:58 +00:00
|
|
|
CHECK(ncvisual_render(nc_, ncv, &opts));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
2020-05-13 02:57:28 +00:00
|
|
|
CHECK(0 == ncvisual_rotate(ncv, M_PI / 2));
|
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-29 01:16:58 +00:00
|
|
|
CHECK(ncvisual_render(nc_, ncv, &opts));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
ncvisual_destroy(ncv);
|
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-29 01:16:58 +00:00
|
|
|
ncplane_destroy(rendered);
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("RotateRGBACCW") {
|
2020-05-07 03:16:00 +00:00
|
|
|
int height = dimy / 2;
|
|
|
|
int width = dimx / 2;
|
|
|
|
std::vector<uint32_t> rgba(width * height, 0xffbbccff);
|
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-29 01:16:58 +00:00
|
|
|
auto ncv = ncvisual_from_rgba(rgba.data(), height, width * 4, width);
|
2020-05-04 15:05:52 +00:00
|
|
|
REQUIRE(ncv);
|
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-29 01:16:58 +00:00
|
|
|
ncvisual_options opts{};
|
|
|
|
auto rendered = ncvisual_render(nc_, ncv, &opts);
|
|
|
|
REQUIRE(rendered);
|
2020-06-06 09:11:45 +00:00
|
|
|
uint32_t* rgbaret = ncplane_rgba(rendered, NCBLIT_DEFAULT, 0, 0, -1, -1);
|
2020-05-07 03:16:00 +00:00
|
|
|
REQUIRE(rgbaret);
|
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-29 01:16:58 +00:00
|
|
|
for(int i = 0 ; i < height * width / 2 ; ++i){
|
2020-06-28 05:53:42 +00:00
|
|
|
if(rgbaret[i] & CELL_BG_RGB_MASK){
|
2020-06-05 06:31:36 +00:00
|
|
|
CHECK(rgbaret[i] == rgba[i]);
|
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-29 01:16:58 +00:00
|
|
|
}
|
2020-05-07 03:16:00 +00:00
|
|
|
}
|
|
|
|
free(rgbaret);
|
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-29 01:16:58 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
2020-06-01 08:24:04 +00:00
|
|
|
for(int x = 0 ; x < width ; ++x){
|
2020-08-15 23:25:08 +00:00
|
|
|
uint16_t stylemask;
|
2020-05-07 03:50:24 +00:00
|
|
|
uint64_t channels;
|
2020-08-15 23:25:08 +00:00
|
|
|
char* c = notcurses_at_yx(nc_, 0, x, &stylemask, &channels);
|
2020-05-07 03:50:24 +00:00
|
|
|
REQUIRE(c);
|
|
|
|
CHECK(0 == strcmp(c, " "));
|
2020-09-17 19:34:28 +00:00
|
|
|
if(channels_fg_rgb(channels) & CELL_BG_RGB_MASK){
|
|
|
|
CHECK(0xffccbb == channels_fg_rgb(channels));
|
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-29 01:16:58 +00:00
|
|
|
}
|
2020-09-17 19:34:28 +00:00
|
|
|
if(channels_bg_rgb(channels) & CELL_BG_RGB_MASK){
|
|
|
|
CHECK(0xffccbb == channels_bg_rgb(channels));
|
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-29 01:16:58 +00:00
|
|
|
}
|
2020-05-07 03:50:24 +00:00
|
|
|
free(c);
|
|
|
|
}
|
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-29 01:16:58 +00:00
|
|
|
// FIXME check pixels after all rotations
|
|
|
|
opts.n = rendered;
|
2020-05-13 02:57:28 +00:00
|
|
|
CHECK(0 == ncvisual_rotate(ncv, -M_PI / 2));
|
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-29 01:16:58 +00:00
|
|
|
CHECK(ncvisual_render(nc_, ncv, &opts));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
2020-05-13 02:57:28 +00:00
|
|
|
CHECK(0 == ncvisual_rotate(ncv, -M_PI / 2));
|
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-29 01:16:58 +00:00
|
|
|
CHECK(ncvisual_render(nc_, ncv, &opts));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
2020-05-13 02:57:28 +00:00
|
|
|
CHECK(0 == ncvisual_rotate(ncv, -M_PI / 2));
|
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-29 01:16:58 +00:00
|
|
|
CHECK(ncvisual_render(nc_, ncv, &opts));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
2020-05-13 02:57:28 +00:00
|
|
|
CHECK(0 == ncvisual_rotate(ncv, -M_PI / 2));
|
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-29 01:16:58 +00:00
|
|
|
CHECK(ncvisual_render(nc_, ncv, &opts));
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
ncvisual_destroy(ncv);
|
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-29 01:16:58 +00:00
|
|
|
ncplane_destroy(rendered);
|
2020-05-04 15:05:52 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
}
|
|
|
|
|
2020-03-07 23:36:49 +00:00
|
|
|
CHECK(0 == notcurses_stop(nc_));
|
|
|
|
|
|
|
|
}
|