/** * Control for vout display */ static int Control(vout_display_t *vd, int query, va_list args) { VLC_UNUSED(args); vout_display_sys_t *sys = vd->sys; switch (query) { case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: /* We have to ignore what is requested */ vout_display_SendEventPicturesInvalid(vd); return VLC_SUCCESS; case VOUT_DISPLAY_RESET_PICTURES: if (sys->pool) picture_pool_Release(sys->pool); sys->pool = NULL; vd->fmt.i_width = aa_imgwidth(sys->aa_context); vd->fmt.i_height = aa_imgheight(sys->aa_context); return VLC_SUCCESS; case VOUT_DISPLAY_HIDE_MOUSE: aa_hidemouse(sys->aa_context); return VLC_SUCCESS; default: msg_Err(vd, "Unsupported query in vout display aalib"); return VLC_EGENERIC; } }
/***************************************************************************** * Create: allocates aa video thread output method ***************************************************************************** * This function allocates and initializes a aa vout method. *****************************************************************************/ static int Create( vlc_object_t *p_this ) { vout_thread_t *p_vout = (vout_thread_t *)p_this; /* Allocate structure */ p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) { msg_Err( p_vout, "out of memory" ); return( 1 ); } /* Don't parse any options, but take $AAOPTS into account */ aa_parseoptions( NULL, NULL, NULL, NULL ); if (!(p_vout->p_sys->aa_context = aa_autoinit(&aa_defparams))) { msg_Err( p_vout, "cannot initialize aalib" ); return( 1 ); } p_vout->pf_init = Init; p_vout->pf_end = End; p_vout->pf_manage = Manage; p_vout->pf_render = Render; p_vout->pf_display = Display; p_vout->p_sys->i_width = aa_imgwidth(p_vout->p_sys->aa_context); p_vout->p_sys->i_height = aa_imgheight(p_vout->p_sys->aa_context); aa_autoinitkbd( p_vout->p_sys->aa_context, 0 ); aa_autoinitmouse( p_vout->p_sys->aa_context, AA_MOUSEPRESSMASK ); aa_hidemouse( p_vout->p_sys->aa_context ); return( 0 ); }
void aa_flush(aa_context * c) { if (c->driver->print != NULL) aa_display(c, 0, 0, aa_imgwidth(c), aa_imgheight(c)); if (c->driver->flush != NULL) { int cursor=c->mousemode; if(cursor&&c->mousedriver!=NULL&&(c->mousedriver->flags&AA_HIDECURSOR)) aa_hidemouse(c); c->driver->flush(c); if(cursor&&c->mousedriver!=NULL&&(c->mousedriver->flags&AA_HIDECURSOR)) aa_showmouse(c); } }
int main(int argc, char **argv) { aa_context *c; int i, y; char s[256]; aa_renderparams *p; strcpy(s, "line editor."); if (!aa_parseoptions(NULL, NULL, &argc, argv) || argc != 1) { printf("%s\n", aa_help); exit(1); } c = aa_autoinit(&aa_defparams); if (c == NULL) { printf("Can not intialize aalib\n"); exit(2); } if (!aa_autoinitkbd(c, 0)) { printf("Can not intialize keyboard\n"); aa_close(c); exit(3); } for (i = 0; i < aa_imgwidth(c); i++) for (y = 0; y < aa_imgheight(c); y++) aa_putpixel(c, i, y, i + y < 80 ? i : ((i + y) < 100 ? (i + y == 89 ? 150 : 0) : y * 8)); aa_hidecursor(c); aa_fastrender(c, 0, 0, aa_scrwidth(c), aa_scrheight(c)); aa_printf(c, 0, 0, AA_SPECIAL, "Fast rendering routine %i",1); aa_flush(c); aa_getkey(c, 1); aa_edit(c, 0, 1, 20, s, 256); aa_puts(c, 0, 0, AA_SPECIAL, "Key lookup test "); aa_flush(c); int ch; while ((ch = aa_getevent(c, 1)) != ' ') { char s[80]; sprintf(s, "Key event test-space to exit. c:%i", ch); aa_puts(c, 0, 0, AA_SPECIAL, s); aa_flush(c); } if (aa_autoinitmouse(c, AA_MOUSEALLMASK)) { int co = 0; sprintf(s, "Mouse test-space to exit"); aa_puts(c, 0, 0, AA_SPECIAL, s); aa_flush(c); while (aa_getevent(c, 1) != ' ') { int x, y, b; char s[80]; co++; aa_getmouse(c, &x, &y, &b); sprintf(s, "Mouse test-space to exit. x:%i y:%i b:%i event #%i ", x, y, b, co); aa_puts(c, 0, 0, AA_SPECIAL, s); aa_flush(c); } aa_hidemouse(c); while (aa_getevent(c, 1) != ' ') { int x, y, b; char s[80]; co++; aa_getmouse(c, &x, &y, &b); sprintf(s, "Hidden mouse test-space to exit. x:%i y:%i b:%i event #%i ", x, y, b, co); aa_puts(c, 0, 0, AA_SPECIAL, s); aa_flush(c); } aa_uninitmouse(c); } p = aa_getrenderparams(); for (i = 0; i < AA_DITHERTYPES; i++) { p->dither = i; aa_render(c, p, 0, 0, aa_scrwidth(c), aa_scrheight(c)); aa_puts(c, 0, 0, AA_SPECIAL, aa_dithernames[i]); aa_flush(c); aa_getkey(c, 1); } for (i = 0; i < 255; i += 32) { p->bright = i; aa_render(c, p, 0, 0, aa_scrwidth(c), aa_scrheight(c)); aa_puts(c, 0, 0, AA_SPECIAL, "Normal rendering - bright changes"); aa_flush(c); aa_getkey(c, 1); } p->bright = 0; for (i = 0; i < 128; i += 16) { p->contrast = i; aa_render(c, p, 0, 0, aa_scrwidth(c), aa_scrheight(c)); aa_puts(c, 0, 0, AA_SPECIAL, "Normal rendering - contrast changes"); aa_flush(c); aa_getkey(c, 1); } p->contrast = 0; for (i = 0; i < 255; i += 32) { p->gamma = 1 + i / 32.0; aa_render(c, p, 0, 0, aa_scrwidth(c), aa_scrheight(c)); aa_puts(c, 0, 0, AA_SPECIAL, "Normal rendering - gamma changes"); aa_flush(c); aa_getkey(c, 1); } p->gamma = 1.0; for (i = 0; i < 255; i += 32) { p->randomval = i; aa_render(c, p, 0, 0, aa_scrwidth(c), aa_scrheight(c)); aa_puts(c, 0, 0, AA_SPECIAL, "Normal rendering - randomval changes"); aa_flush(c); aa_getkey(c, 1); } aa_close(c); return 0; }