示例#1
0
文件: merge.c 项目: 00001/plan9port
void
main(int argc, char **argv)
{
	int i, errs;
	Fontchar *fc;
	Bitmap *b;
	int nc, ht, as;
	Subfont *f;

	binit(0, 0, "font merge");
	if(argc < 1)
		usage();
	nf = argc-1;
	for(i = 0; i < nf; i++)
		snarf(argv[i+1], i);
	nc = ft[0].sf->n;
	ht = ft[0].sf->height;
	as = ft[0].sf->ascent;
	errs = 0;
	for(i = 0; i < nf; i++){
		if(nc < ft[i].sf->n) nc = ft[i].sf->n;
		if(ht != ft[1].sf->height){
			fprint(2, "%s: %s.height=%d (!= %s.height=%d)\n", argv[0],
				ft[i].name, ft[i].sf->height, ft[0].name, ht);
			errs = 1;
		}
		if(as != ft[1].sf->ascent){
			fprint(2, "%s: %s.ascent=%d (!= %s.ascent=%d)\n", argv[0],
				ft[i].name, ft[i].sf->ascent, ft[0].name, ht);
			errs = 1;
		}
	}
	if(errs)
		exits("param mismatch");
	fc = (Fontchar *)malloc(nc*sizeof(Fontchar));
	b = balloc(Rect(0, 0, nc*64, ht), ft[0].bm->ldepth);
	if(b == 0 || fc == 0){
		fprint(2, "%s: couldn't malloc %d chars\n", argv0, nc);
		exits("out of memory");
	}
	bitblt(b, b->r.min, b, b->r, Zero);
	choose(fc, b, nc, ht, as);
	wrbitmapfile(1, b);
bitblt(&screen, screen.r.min, b, b->r, S); bflush();sleep(5000);
	f = subfalloc(nc, ht, as, fc, b, ~0, ~0);
	wrsubfontfile(1, f);
	exits(0);
}
示例#2
0
文件: merge.c 项目: 00001/plan9port
static void
snarf(char *name, int i)
{
	int fd;
	Bitmap *b;

	ft[i].name = name;
	if((fd = open(name, OREAD)) < 0){
		perror(name);
		exits("font read");
	}
	if((b = rdbitmapfile(fd)) == 0){
		fprint(2, "rdbitmapfile failed\n");
		exits("font read");
	}
	if((ft[i].bm = balloc(b->r, b->ldepth)) == 0){
		fprint(2, "ballocsnarf failed\n");
		exits("font read");
	}
	bitblt(ft[i].bm, b->r.min, b, b->r, S);
	if((ft[i].sf = rdsubfontfile(fd, b)) == 0){
		fprint(2, "rdsubfontfile failed\n");
		exits("font read");
	}
	close(fd);
}
示例#3
0
文件: cursorswitch.c 项目: 8l/sam
void
cursorswitch(Cursor *c)
{
	if(c == 0)
		c = &arrow;
	if(c->id == 0){
		if(bsrc == 0){
			bsrc = balloc(crect, 0);
			bmask = balloc(crect, 0);
		}
		/*
		 * Cursor should have fg where "set" is 1,
		 * and bg where "clr" is 1 and "set" is 0,
		 * and should leave places alone where "set" and "clr" are both 0
		 */
		wrbitmap(bsrc, 0, 16, c->set);
#ifdef CURSORBUG
		/*
		 * Some X servers (e.g., Sun X-on-news for some color
		 * monitors) don't do XCreatePixmapCursor properly:
		 * only the mask gets displayed, all black
		 */
		wrbitmap(bmask, 0, 16, c->set);
#else
		wrbitmap(bmask, 0, 16, c->clr);
		bitblt(bmask, Pt(0,0), bsrc, crect, S|D);
#endif
		c->id = (int) XCreatePixmapCursor(_dpy, (Pixmap)bsrc->id, (Pixmap)bmask->id,
			&_fgcolor, &_bgcolor, -c->offset.x, -c->offset.y);
	}
	XDefineCursor(_dpy, (Window)screen.id, (xCursor)c->id);
}
示例#4
0
/***********************************************************************
    This routine is called when the menu command ROTATEMINUS is selected.
    The region selected is rotated 90 degress counterclockwise.  
***********************************************************************/
OpRotMinus()
{
	int	vsize, hsize, size;
	Rectangle r, rbuf;
	Bitmap * buffer;
	if (GetIconRect(&r) == 0) 
		return(0);
	hsize = horsize(r); 
	vsize = versize(r); 
	size = hsize + vsize;
	buffer = balloc(Rect(0, 0, size, size));
	if (buffer == ((Bitmap * ) 0)) 
		return(0);
	rectf(buffer, buffer->rect, F_CLR);
	rbuf = raddp(r, sub(Pt(vsize, 0), r.origin));
	bitblt(&display, raddp(r, icon.origin), buffer, rbuf.origin, F_XOR);
	horshear(buffer, rbuf, -vsize, true);
	vershear(buffer,
	    Rect(rbuf.origin.x - vsize, rbuf.origin.y, rbuf.corner.x, rbuf.corner.y),
	    size, true);
	horshear(buffer,
	    Rect(rbuf.origin.x - vsize, rbuf.corner.y - 1,
	    rbuf.corner.x, rbuf.corner.y + hsize - 1),
	    hsize, false);
	Erase(r);
	FetchIcon(buffer,
	    Rect(rbuf.corner.x - vsize, rbuf.corner.y - 1,
	    rbuf.corner.x, rbuf.corner.y + hsize - 1),
	    add(r.origin, sub(Pt(hsize / 2, vsize / 2), Pt(vsize / 2, hsize / 2))),
	    Rect(0, 0, Xblocks, Yblocks));
	bfree(buffer);
}
示例#5
0
void ereshaped(Rectangle r){
	screen.r=r;
	r=inset(r, 4);
	plpack(root, r);
	bitblt(&screen, screen.r.min, &screen, screen.r, Zero);
	pldraw(root, &screen);
}
示例#6
0
文件: merge.c 项目: 00001/plan9port
static void
choose(Fontchar *f, Bitmap *b, int nc, int ht, int as)
{
	int j;
	Fontchar *info;
	int lastx = 0;
	int w, n;

	for(n = 0; n < nc; n++, f++){
		f->x = lastx;
		for(j = 0; j < nf; j++){
			if(n >= ft[j].sf->n)
				continue;
			info = ft[j].sf->info;
			if(info[n+1].x != info[n].x)
				goto found;
		}
		continue;
	found:
		f->left = info[n].left;
		f->top = info[n].top;
		f->bottom = info[n].bottom;
		f->width = info[n].width;
		w = info[n+1].x - info[n].x;
		bitblt(b, Pt(0, lastx), ft[j].bm, Rect(0, info[n].x, ht, info[n+1].x), S);
		lastx += w;
	}
	f->x = lastx;
}
示例#7
0
文件: balloc.c 项目: kahrs/cda
Bitmap*
balloc(Rectangle r, int ldepth)
{
	Bitmap *b;

	b = _balloc(r, ldepth);
	bitblt(b, r.min, b, r, Zero);
	return b;
}
示例#8
0
文件: main.c 项目: 00001/plan9port
void
main(int argc, char **argv)
{
	int from, to;
	int size = 24;
	int src = Jis;
	char *file = 0;
	long nc, nb;
	int x;
	uchar *bits;
	long *chars;
	int raw = 0;
	Bitmap *b, *b1;
	Subfont *f;
	int *found;

	ARGBEGIN{
	case 'f':	file = ARGF(); break;
	case 'r':	raw = 1; break;
	case '5':	src = Big5; break;
	case 's':	size = 16; break;
	case 'g':	src = Gb_bdf; break;
	case 'q':	src = Gb_qw; break;
	default:	usage();
	}ARGEND
	if(file == 0)
		file = source[src].names[(size==24)? Size24:Size16];
	if(argc != 2)
		usage();
	from = strtol(argv[0], (char **)0, 0);
	to = strtol(argv[1], (char **)0, 0);
	binit(0, 0, "fontgen");
	nc = to-from+1;
	nb = size*size/8;		/* bytes per char */
	nb *= nc;
	bits = (uchar *)malloc(nb);
	chars = (long *)malloc(sizeof(long)*nc);
	found = (int *)malloc(sizeof(found[0])*nc);
	if(bits == 0 || chars == 0){
		fprint(2, "%s: couldn't malloc %d bytes for %d chars\n", argv0, nb, nc);
		exits("out of memory");
	}
	if(raw){
		for(x = from; x <= to; x++)
			chars[x-from] = x;
	} else
		source[src].mfn(from, to, chars);
	memset(bits, 0, nb);
	b = source[src].bfn(file, nc, chars, size, bits, &found);
	b1 = balloc(b->r, b->ldepth);
	bitblt(b1, b1->r.min, b, b->r, S);
	f = bf(nc, size, b1, found);
	wrbitmapfile(1, b);
	wrsubfontfile(1, f);/**/
	exits(0);
}
示例#9
0
/*-----------------------------------------------------------------------

   tiga_blit_in_card

   Does an on-board BitBLT.

-----------------------------------------------------------------------*/
void tiga_blit_in_card(tigaRast *rSrc, Coor srcX, Coor srcY,
                       tigaRast *rDst, Coor dstX, Coor dstY,
                       Coor width, Coor height)
{
   /* Ignore multiple raster case for now, assume rSrc = rDst. */

   bitblt(width, height, srcX, srcY, dstX, dstY);

   return;
}
示例#10
0
文件: unix.c 项目: floren/sam
void
getscreen(int argc, char **argv)
{
	int fd;
	Rectangle r;

	signal(SIGINT, SIG_IGN);
	xtbinit(0, "Sam", &argc, argv, fallbacks);
	r = inset(screen.r, 4);
	bitblt(&screen, r.min, &screen, r, 0);
}
示例#11
0
main()
{
	int i;
	Point savept;

        /*
        ** Use "lprintf" to move the "current screen point"
        ** and set a position at which to display the
        ** image of the world.
        */
	lprintf("\n         ");
	savept = sPtCurrent();

	lprintf("\n  Hello        !");

	for (i=0; 1 ; i++) {
		/*
		** after the 18th Bitmap, go back to Bitmap zero.
		*/
		if(i==18)
			i=0;

		/*
		** Draw the current Bitmap of the world.
		*/
		bitblt(world[i], world[i]->rect, &display, savept, F_XOR);

		/*
		** Release the CPU for 10 ticks of the
		** 60 Hz system clock.
		*/
		sleep(10);

		/*
		** Erase the current Bitmap of the world in
		** preparation for drawing the next.
		*/
		bitblt(world[i], world[i]->rect, &display, savept, F_XOR);

	}
}
示例#12
0
文件: ram3x8.c 项目: ev3dev/grx
static void bitblit(GrxFrame *dst,int dx,int dy,
                    GrxFrame *src,int sx,int sy,
                    int w,int h,GrxColor op)
{
    int pl;
    GRX_ENTER();
    if(grx_color_get_mode(op) == GRX_COLOR_MODE_IMAGE)
        bitblt(dst,dx,dy,src,sx,sy,w,h,op);
    else
        for (pl=0; pl < 3; ++pl)
            _GrFrDrvPackedBitBltR2Rpl(dst,dx,dy,src,sx,sy,w,h,op,pl);
    GRX_LEAVE();
}
示例#13
0
文件: menuhit.c 项目: pocket7878/sam
/*
 * menur is a rectangle holding all the highlightable text elements.
 * track mouse while inside the box, return what's selected when button
 * is raised, -1 as soon as it leaves box.
 * invariant: nothing is highlighted on entry or exit.
 */
