예제 #1
0
파일: scrl.c 프로젝트: AustenConrad/plan-9
void
scrlresize(void)
{
	freeimage(vscrtmp);
	freeimage(hscrtmp);
	vscrtmp = eallocimage(display, Rect(0, 0, 32, screen->r.max.y), screen->chan, 0, DNofill);
	hscrtmp = eallocimage(display, Rect(0, 0, screen->r.max.x, 32), screen->chan, 0, DNofill);
}
예제 #2
0
파일: util.c 프로젝트: grobe0ba/plan9front
Image *
getcolor(int rgb)
{
    Color *c;
    int h;

    if(rgb == 0xFFFFFF)
        return display->white;
    else if(rgb == 0x000000)
        return display->black;

    h = rgb%NHASH;
    for(c=colortab[h]; c!=nil; c=c->next)
        if(c->rgb == rgb) {
            flushimage(display, 0);	/* BUG? */
            return c->i;
        }
    c = emalloc(sizeof(Color));
    c->i = eallocimage(display, Rect(0,0,1,1), screen->chan, 1, (rgb<<8)|0xFF);
    c->rgb = rgb;
    c->next = colortab[h];
    colortab[h] = c;

    return c->i;
}
예제 #3
0
파일: page.c 프로젝트: carriercomm/legacy
void
tmpresize(void)
{
	if(tmp)
		freeimage(tmp);

	tmp = eallocimage(display, Rect(0,0,Dx(screen->r),Dy(screen->r)), screen->chan, 0, -1);
}
예제 #4
0
void
allocimages(void)
{
	Rectangle one = Rect(0, 0, 1, 1);
	
	bg		= eallocimage(one, 1, DDarkyellow);
	text 		= eallocimage(one, 1, DBluegreen);

	gright = eloadfile(GRImage);
	gleft = eloadfile(GLImage);
	wall = eloadfile(WallImage);
	empty = eloadfile(EmptyImage);
	empty->repl = 1;
	goalcargo = eloadfile(GoalCargoImage);
	cargo = eloadfile(CargoImage);
	goal = eloadfile(GoalImage);
	win = eloadfile(WinImage);
}
예제 #5
0
파일: mahjongg.c 프로젝트: aahud/harvey
void
allocimages(void)
{
	Rectangle one = Rect(0, 0, 1, 1);

	selected = eallocimage(one, 1, RGBA32, setalpha(DPalebluegreen, 0x5f));
	litbrdr = eallocimage(one, 1, RGBA32, DGreen);
	img = eallocimage(Rect(0, 0, Sizex, Sizey), 0,
		defchan? defchan: screen->chan, DBlack);
	textcol = eallocimage(one, 1, RGBA32, DWhite);

	background = eloadfile(defbackgr);
	replclipr(background, 1, img->r);

	mask = eloadfile(Mask);
	gameover = eloadfile(Gameover);
	tileset = eloadfile(deftileset);
}
예제 #6
0
파일: util.c 프로젝트: grobe0ba/plan9front
void
getimage(Cimage *ci, Rune *altr)
{
    Rectangle r;
    Memimage *mi;
    Image *i, *i2;
    char buf[128];
    uchar *bits;
    int nbits;

    mi = ci->mi;
    if(mi == nil) {
        snprint(buf, sizeof(buf), "[%S]", altr ? altr : L"IMG");
        r.min = Pt(0, 0);
        r.max.x = 2*Space + stringwidth(font, buf);
        r.max.y = 2*Space + font->height;
        ci->i = eallocimage(display, r, GREY1, 1, DBlack);
        r.min.x += Space;
        r.min.y += Space;
        string(ci->i, r.min, display->white, ZP, font, buf);
        return;
    }
    nbits = bytesperline(mi->r, mi->depth)*Dy(mi->r);
    bits = emalloc(nbits);
    unloadmemimage(mi, mi->r, bits, nbits);
    /*
    	/* get rid of alpha channel from transparent gif * /

    	if(mi->depth == 16){
    		for(y=1; y<nbits; y+=2)
    			bits[y>>1] = bits[y];
    	}
    */
    i = eallocimage(display, mi->r, mi->chan, 0, DNofill);
    loadimage(i, i->r, bits, nbits);
    i2 = eallocimage(display, i->r, RGB24, 1, DNofill);
    draw(i2, i2->r, display->black, nil, ZP);
    draw(i2, i2->r, i, nil, i->r.min);
    free(bits);
    freememimage(mi);
    freeimage(i);
    ci->i = i2;
    ci->mi = nil;
}
예제 #7
0
void
allocimages(void)
{
	Rectangle one = Rect(0, 0, 1, 1);
	
	cc = eallocimage(one, 1, 0x777777FF);
	ec = eallocimage(one, 1, DPalegreen);
	bg = eallocimage(one, 1, DPurpleblue);
	lost = eallocimage(one, 1, DRed);
	won = eallocimage(one, 1, DGreen);
	gl = eloadfile("/lib/face/48x48x4/g/glenda.1");

	glm = allocimage(display, Rect(0, 0, 48, 48), gl->chan, 1, DCyan);
	if(glm == nil)
        		sysfatal("cannot allocate mask: %r");

    	draw(glm, glm->r, display->white, nil, ZP);
    	gendraw(glm, glm->r, display->black, ZP, gl, gl->r.min);
    	freeimage(gl);
    	gl = display->black;


}
예제 #8
0
파일: main.c 프로젝트: 99years/plan9
void
iconinit(void)
{
	Rectangle r;

	/* Green */
	tagcols[BACK] = allocimagemix(display, DPalegreen, DWhite);
	if(tagcols[BACK] == nil)
		error("allocimagemix");
	tagcols[HIGH] = eallocimage(display, Rect(0,0,1,1), screen->chan, 1, DDarkgreen);
	tagcols[BORD] = eallocimage(display, Rect(0,0,1,1), screen->chan, 1, DMedgreen);
	tagcols[TEXT] = display->black;
	tagcols[HTEXT] = display->black;

	/* Grey */
	textcols[BACK] = display->white;
	textcols[HIGH] = eallocimage(display, Rect(0,0,1,1), CMAP8,1, 0xCCCCCCFF);
	textcols[BORD] = display->black;
	textcols[TEXT] = display->black;
	textcols[HTEXT] = display->black;

	r = Rect(0, 0, Scrollsize+2, font->height+1);
	button = eallocimage(display, r, screen->chan, 0, DNofill);
	draw(button, r, tagcols[BACK], nil, r.min);
	r.max.x -= 2;
	border(button, r, 2, tagcols[BORD], ZP);

	r = button->r;
	colbutton = eallocimage(display, r, screen->chan, 0, 0x00994CFF);

	but2col = eallocimage(display, Rect(0,0,1,2), screen->chan, 1, 0xAA0000FF);
	but3col = eallocimage(display, Rect(0,0,1,2), screen->chan, 1, 0x444488FF);

	passfont = openfont(display, fontnames[1]);
	if(passfont == nil)
		error("openfont");
}