Beispiel #1
0
static void paint_animation(void)
{
    static int pos = 620;
    static int ini = 0;
    static GrContext *grc;
    int ltext, wtext;

    if (!ini) {
	grc = GrCreateContext(620, 30, NULL, NULL);
	if (grc == NULL)
	    return;
	ini = 1;
    }

    grt_left.txo_fgcolor.v = CYAN;
    grt_left.txo_font = grf_std;
    ltext = strlen(animatedtext);
    wtext = GrStringWidth(animatedtext, ltext, &grt_left);

    GrSetContext(grc);
    GrClearContext(DARKGRAY);
    GrDrawString(animatedtext, ltext, pos, 15, &grt_left);
    GrSetContext(grcglob);
    GrBitBlt(NULL, 10, 8, grc, 0, 0, 629, 29, GrWRITE);

    pos -= 1;
    if (pos <= -wtext)
	pos = 620;
}
Beispiel #2
0
/* Copy area (x1,y1)-(x2,y2) from a bitmap (if bm==NULL from the screen)
   and create a structure ws_bitmap with the area in bitmap. Returns NULL if
   not successful, the pointer to the structure otherwise. */
struct ws_bitmap *ws_savebitmap(struct ws_bitmap *bm, int x1, int y1,
                                int xsize,
                                int ysize)
{
    GrContext *gc;
    struct ws_bitmap *bmap;


    if ( xsize < 0 || ysize < 0 || y1 < 0 || x1 < 0 || x1 + xsize > GrSizeX()
       || y1 + ysize > GrSizeY() ) {
        return NULL;
    }

    checkmem( bmap = MALLOC( sizeof(struct ws_bitmap) ) );
    checkmem( gc = GrCreateContext(xsize, ysize, NULL, NULL) );
    GrBitBlt(gc, 0, 0, bm == NULL ? NULL : bm->bitmap, x1, y1, x1 + xsize - 1,
             y1 + ysize - 1,
             GrWRITE);
    bmap->bitmap = (void *)gc;
    bmap->xpos = x1;
    bmap->ypos = y1;
    bmap->xsize = xsize;
    bmap->ysize = ysize;
    bmap->w = NULL;
    return bmap;
}
Beispiel #3
0
/* Restore the content of bitmap on the position saved in bitmap and
   kill bm. */
void ws_restorebitmap(struct ws_bitmap *bm) {
    my_assert(bm != NULL && bm->bitmap != NULL);
    GrBitBlt(NULL, bm->xpos, bm->ypos, (GrContext *)bm->bitmap, 0, 0,
             bm->xsize - 1,
             bm->ysize - 1,
             GrWRITE);
    ws_freebitmap(bm);
}
Beispiel #4
0
	void Init()
	{
		listenForEvents();
		string imgPath = cur_sim->basePath + "/1booth.jpg";
		gc.DrawImage(0, 0, 800, 400, I_JPG, imgPath.c_str());
		GrCreateContext(gc.console_width, gc.console_height, NULL, &ctemp);
		GrBitBlt(&ctemp, 0, 0, NULL, 0, 0, gc.console_width, gc.console_height * (2.0 / 3), GrWRITE);
	}
Beispiel #5
0
/* Copy from bitmap src xpos,ypos bitmap with size xsize,ysize to bitmap
   dst at position x1,y1 (which must be large enough). bitmap=NULL means
   screen. if withbg=1 the notes.colindex[cv_winfill] color will be
   drawn otherwise this color is not drawn */
void ws_copybitmap(struct ws_bitmap *dst, int x1, int y1,
                   struct ws_bitmap *src, int xpos, int ypos, int xsize,
                   int ysize,
                   int withbg)
{
    GrBitBlt(dst == NULL ? NULL : dst->bitmap, x1, y1,
             src == NULL ? NULL : src->bitmap, xpos, ypos, xpos + xsize - 1,
             ypos + ysize - 1,
             withbg ? GrWRITE : GrIMAGE | notes.colindex[cv_winfill]);
}