コード例 #1
0
ファイル: w_system.c プロジェクト: j13s/devil
/* Plot a dot-non-dot-non filled Box */
void ws_drawpatternedbox(int x1, int y1, int xsize, int ysize, int c) {
    int x, y, m;


/* This is not yet working in my release from grx 2.0:
   ws_private.pat_box.gp_bitmap.bmp_fgcolor=c|GrXOR;
   ws_private.pat_box.gp_bitmap.bmp_bgcolor=GrXOR;
   GrPatternFilledBox(x1,y1,x1+xsize,y1+ysize,&ws_private.pat_box); */
    m = GrMouseBlock(NULL, x1, y1, x1 + xsize, y1 + ysize);

    for (y = y1; y < y1 + ysize; y++) {
        for (x = x1 + (y & 1); x < x1 + xsize; x += 2) {
            GrPlot(x, y, GrXOR | c);
        }
    }

    GrMouseUnBlock(m);
}
コード例 #2
0
ファイル: pcirctst.c プロジェクト: nidheeshdas/Algosim
void drawellip(int xc,int yc,int xa,int ya,GrColor c1,GrColor c2,GrColor c3)
{
    double ddx = (double)xa;
    double ddy = (double)ya;
    double R2 = ddx*ddx*ddy*ddy;
    double SQ;
    int x1,x2,y1,y2;
    int dx,dy;
    int *wdt, idx;
    GrLineOption *l;
    GrEvent ev;

    for (idx = 0, l = *Patterns; l != NULL; l = Patterns[++idx])
        for (wdt=widths; *wdt != 0; ++wdt) {
            GrClearScreen(GrBlack());

            GrFilledBox(xc-xa,yc-ya,xc+xa,yc+ya,c1);
            dx = xa;
            dy = 0;
            GrPlot(xc-dx,yc,c3);
            GrPlot(xc+dx,yc,c3);
            while(++dy <= ya) {
                SQ = R2 - (double)dy * (double)dy * ddx * ddx;
                dx = (int)(sqrt(SQ)/ddy + 0.5);
                x1 = xc - dx;
                x2 = xc + dx;
                y1 = yc - dy;
                y2 = yc + dy;
                GrPlot(x1,y1,c3);
                GrPlot(x2,y1,c3);
                GrPlot(x1,y2,c3);
                GrPlot(x2,y2,c3);
            }
            GrSleep(100);

            l->lno_color = c2;
            l->lno_width = *wdt;
            GrCustomEllipse(xc,yc,xa,ya,l);
            GrEventRead(&ev);
            if(ev.type == GREV_KEY && ev.p1 == 'q') {
                stop = 1;
                return;
            }
            GrSleep(100);
        }
}
コード例 #3
0
ファイル: Bounce.CPP プロジェクト: IAmAnubhavSaini/templeos
U0 Bounce()
{
  CDC *dc=DCAlias;
  I64 i,msg_code,p1,update;
  Init;
  try { //Catch <CTRL-ALT-C>
    while (TRUE) {
      update=win_updates;
      do for (i=0;i<16;i++) {
	  dc->color=i;
	  GrPlot(dc,x[i].i32[1],y[i].i32[1]);
	  x[i]+=dx[i];
	  y[i]+=dy[i];
	  if (!(0<=x[i]<Fs->win_pixel_width<<32)) {
	    x[i]-=dx[i];
	    dx[i]=-dx[i];
	  }
	  if (!(0<=y[i]<Fs->win_pixel_height<<32)) {
	    y[i]-=dy[i];
	    dy[i]=-dy[i];
	  }
	}
      while (update==win_updates);
      while (msg_code=ScanMsg(&p1,NULL,1<<MSG_KEY_DOWN|1<<MSG_RESIZE|1<<MSG_MOVE))
	if (msg_code==MSG_KEY_DOWN) {
	  if (p1==CH_SHIFT_ESC || p1==CH_ESC)
	    goto bc_done;
	  else
	    Init;
	} else
	  DCFill(dc);
    }
bc_done:
  } catch
    CatchAll;
  DCFill(dc);
  DCDel(dc);
}
コード例 #4
0
ファイル: scr_djgrx.c プロジェクト: ghaerr/microwindows
/*
**	Blit
*/
static void
DJGR_update(PSD psd, MWCOORD destx, MWCOORD desty, MWCOORD width, MWCOORD height)
{
	if (!width)
		width = psd->xres;
	if (!height)
		height = psd->yres;

/*
typedef unsigned char *		ADDR8;
typedef unsigned short *	ADDR16;
typedef uint32_t *			ADDR32;
*/

	MWCOORD x,y;
	MWPIXELVAL c;

/* got to read from psd->addr and write with GrPlot()*/

	//if (!((width == 1) || (height == 1))) return;
	//printf("U: %d %d %d %d ",destx,desty,width,height);

if (psd->pixtype == MWPF_TRUECOLOR332)
	{
		unsigned char *addr = psd->addr + desty * psd->pitch + destx;
		for (y = 0; y < height; y++) {
			for (x = 0; x < width; x++) {
				c = addr[x];
				GrPlot(destx+x, desty+y, c); 
			}
			addr += psd->pitch;
		}
	}
else if ((psd->pixtype == MWPF_TRUECOLOR565) || (psd->pixtype == MWPF_TRUECOLOR555))
	{	
		unsigned char *addr = psd->addr + desty * psd->pitch + (destx << 1);
		for (y = 0; y < height; y++) {
			for (x = 0; x < width*2; x++) {
				MWPIXELVAL c = ((unsigned short *)addr)[x]; 
				GrPlot(destx+x, desty+y, c); 
			}
			addr += psd->pitch;
		}
	}
else if (psd->pixtype == MWPF_TRUECOLOR888)
	{
		unsigned char *addr = psd->addr + desty * psd->pitch + destx * 3;
		unsigned int extra = psd->pitch - width * 3;
		for (y = 0; y < height; y++) {
			for (x = 0; x < width*3; x++) {
				MWPIXELVAL c = RGB2PIXEL888(addr[2], addr[1], addr[0]);
				GrPlot(destx+x, desty+y, c);
				addr += 3;
			}
			addr += extra;
		}
	}
else if (((MWPIXEL_FORMAT == MWPF_TRUECOLOR8888) || (MWPIXEL_FORMAT == MWPF_TRUECOLORABGR)) & (psd->bpp != 8))
	{
		unsigned char *addr = psd->addr + desty * psd->pitch + (destx << 2);
		for (y = 0; y < height; y++) {
			for (x = 0; x < width*4; x++) {				
				MWPIXELVAL c = ((unsigned short *)addr)[x]; //MWPIXELVAL=uint32_t				
				GrPlot(destx+x, desty+y, c);
	    	}
			addr += psd->pitch;
		}
	}
else /* MWPF_PALETTE*/
	{
		unsigned char *addr = psd->addr + desty * psd->pitch + destx;
		for (y = 0; y < height; y++) {
			for (x = 0; x < width; x++) {
				MWPIXELVAL c = addr[x];
				GrPlot(destx+x, desty+y, c); 
			}
			addr += psd->pitch;
		}
	}

}
コード例 #5
0
ファイル: scr_djgr.c プロジェクト: EPiCS/reconos_v2
/*
**	Draw Pixel
*/
static void
DJGR_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c)
{
	GrPlot(x, y, c);
}