Exemple #1
0
w3mimg_op *
w3mimg_fbopen()
{
    w3mimg_op *wop = NULL;
    wop = (w3mimg_op *) malloc(sizeof(w3mimg_op));
    if (wop == NULL)
	return NULL;
    memset(wop, 0, sizeof(w3mimg_op));

    if (!check_tty_console(getenv("W3M_TTY")) &&
	strncmp("fbterm", getenv("TERM"), 6) != 0 &&
	strncmp("jfbterm", getenv("TERM"), 7) != 0) {
	fprintf(stderr, "w3mimgdisplay/fb: tty is not console\n");
	goto error;
    }

    if (fb_open())
	goto error;

    wop->width = fb_width();
    wop->height = fb_height();

    wop->init = w3mfb_init;
    wop->finish = w3mfb_finish;
    wop->active = w3mfb_active;
    wop->set_background = w3mfb_set_background;
    wop->sync = w3mfb_sync;
    wop->close = w3mfb_close;
    wop->clear = w3mfb_clear;

    wop->load_image = w3mfb_load_image;
    wop->show_image = w3mfb_show_image;
    wop->free_image = w3mfb_free_image;
    wop->get_image_size = w3mfb_get_image_size;

    /* XXX */
    fb_image_init();

    return wop;
  error:
    free(wop);
    return NULL;
}
Exemple #2
0
/*
 * Initialize screen according framebuffer
 */
int fb_screen_init(FB_SCREEN *screenp, FB *fbp) 
{
	int i;

	screenp->width = fbp->fb_vinfo.xres;
	screenp->height = fbp->fb_vinfo.yres;
	screenp->screensize = fbp->fb_screensize;
	screenp->fb_start = fbp->fb_start;
	screenp->pixelbits = fbp->fb_vinfo.bits_per_pixel;
	screenp->screenstart = malloc(sizeof(char) * screenp->screensize);

	for(i = 0; i < 2; i++){
		//int fb_image_init(FB_IMAGE *imagep, int width, int height, int components);
		fb_image_init(&screenp->screen_buf[i], screenp->width,
			      screenp->height, screenp->pixelbits / 8);

		fb_image_setpos(&screenp->screen_buf[i], 0, 0);
	}

	return 0;
}
Exemple #3
0
/*
 * Deal joke mode code
 */
int maindeal_option_joke(struct mainstatus *status, uint16_t code)
{
	FB_IMAGE retimg;
	FB_IMAGE rotaimg;
	FB_IMAGE image;
	int running;
	uint16_t cur_key_code;
	float radian;
	int loc;
	int i, j, pad;

	//int fb_image_init(FB_IMAGE *imagep, int width, int height, int components);
	fb_image_init(&rotaimg, 100, 100, 4);


	loc = status->img_mini_cur_pos + status->img_mini_offset;
	if(loc >= status->img_list_len){
		loc -= status->img_list_len;
	}

	//int effects_img_get(FB_SCREEN *screenp, char *imagename, FB_IMAGE *imagep);
	effects_img_get(&status->screen, status->img_list[loc], &image);

	//int fb_image_full_image(FB_IMAGE *imagep, FB_IMAGE *retimgp, int flag);
	fb_image_full_image(&image, &rotaimg, IMAGE_FULL_LOCK);

	//int effects_img_destory(FB_IMAGE *imagep)
	effects_img_destory(&image);

	fb_screen_clear(&status->screen);

	running = 1;
	radian = 0;
	cur_key_code = 0;
	fb_image_setpos(&rotaimg, 200, 200);

	fb_image_rotate2(&rotaimg, &retimg, radian);
	/* if you not understand, you should ignore it! it's math! */
	pad = (status->screen.width - 3 * retimg.width) / 4 / 8;

	/* main loop */
	while(running && radian > -1){
		common_change_code(&cur_key_code, global_key_code);

		if(cur_key_code != 0 && cur_key_code != KEY_8){
			running = 0;
		}
		
		//int fb_image_rotate(FB_IMAGE *imagep, FB_IMAGE *retimgp, float radian)
		fb_image_rotate2(&rotaimg, &retimg, radian);
		
		for(i = 0; i < 3; i++){
			for(j = 0; j < 3; j++){
				fb_image_setpos(&retimg, (i + 1) * pad * 8 + i * retimg.width,
						(j + 1) * pad * 6 + j * retimg.height - 50);
				fb_screen_add_image(&status->screen, &retimg);
			}
		}
		
		fb_screen_update(&status->screen);
		
		fb_image_destory(&retimg);
		
		radian += 0.05;

		usleep(1000);
	}
	
	status->mode = DB_VIEW_MODE;
	status->view_flag = 1;
	maindeal_img_view_entry(status);

	fb_image_destory(&rotaimg);

	return 0;
}