static int resize(void) { screen_w = caca_get_canvas_width(canvas); screen_h = caca_get_canvas_height(canvas); caca_free_dither(dither); talloc_free(dither_buffer); dither = caca_create_dither(bpp, image_width, image_height, depth * image_width, rmask, gmask, bmask, amask); if (dither == NULL) { mp_msg(MSGT_VO, MSGL_FATAL, "vo_caca: caca_create_dither failed!\n"); return ENOSYS; } dither_buffer = talloc_array(NULL, uint8_t, depth * image_width * image_height); /* Default libcaca features */ caca_set_dither_antialias(dither, dither_antialias); caca_set_dither_charset(dither, dither_charset); caca_set_dither_color(dither, dither_color); caca_set_dither_algorithm(dither, dither_algo); return 0; }
JNIEXPORT void JNICALL Java_org_zoy_caca_Dither_setDitherAntiAliasing(JNIEnv *env, jclass cls, jlong ptr, jstring aa) { const char *aa_chars = (*env)->GetStringUTFChars(env, aa, 0); caca_set_dither_antialias((caca_dither_t *)ptr, aa_chars); (*env)->ReleaseStringUTFChars(env, aa, aa_chars); }
static void check_events(struct vo *vo) { caca_event_t cev; while (caca_get_event(display, CACA_EVENT_ANY, &cev, 0)) { switch (cev.type) { case CACA_EVENT_RESIZE: caca_refresh_display(display); resize(); break; case CACA_EVENT_QUIT: mplayer_put_key(vo->key_fifo, KEY_CLOSE_WIN); break; case CACA_EVENT_MOUSE_MOTION: vo_mouse_movement(vo, cev.data.mouse.x, cev.data.mouse.y); break; case CACA_EVENT_MOUSE_PRESS: if (!vo_nomouse_input) mplayer_put_key(vo->key_fifo, (MOUSE_BTN0 + cev.data.mouse.button - 1) | MP_KEY_DOWN); break; case CACA_EVENT_MOUSE_RELEASE: if (!vo_nomouse_input) mplayer_put_key(vo->key_fifo, MOUSE_BTN0 + cev.data.mouse.button - 1); break; case CACA_EVENT_KEY_PRESS: { int key = cev.data.key.ch; int mpkey = lookup_keymap_table(keysym_map, key); const char *msg_name; if (mpkey) mplayer_put_key(vo->key_fifo, mpkey); else switch (key) { case 'd': case 'D': /* Toggle dithering algorithm */ set_next_str(caca_get_dither_algorithm_list(dither), &dither_algo, &msg_name); caca_set_dither_algorithm(dither, dither_algo); osdmessage(MESSAGE_DURATION, "Using %s", msg_name); break; case 'a': case 'A': /* Toggle antialiasing method */ set_next_str(caca_get_dither_antialias_list(dither), &dither_antialias, &msg_name); caca_set_dither_antialias(dither, dither_antialias); osdmessage(MESSAGE_DURATION, "Using %s", msg_name); break; case 'h': case 'H': /* Toggle charset method */ set_next_str(caca_get_dither_charset_list(dither), &dither_charset, &msg_name); caca_set_dither_charset(dither, dither_charset); osdmessage(MESSAGE_DURATION, "Using %s", msg_name); break; case 'c': case 'C': /* Toggle color method */ set_next_str(caca_get_dither_color_list(dither), &dither_color, &msg_name); caca_set_dither_color(dither, dither_color); osdmessage(MESSAGE_DURATION, "Using %s", msg_name); break; default: if (key <= 255) mplayer_put_key(vo->key_fifo, key); break; } } } } }