[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`)
pull/690/head
Marek Habersack 4 years ago committed by Nick Black
parent 841c0a4b8f
commit 4d2e4e82d3

@ -63,7 +63,7 @@ namespace ncpp
ncplane* render (const ncvisual_options* vopts) const NOEXCEPT_MAYBE
{
return ncvisual_render (get_notcurses (), visual, vopts); // FIXME error_guard
return error_guard<ncplane*, ncplane*> (ncvisual_render (get_notcurses (), visual, vopts), nullptr);
}
int stream (const ncvisual_options* vopts, nc_err_e* ncerr, float timescale, streamcb streamer, void *curry = nullptr) const NOEXCEPT_MAYBE
@ -78,7 +78,31 @@ namespace ncpp
bool rotate (double rads) const NOEXCEPT_MAYBE
{
return error_guard (ncvisual_rotate (visual, rads), NCERR_SUCCESS); // FIXME invert case
nc_err_e ret = ncvisual_rotate (visual, rads);
return error_guard_cond (ret, ret != NCERR_SUCCESS);
}
bool simple_streamer (ncvisual_options* vopts, const timespec* tspec, void* curry = nullptr) const NOEXCEPT_MAYBE
{
return error_guard (ncvisual_simple_streamer (visual, vopts, tspec, curry), -1);
}
int polyfill (int y, int x, uint32_t rgba) const NOEXCEPT_MAYBE
{
return error_guard<int> (ncvisual_polyfill_yx (visual, y, x, rgba), -1);
}
bool at (int y, int x, uint32_t* pixel) const
{
if (pixel == nullptr)
throw invalid_argument ("'pixel' must be a valid pointer");
return error_guard (ncvisual_at_yx (visual, y, x, pixel), -1);
}
bool set (int y, int x, uint32_t pixel) const NOEXCEPT_MAYBE
{
return error_guard (ncvisual_set_yx (visual, y, x, pixel), -1);
}
private:

Loading…
Cancel
Save