static int
menuscan(int but, Mouse *m, Rectangle menur, int lasti)
{
    int i;
    Rectangle r;

    r = menurect(menur, lasti);
    bitblt(&screen, r.min, &screen, r, F&~D);
    *m = emouse();
    while(m->buttons & (1<<(but-1))){
        *m = emouse();
        i = menusel(menur, m->xy);
        if(i == lasti)
            continue;
        bitblt(&screen, r.min, &screen, r, F&~D);
        if(i == -1)
            return i;
        r = menurect(menur, i);
        bitblt(&screen, r.min, &screen, r, F&~D);
        lasti = i;
    }
    return lasti;
}
示例#14
0
文件: fdw32_24.c 项目: ev3dev/grx
static void w32_bitblt(GrxFrame *dst, int dx, int dy, GrxFrame *src,
                       int sx, int sy, int w, int h, GrxColor op)
{
    RECT Rect;

    GRX_ENTER();
    bitblt(dst, dx, dy, src, sx, sy, w, h, op);
    Rect.left = dx;
    Rect.top = dy;
    Rect.right = dx + w;
    Rect.bottom = dy + h;
    InvalidateRect(hGRXWnd, &Rect, FALSE);
    GRX_LEAVE();
}
示例#15
0
文件: menuhit.c 项目: pocket7878/sam
static void
menuscrollpaint(Rectangle scrollr, int off, int nitem, int nitemdrawn)
{
    Rectangle r;

    bitblt(&screen, scrollr.min, &screen, scrollr, 0);
    r.min.x = scrollr.min.x;
    r.max.x = scrollr.max.x;
    r.min.y = scrollr.min.y + (Dy(scrollr)*off)/nitem;
    r.max.y = scrollr.min.y + (Dy(scrollr)*(off+nitemdrawn))/nitem;
    if(r.max.y < r.min.y+2)
        r.max.y = r.min.y+2;
    border(&screen, r, 1, F, _bgpixel);
    if(darkgrey)
        texture(&screen, inset(r, 1), darkgrey, S);
}
示例#16
0
文件: menuhit.c 项目: pocket7878/sam
void
menupaint(Menu *menu, Rectangle textr, int off, int nitemdrawn)
{
    int i;
    Point pt;
    Rectangle r;
    char *item;

    r = inset(textr, Border-Margin);
    bitblt(&screen, r.min, &screen, r, 0);
    pt = Pt(textr.min.x+textr.max.x, textr.min.y);
    for(i = 0; i<nitemdrawn; i++, pt.y += fontheight()+Vspacing){
        item = menu->item? menu->item[i+off] : (*menu->gen)(i+off);
        string(&screen,
            Pt((pt.x-strwidth(font, item))/2, pt.y),
            font, item, S);
    }
}
示例#17
0
文件: border.c 项目: 4ad/sam
void
border(Bitmap *l, Rectangle r, int i, Fcode c)
{
	if(i > 0){
		bitblt(l, r.min,
			l, Rect(r.min.x, r.min.y, r.max.x, r.min.y+i), c);
		bitblt(l, Pt(r.min.x, r.max.y-i),
			l, Rect(r.min.x, r.max.y-i, r.max.x, r.max.y), c);
		bitblt(l, Pt(r.min.x, r.min.y+i),
			l, Rect(r.min.x, r.min.y+i, r.min.x+i, r.max.y-i), c);
		bitblt(l, Pt(r.max.x-i, r.min.y+i),
			l, Rect(r.max.x-i, r.min.y+i, r.max.x, r.max.y-i), c);
	}else if(i < 0){
		bitblt(l, Pt(r.min.x, r.min.y+i),
			l, Rect(r.min.x, r.min.y+i, r.max.x, r.min.y), c);
		bitblt(l, Pt(r.min.x, r.max.y),
			l, Rect(r.min.x, r.max.y, r.max.x, r.max.y-i), c);
		bitblt(l, Pt(r.min.x+i, r.min.y+i),
			l, Rect(r.min.x+i, r.min.y+i, r.min.x, r.max.y-i), c);
		bitblt(l, Pt(r.max.x, r.min.y+i),
			l, Rect(r.max.x, r.min.y+i, r.max.x-i, r.max.y-i), c);
	}
}
示例#18
0
static unsigned long
blitspin_draw (Display *dpy, Window window, void *closure)
{
  struct state *st = (struct state *) closure;
  int this_delay = st->delay;
  int qwad;

  if (st->img_loader)   /* still loading */
    {
      st->img_loader = load_image_async_simple (st->img_loader, 0, 0, 0, 0, 0);

      if (!st->img_loader) { /* just finished */
        st->first_time = 0;
        st->loaded_p = True;
        st->qwad = -1;
        st->start_time = time ((time_t) 0);
        blitspin_init_2 (st);
      }

      /* Rotate nothing if the very first image is not yet loaded */
      if (! st->loaded_p)
        return this_delay;
    }

  if (!st->img_loader &&
      st->load_ext_p &&
      st->start_time + st->duration < time ((time_t) 0)) {
    /* Start a new image loading, but keep rotating the old image 
       until the new one arrives. */
    st->img_loader = load_image_async_simple (0, st->xgwa.screen, st->window,
                                              st->bitmap, 0, 0);
  }

  if (st->qwad == -1) 
    {
      bitblt(st, st->mask, st->mask, clear,0,0, st->size,    st->size,    0,0);
      bitblt(st, st->mask, st->mask, set,  0,0, st->size>>1, st->size>>1, 0,0);
      st->qwad = st->size>>1;
    }
示例#19
0
main()
{
	register x, y, dx, dy;
	register long i;
#ifndef DMD630
	jinit();
	WonB();
#endif
	dx=20;
	dy=20;
	for(y=0; y<YMAX; y+=dy){
		jmoveto(Pt(0, y));
		jlineto(Pt(XMAX, y), F_STORE);
	}
	for(x=0; x<XMAX; x+=dx){
		jmoveto(Pt(x, 0));
		jlineto(Pt(x, YMAX), F_STORE);
	}
	for(x=0; x<99; x++){
		bitblt(&display, rtransform(Rect(99, 99, 300, 300)),
			 &display, transform(Pt(100,100)), F_STORE);
		bitblt(&display, rtransform(Rect(99, 399, 300, 600)),
			 &display, transform(Pt(100,400)), F_STORE);
		bitblt(&display, rtransform(Rect(99, 699, 300, 900)),
			 &display, transform(Pt(100,700)), F_STORE);
		bitblt(&display, rtransform(Rect(499, 99, 700, 300)),
			 &display, transform(Pt(500,100)), F_STORE);
		bitblt(&display, rtransform(Rect(499, 399, 700, 600)),
			 &display, transform(Pt(500,400)), F_STORE);
		bitblt(&display, rtransform(Rect(499, 699, 700, 900)),
			 &display, transform(Pt(500,700)), F_STORE);
	}
	sleep (120);
	eor();
	cursallow ();
	exit();
}
static int
ge2d_ioctl(struct inode *inode, struct file *filp,
                 unsigned int cmd, unsigned long args)
{

	ge2d_context_t *context=(ge2d_context_t *)filp->private_data;
	void  __user* argp =(void __user*)args;
	config_para_t     ge2d_config;	
	ge2d_para_t  para ;
    config_para_ex_t  ge2d_config_ex;
	int  ret=0;    	

	if(!command_valid(cmd))  return -1;
	switch (cmd)
   	{
		case  GE2D_CONFIG:
		case  GE2D_SRCCOLORKEY:	
		copy_from_user(&ge2d_config,argp,sizeof(config_para_t));
		break;
		case  GE2D_CONFIG_EX:
		copy_from_user(&ge2d_config_ex,argp,sizeof(config_para_ex_t));
		break;
		case  GE2D_SET_COEF:
		case	  GE2D_ANTIFLICKER_ENABLE:	
		break;
		default :
		copy_from_user(&para,argp,sizeof(ge2d_para_t));	
		break;
		
   	}
	switch(cmd)
	{
		case GE2D_CONFIG:
		ret=ge2d_context_config(context,&ge2d_config) ;
	  	break;
		case GE2D_CONFIG_EX:
		ret=ge2d_context_config_ex(context,&ge2d_config_ex) ;
	  	break;
		case GE2D_SET_COEF:
		ge2d_wq_set_scale_coef(context,args&0xff,args>>16);
		break;
		case GE2D_ANTIFLICKER_ENABLE:
		ge2d_antiflicker_enable(context,args);	
		break;
    	  	case GE2D_SRCCOLORKEY:
		ge2dgen_src_key(context , ge2d_config.src_key.key_enable,ge2d_config.src_key.key_color, ge2d_config.src_key.key_mask,ge2d_config.src_key.key_mode);  //RGBA MODE		
		break;
		case GE2D_FILLRECTANGLE:
		amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"fill rect...,x=%d,y=%d,w=%d,h=%d,color=0x%x\r\n",
                   para.src1_rect.x, para.src1_rect.y,
                   para.src1_rect.w, para.src1_rect.h,
                   para.color);

            	fillrect(context,
                     para.src1_rect.x, para.src1_rect.y,
                     para.src1_rect.w, para.src1_rect.h,
                     para.color) ;	
		break;
		case GE2D_FILLRECTANGLE_NOBLOCK:
		amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"fill rect...,x=%d,y=%d,w=%d,h=%d,color=0x%x,noblk\r\n",
                   para.src1_rect.x, para.src1_rect.y,
                   para.src1_rect.w, para.src1_rect.h,
                   para.color);

            	fillrect_noblk(context,
                     para.src1_rect.x, para.src1_rect.y,
                     para.src1_rect.w, para.src1_rect.h,
                     para.color) ;	
		break;
		case GE2D_STRETCHBLIT:
		//stretch blit
            	amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"stretchblt...,x=%d,y=%d,w=%d,h=%d,dst.w=%d,dst.h=%d\r\n",
                   para.src1_rect.x, para.src1_rect.y,
                   para.src1_rect.w, para.src1_rect.h,
                   para.dst_rect.w, para.dst_rect.h);

            	stretchblt(context ,
                       para.src1_rect.x, para.src1_rect.y, para.src1_rect.w, para.src1_rect.h,
                       para.dst_rect.x,  para.dst_rect.y,  para.dst_rect.w,  para.dst_rect.h);	
		break;
		case GE2D_STRETCHBLIT_NOBLOCK:
		//stretch blit
            	amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"stretchblt...,x=%d,y=%d,w=%d,h=%d,dst.w=%d,dst.h=%d,noblk\r\n",
                   para.src1_rect.x, para.src1_rect.y,
                   para.src1_rect.w, para.src1_rect.h,
                   para.dst_rect.w, para.dst_rect.h);

            	stretchblt_noblk(context ,
                       para.src1_rect.x, para.src1_rect.y, para.src1_rect.w, para.src1_rect.h,
                       para.dst_rect.x,  para.dst_rect.y,  para.dst_rect.w,  para.dst_rect.h);	
		break;
		case GE2D_BLIT:
		//bitblt
            	amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"blit...\r\n");

            	bitblt(context ,
                   para.src1_rect.x, para.src1_rect.y,
                   para.src1_rect.w, para.src1_rect.h,
                   para.dst_rect.x, para.dst_rect.y);
           	break;
		case GE2D_BLIT_NOBLOCK:
		//bitblt
            	amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"blit...,noblk\r\n");

            	bitblt_noblk(context ,
                   para.src1_rect.x, para.src1_rect.y,
                   para.src1_rect.w, para.src1_rect.h,
                   para.dst_rect.x, para.dst_rect.y);
           	break;	
		case GE2D_BLEND:
		amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"blend ...\r\n");
		blend(context,
            		para.src1_rect.x, para.src1_rect.y,
            		para.src1_rect.w, para.src1_rect.h,
           		para.src2_rect.x, para.src2_rect.y,
           		para.src2_rect.w, para.src2_rect.h,
           		para.dst_rect.x, para.dst_rect.y,
           		para.dst_rect.w, para.dst_rect.h,
           		para.op) ;	
		break;
		case GE2D_BLEND_NOBLOCK:
		amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"blend ...,noblk\r\n");
		blend_noblk(context,
            		para.src1_rect.x, para.src1_rect.y,
            		para.src1_rect.w, para.src1_rect.h,
           		para.src2_rect.x, para.src2_rect.y,
           		para.src2_rect.w, para.src2_rect.h,
           		para.dst_rect.x, para.dst_rect.y,
           		para.dst_rect.w, para.dst_rect.h,
           		para.op) ;	
		break;
		case GE2D_BLIT_NOALPHA:
		//bitblt_noalpha
            	amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"blit_noalpha...\r\n");
            	bitblt_noalpha(context ,
                   para.src1_rect.x, para.src1_rect.y,
                   para.src1_rect.w, para.src1_rect.h,
                   para.dst_rect.x, para.dst_rect.y);	
		break;
		case GE2D_BLIT_NOALPHA_NOBLOCK:
		//bitblt_noalpha
            	amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"blit_noalpha...,noblk\r\n");
            	bitblt_noalpha_noblk(context ,
                   para.src1_rect.x, para.src1_rect.y,
                   para.src1_rect.w, para.src1_rect.h,
                   para.dst_rect.x, para.dst_rect.y);	
		break;
		case GE2D_STRETCHBLIT_NOALPHA:
		//stretch blit
            	amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"stretchblt_noalpha...,x=%d,y=%d,w=%d,h=%d,dst.w=%d,dst.h=%d\r\n",
                   para.src1_rect.x, para.src1_rect.y,
                   para.src1_rect.w, para.src1_rect.h,
                   para.dst_rect.w, para.dst_rect.h);

            	stretchblt_noalpha(context ,
                       para.src1_rect.x, para.src1_rect.y, para.src1_rect.w, para.src1_rect.h,
                       para.dst_rect.x,  para.dst_rect.y,  para.dst_rect.w,  para.dst_rect.h);	
		break;
		case GE2D_STRETCHBLIT_NOALPHA_NOBLOCK:
		//stretch blit
            	amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"stretchblt_noalpha...,x=%d,y=%d,w=%d,h=%d,dst.w=%d,dst.h=%d,noblk\r\n",
                   para.src1_rect.x, para.src1_rect.y,
                   para.src1_rect.w, para.src1_rect.h,
                   para.dst_rect.w, para.dst_rect.h);

            	stretchblt_noalpha_noblk(context ,
                       para.src1_rect.x, para.src1_rect.y, para.src1_rect.w, para.src1_rect.h,
                       para.dst_rect.x,  para.dst_rect.y,  para.dst_rect.w,  para.dst_rect.h);	
		break;
	}
 	return ret;
}
示例#21
0
文件: menuhit.c 项目: pocket7878/sam
int
menuhit(int but, Mouse *m, Menu *menu)
{
    int i, nitem, nitemdrawn, maxwid, lasti, off, noff, wid, screenitem;
    bool scrolling;
    Rectangle r, menur, sc, textr, scrollr;
    Bitmap *b;
    Point pt;
    char *item;
    extern unsigned int cursor;
    unsigned int oldcursor = cursor;

    cursorswitch(ArrowCursor);
    sc = screen.clipr;
    clipr(&screen, screen.r);
    maxwid = 0;
    for(nitem = 0;
        (item = menu->item? menu->item[nitem] : (*menu->gen)(nitem));
        nitem++){
        i = strwidth(font, item);
        if(i > maxwid)
            maxwid = i;
    }
    if(menu->lasthit<0 || menu->lasthit>=nitem)
        menu->lasthit = 0;
    screenitem = (Dy(screen.r)-10)/(fontheight()+Vspacing);
    if(nitem>Maxunscroll || nitem>screenitem){
        scrolling = true;
        nitemdrawn = Nscroll;
        if(nitemdrawn > screenitem)
            nitemdrawn = screenitem;
        wid = maxwid + Gap + Scrollwid;
        off = menu->lasthit - nitemdrawn/2;
        if(off < 0)
            off = 0;
        if(off > nitem-nitemdrawn)
            off = nitem-nitemdrawn;
        lasti = menu->lasthit-off;
    }else{
        scrolling = false;
        nitemdrawn = nitem;
        wid = maxwid;
        off = 0;
        lasti = menu->lasthit;
    }
    r = inset(Rect(0, 0, wid, nitemdrawn*(fontheight()+Vspacing)), -Margin);
    r = rsubp(r, Pt(wid/2, lasti*(fontheight()+Vspacing)+fontheight()/2));
    r = raddp(r, m->xy);
    pt = Pt(0, 0);
    if(r.max.x>screen.r.max.x)
        pt.x = screen.r.max.x-r.max.x;
    if(r.max.y>screen.r.max.y)
        pt.y = screen.r.max.y-r.max.y;
    if(r.min.x<screen.r.min.x)
        pt.x = screen.r.min.x-r.min.x;
    if(r.min.y<screen.r.min.y)
        pt.y = screen.r.min.y-r.min.y;
    menur = raddp(r, pt);
    textr.max.x = menur.max.x-Margin;
    textr.min.x = textr.max.x-maxwid;
    textr.min.y = menur.min.y+Margin;
    textr.max.y = textr.min.y + nitemdrawn*(fontheight()+Vspacing);
    if(scrolling){
        scrollr = inset(menur, Border);
        scrollr.max.x = scrollr.min.x+Scrollwid;
    }else
        scrollr = Rect(0, 0, 0, 0);

    b = balloc(menur, screen.ldepth);
    if(b == 0)
        b = &screen;
    bitblt(b, menur.min, &screen, menur, S);
    bitblt(&screen, menur.min, &screen, menur, 0);
    border(&screen, menur, Blackborder, F, _bgpixel);
    r = menurect(textr, lasti);
    cursorset(divpt(add(r.min, r.max), 2));
    menupaint(menu, textr, off, nitemdrawn);
    if(scrolling)
        menuscrollpaint(scrollr, off, nitem, nitemdrawn);
    r = menurect(textr, lasti);
    cursorset(divpt(add(r.min, r.max), 2));
    menupaint(menu, textr, off, nitemdrawn);
    if(scrolling)
        menuscrollpaint(scrollr, off, nitem, nitemdrawn);
    while(m->buttons & (1<<(but-1))){
        lasti = menuscan(but, m, textr, lasti);
        if(lasti >= 0)
            break;
        while(!ptinrect(m->xy, textr) && (m->buttons & (1<<(but-1)))){
            if(scrolling && ptinrect(m->xy, scrollr)){
                noff = ((m->xy.y-scrollr.min.y)*nitem)/Dy(scrollr);
                noff -= nitemdrawn/2;
                if(noff < 0)
                    noff = 0;
                if(noff > nitem-nitemdrawn)
                    noff = nitem-nitemdrawn;
                if(noff != off){
                    off = noff;
                    menupaint(menu, textr, off, nitemdrawn);
                    menuscrollpaint(scrollr, off, nitem, nitemdrawn);
                }
            }
            *m = emouse();
        }
    }
    bitblt(&screen, menur.min, b, menur, S);
    if(b != &screen)
        bfree(b);
    clipr(&screen, sc);
    if(lasti >= 0){
        menu->lasthit = lasti+off;
        return cursorswitch(oldcursor), menu->lasthit;
    }
    cursorswitch(oldcursor);
    return -1;
}
示例#22
0
void done(Panel *p, int buttons){
	USED(p, buttons);
	bitblt(&screen, screen.r.min, &screen, screen.r, Zero);
	exits(0);
}
示例#23
0
文件: hp.c 项目: 99years/plan9
void
emulate(void)
{
	char buf[BUFS+1];
	int n;
	int c;
	int standout = 0;
	int insmode = 0;

	for (;;) {
		if (x > xmax || y > ymax) {
			x = 0;
			newline();
		}
		buf[0] = get_next_char();
		buf[1] = '\0';
		switch(buf[0]) {

		case '\000':		/* nulls, just ignore 'em */
			break;

		case '\007':		/* bell */
			ringbell();
			break;

		case '\t':		/* tab modulo 8 */
			x = (x|7)+1;
			break;

		case '\033':
			switch(get_next_char()) {

			case 'j':
				get_next_char();
				break;

			case '&':	/* position cursor &c */
				switch(get_next_char()) {

				case 'a':
					for (;;) {
						n = number(buf, nil);
						switch(buf[0]) {

						case 'r':
						case 'y':
							y = n;
							continue;

						case 'c':
							x = n;
							continue;

						case 'R':
						case 'Y':
							y = n;
							break;

						case 'C':
							x = n;
							break;
						}
						break;
					}
					break;

				case 'd':	/* underline stuff */
					if ((n=get_next_char())>='A' && n <= 'O')
						standout++;
					else if (n == '@')
						standout = 0;
					break;

				default:
					get_next_char();
					break;

				}
				break;

			case 'i':	/* back tab */
				if (x>0)
					x = (x-1) & ~07;
				break;

			case 'H':	/* home cursor */
			case 'h':
				x = 0;
				y = 0;
				break;

			case 'L':	/* insert blank line */
				scroll(y, ymax, y+1, y);
				break;

			case 'M':	/* delete line */
				scroll(y+1, ymax+1, y, ymax);
				break;

			case 'J':	/* clear to end of display */
				xtipple(Rpt(pt(0, y+1),
					    pt(xmax+1, ymax+1)));
				/* flow */
			case 'K':	/* clear to EOL */
				xtipple(Rpt(pt(x, y),
					    pt(xmax+1, y+1)));
				break;

			case 'P':	/* delete char */
				bitblt(&screen, pt(x, y),
					&screen, Rpt(pt(x+1, y),
					pt(xmax+1, y+1)),
				        S);
				xtipple(Rpt(pt(xmax, y),
					    pt(xmax+1, y+1)));
				break;

			case 'Q':	/* enter insert mode */
				insmode++;
				break;

			case 'R':	/* leave insert mode */
				insmode = 0;
				break;

			case 'S':	/* roll up */
				scroll(1, ymax+1, 0, ymax);
				break;

			case 'T':
				scroll(0, ymax, 1, 0);
				break;

			case 'A':	/* upline */
			case 't':
				if (y>0)
					y--;
				if (olines > 0)
					olines--;
				break;

			case 'B':
			case 'w':
				y++;	/* downline */
				break;

			case 'C':	/* right */
			case 'v':
				x++;
				break;

			case 'D':	/* left */
			case 'u':
				x--;

			}
			break;

		case '\b':		/* backspace */
			if(x > 0)
				--x;
			break;

		case '\n':		/* linefeed */
			newline();
			standout = 0;
			if( ttystate[cs->raw].nlcr )
				x = 0;
			break;

		case '\r':		/* carriage return */
			x = 0;
			standout = 0;
			if( ttystate[cs->raw].crnl )
				newline();
			break;

		default:		/* ordinary char */
			n = 1;
			c = 0;
			while (!cs->raw && host_avail() && x+n<=xmax && n<BUFS
			    && (c = get_next_char())>=' ' && c<'\177') {
				buf[n++] = c;
				c = 0;
			}
			buf[n] = 0;
			if (insmode) {
				bitblt(&screen, pt(x+n, y), &screen,
					Rpt(pt(x, y), pt(xmax-n+1, y+1)), S);
			}
			xtipple(Rpt(pt(x,y), pt(x+n, y+1)));
			string(&screen, pt(x, y), font, buf, DxorS);
			if (standout)
				rectf(&screen,
				      Rpt(pt(x,y),pt(x+n,y+1)),
				      DxorS);
			x += n;
			peekc = c;
			break;
		}
	}
}
示例#24
0
const VSFrameRef* YadifMod2::
getFrame(int n, VSCore* core, const VSAPI* api, VSFrameContext* ctx)
{
    int ft = field;
    if (mode == 1 || mode == 3) {
        ft = (n & 1) ? 1 - order : order;
        n /= 2;
    }

    auto edeint = eclip ? api->getFrameFilter(n, eclip, ctx)
                : nullptr;
    auto curr = api->getFrameFilter(n, clip, ctx);
    auto prev = api->getFrameFilter(n == 0 ? prevFirst : n - 1, clip, ctx);
    auto next = api->getFrameFilter(std::min(n + 1, nfSrc), clip, ctx);
    auto dst = api->newVideoFrame(vi.format, vi.width, vi.height, curr, core);

    for (int p = 0; p < vi.format->numPlanes; ++p) {
        auto currp = api->getReadPtr(curr, p);
        auto prevp = api->getReadPtr(prev, p);
        auto nextp = api->getReadPtr(next, p);

        size_t width = api->getFrameWidth(curr, p);
        size_t rowsize = width * vi.format->bytesPerSample;
        size_t height = api->getFrameHeight(curr, p);
        int cstride = api->getStride(curr, p);
        int pstride = api->getStride(prev, p);
        int nstride = api->getStride(next, p);

        int begin = 2 + ft;
        int count = (height - 4 + ft - begin) / 2 + 1;

        const uint8_t *fm_prev, *fm_next;
        int fm_pstride, fm_nstride;
        if (ft != order) {
            fm_pstride = cstride * 2;
            fm_nstride = nstride * 2;
            fm_prev = prevp + begin + cstride;
            fm_next = nextp + begin * nstride;
        } else {
            fm_pstride = pstride * 2;
            fm_nstride = cstride * 2;
            fm_prev = prevp + begin * pstride;
            fm_next = currp + begin * cstride;
        }

        const uint8_t* edeintp = nullptr;
        int estride = 0;
        if (eclip) {
            edeintp = api->getReadPtr(edeint, p);
            estride = api->getStride(edeint, p);
        }

        auto dstp = api->getWritePtr(dst, p);
        int dstride = api->getStride(dst, p);

        if (ft == 0) {
            memcpy(dstp, currp + cstride, rowsize);
            if (edeintp) {
                memcpy(dstp + dstride * (height - 2),
                       edeintp + estride * (height - 2), rowsize);
            } else {
                interp(dstp + dstride * (height - 2),
                       currp + cstride * (height - 3), cstride, width);
            }
        } else {
            if (edeintp) {
                memcpy(dstp + dstride, edeintp + estride, rowsize);
            } else {
                interp(dstp + dstride, currp, cstride, width);
            }
            memcpy(dstp + dstride * (height - 1),
                   currp + cstride * (height - 2), rowsize);
        }
        bitblt(dstp + (1 - ft) * dstride, dstride * 2,
               currp + (1 - ft) * cstride, cstride * 2, rowsize, height / 2);

        mainProc(currp + begin * cstride, prevp + begin * pstride,
                 nextp + begin * nstride, fm_prev, fm_next,
                 edeintp + begin * estride, dstp + begin * dstride, width,
                 cstride, pstride, nstride, fm_pstride, fm_nstride, estride * 2,
                 dstride * 2, count);
    }

    return dst;

}