Exemplo n.º 1
0
static int
fb_redraw_bitmap(fbtk_widget_t *widget, fbtk_callback_info *cbi)
{
    nsfb_bbox_t bbox;
    nsfb_bbox_t rect;
    nsfb_t *nsfb;

    nsfb = fbtk_get_nsfb(widget);

    fbtk_get_bbox(widget, &bbox);

    rect = bbox;

    nsfb_claim(nsfb, &bbox);

    /* clear background */
    if ((widget->bg & 0xFF000000) != 0) {
        /* transparent polygon filling isnt working so fake it */
        nsfb_plot_rectangle_fill(nsfb, &bbox, widget->bg);
    }

    /* plot the image */
    nsfb_plot_bitmap(nsfb,
                     &rect,
                     (nsfb_colour_t *)widget->u.bitmap.bitmap->pixdata,
                     widget->u.bitmap.bitmap->width,
                     widget->u.bitmap.bitmap->height,
                     widget->u.bitmap.bitmap->width,
                     !widget->u.bitmap.bitmap->opaque);

    nsfb_update(nsfb, &bbox);

    return 0;
}
Exemplo n.º 2
0
static bool 
framebuffer_plot_bitmap(int x, int y,
                        int width, int height,
                        struct bitmap *bitmap, colour bg,
                        bitmap_flags_t flags)
{
	int xf,yf;
        nsfb_bbox_t loc;
        nsfb_bbox_t clipbox;
        bool repeat_x = (flags & BITMAPF_REPEAT_X);
        bool repeat_y = (flags & BITMAPF_REPEAT_Y);

        nsfb_plot_get_clip(nsfb, &clipbox);

	/* x and y define coordinate of top left of of the initial explicitly
	 * placed tile. The width and height are the image scaling and the
	 * bounding box defines the extent of the repeat (which may go in all
	 * four directions from the initial tile).
	 */

	if (!(repeat_x || repeat_y)) {
		/* Not repeating at all, so just plot it */
                loc.x0 = x;
                loc.y0 = y;
                loc.x1 = loc.x0 + width;
                loc.y1 = loc.y0 + height;

		if ((bitmap->width == 1) && (bitmap->height == 1)) {
			if ((*(nsfb_colour_t *)bitmap->pixdata & 0xff000000) == 0) {
				return true;
			}
			return nsfb_plot_rectangle_fill(nsfb, &loc, *(nsfb_colour_t *)bitmap->pixdata);

		} else {
			return nsfb_plot_bitmap(nsfb, &loc, 
						(nsfb_colour_t *)bitmap->pixdata, 
						bitmap->width, bitmap->height, 
						bitmap->width, !bitmap->opaque);
		}
	}

	/* get left most tile position */
	if (repeat_x)
		for (; x > clipbox.x0; x -= width);

	/* get top most tile position */
	if (repeat_y)
		for (; y > clipbox.y0; y -= height);

	/* tile down and across to extents */
	for (xf = x; xf < clipbox.x1; xf += width) {
		for (yf = y; yf < clipbox.y1; yf += height) {

                        loc.x0 = xf;
                        loc.y0 = yf;
                        loc.x1 = loc.x0 + width;
                        loc.y1 = loc.y0 + height;

		if ((bitmap->width == 1) && (bitmap->height == 1)) {
			if ((*(nsfb_colour_t *)bitmap->pixdata & 0xff000000) != 0) {
				nsfb_plot_rectangle_fill(nsfb, &loc, *(nsfb_colour_t *)bitmap->pixdata);
			}
		} else {
                        nsfb_plot_bitmap(nsfb, &loc, 
                                        (nsfb_colour_t *)bitmap->pixdata, 
                                        bitmap->width, bitmap->height, 
                                        bitmap->width, !bitmap->opaque);
		}
			if (!repeat_y)
				break;
		}
		if (!repeat_x)
	   		break;
	}
	return true;
}
Exemplo n.º 3
0
static int
fb_redraw_bitmap(fbtk_widget_t *widget, fbtk_callback_info *cbi)
{
	LOG(("REDRAW BITMAP"));
	//__menuet__debug_out("REDRAW BITMAP");
	nsfb_bbox_t bbox;
	nsfb_bbox_t rect;
	nsfb_t *nsfb;

	LOG(("REDRAW BITMAP 1 "));
	//__menuet__debug_out("REDRAW BITMAP 1");


	nsfb = fbtk_get_nsfb(widget);

	LOG(("REDRAW BITMAP 2"));
	//__menuet__debug_out("REDRAW BITMAP 2");


	fbtk_get_bbox(widget, &bbox);

	rect = bbox;

	LOG(("REDRAW BITMAP 3 "));
	//__menuet__debug_out("REDRAW BITMAP 3");


	nsfb_claim(nsfb, &bbox);

	LOG(("REDRAW BITMAP 4"));
	//__menuet__debug_out("REDRAW BITMAP 4");

	/* clear background */
	if ((widget->bg & 0xFF000000) != 0) {
		/* transparent polygon filling isnt working so fake it */
		
			LOG(("REDRAW BITMAP 5"));
	//__menuet__debug_out("REDRAW BITMAP 5");

		nsfb_plot_rectangle_fill(nsfb, &bbox, widget->bg);
	}

	LOG(("REDRAW BITMAP 6"));
	//__menuet__debug_out("REDRAW BITMAP 6\n");

	/* plot the image */
	
	LOG(("STUB: DON'T REAL DRAW"));
	//__menuet__debug_out("STUB: DON'T REAL DRAW\n");
	
	
	LOG(("pixdata is %x", (nsfb_colour_t *)widget->u.bitmap.bitmap->pixdata));
	LOG(("pixdata is w:%d h:%d",widget->u.bitmap.bitmap->width,
			 widget->u.bitmap.bitmap->height));
	
	//hmm
	
	//int zap;
	//if (widget->u.bitmap.bitmap->width % 4 != 0) {
	//	zap = widget->u.bitmap.bitmap->width + 2; }
	
	//nsfb_plot_rectangle_fill(nsfb, &rect, 0xFFFFFF);
	
	
	nsfb_plot_bitmap(nsfb,
			 &rect,
			 (nsfb_colour_t *)widget->u.bitmap.bitmap->pixdata,
			 //0, 0, 0, 
			 widget->u.bitmap.bitmap->width,
			 widget->u.bitmap.bitmap->height,
			 widget->u.bitmap.bitmap->width, 
			 !widget->u.bitmap.bitmap->opaque);
	
	
		
	
	
	LOG(("REDRAW BITMAP 7"));
	//__menuet__debug_out("REDRAW BITMAP 7\n");

	nsfb_update(nsfb, &bbox);

	LOG(("REDRAW BITMAP OK\n"));
	//__menuet__debug_out("REDRAW BITMAP OK\n");

	return 0;
}