mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
ncdirect_render_image: accept ncalign_e parameter #759
This commit is contained in:
parent
46d75c072a
commit
b829398538
@ -122,9 +122,9 @@ namespace ncpp
|
||||
return error_guard (ncdirect_cursor_disable (direct), -1);
|
||||
}
|
||||
|
||||
nc_err_e render_image (const char* file, ncblitter_e blitter, ncscale_e scale) const noexcept
|
||||
nc_err_e render_image (const char* file, ncalign_e align, ncblitter_e blitter, ncscale_e scale) const noexcept
|
||||
{
|
||||
return ncdirect_render_image (direct, file, blitter, scale);
|
||||
return ncdirect_render_image (direct, file, align, blitter, scale);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -154,7 +154,8 @@ API int ncdirect_printf_aligned(struct ncdirect* n, int y, ncalign_e align,
|
||||
// // be arbitrarily many rows -- the output will scroll -- but will only occupy
|
||||
// // the column of the cursor, and those to the right.
|
||||
API nc_err_e ncdirect_render_image(struct ncdirect* n, const char* filename,
|
||||
ncblitter_e blitter, ncscale_e scale);
|
||||
ncalign_e align, ncblitter_e blitter,
|
||||
ncscale_e scale);
|
||||
|
||||
// Clear the screen.
|
||||
API int ncdirect_clear(struct ncdirect* nc);
|
||||
|
@ -506,7 +506,7 @@ int ncdirect_cursor_up(struct ncdirect* nc, int num);
|
||||
int ncdirect_cursor_left(struct ncdirect* nc, int num);
|
||||
int ncdirect_cursor_right(struct ncdirect* nc, int num);
|
||||
int ncdirect_cursor_down(struct ncdirect* nc, int num);
|
||||
nc_err_e ncdirect_render_image(struct ncdirect* n, const char* filename, ncblitter_e blitter, ncscale_e scale);
|
||||
nc_err_e ncdirect_render_image(struct ncdirect* n, const char* filename, ncalign_e align, ncblitter_e blitter, ncscale_e scale);
|
||||
""")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -405,7 +405,8 @@ display_thread(void* vmarshal){
|
||||
drawpalette(m->nc);
|
||||
if(m->dinfo){
|
||||
if(m->dinfo->logofile){
|
||||
if(ncdirect_render_image(m->nc, m->dinfo->logofile, NCBLIT_2x2,
|
||||
if(ncdirect_render_image(m->nc, m->dinfo->logofile,
|
||||
NCALIGN_CENTER, NCBLIT_2x2,
|
||||
NCSCALE_SCALE) != NCERR_SUCCESS){
|
||||
return NULL;
|
||||
}
|
||||
|
@ -282,7 +282,8 @@ ncdirect_dump_plane(ncdirect* n, const ncplane* np){
|
||||
return 0;
|
||||
}
|
||||
|
||||
nc_err_e ncdirect_render_image(ncdirect* n, const char* file, ncblitter_e blitter, ncscale_e scale){
|
||||
nc_err_e ncdirect_render_image(ncdirect* n, const char* file, ncalign_e align,
|
||||
ncblitter_e blitter, ncscale_e scale){
|
||||
nc_err_e ret;
|
||||
struct ncvisual* ncv = ncvisual_from_file(file, &ret);
|
||||
if(ncv == NULL){
|
||||
|
@ -12,15 +12,18 @@ int main(void){
|
||||
if((n = ncdirect_init(NULL, stdout)) == NULL){
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if(ncdirect_render_image(n, "../data/normal.png", NCBLIT_DEFAULT, NCSCALE_STRETCH) != NCERR_SUCCESS){
|
||||
if(ncdirect_render_image(n, "../data/normal.png", NCALIGN_LEFT,
|
||||
NCBLIT_DEFAULT, NCSCALE_STRETCH) != NCERR_SUCCESS){
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
sleep(1);
|
||||
if(ncdirect_render_image(n, "../data/changes.jpg", NCBLIT_DEFAULT, NCSCALE_SCALE) != NCERR_SUCCESS){
|
||||
if(ncdirect_render_image(n, "../data/changes.jpg", NCALIGN_CENTER,
|
||||
NCBLIT_DEFAULT, NCSCALE_SCALE) != NCERR_SUCCESS){
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
sleep(1);
|
||||
if(ncdirect_render_image(n, "../data/warmech.bmp", NCBLIT_DEFAULT, NCSCALE_NONE) != NCERR_SUCCESS){
|
||||
if(ncdirect_render_image(n, "../data/warmech.bmp", NCALIGN_RIGHT,
|
||||
NCBLIT_DEFAULT, NCSCALE_NONE) != NCERR_SUCCESS){
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if(ncdirect_stop(n)){
|
||||
|
Loading…
Reference in New Issue
Block a user