void drawhline(int x,int y,int w,GrxColor c) { GRX_ENTER(); w += x; do { drawpixel(x,y,c); } while(++x != w); GRX_LEAVE(); }
void render_game(uint32_t *pixels) { for (int y_clear = 0; y_clear < 64; y_clear++) { for (int x_clear = 0; x_clear < 64; x_clear++) { drawpixel(pixels, x_clear, y_clear, 0x00000000, 0); } } }
void drawbox(int left, int top, int right, int bottom, unsigned short color) { int x, y; for(y = top; y < bottom; y++) for(x = left; x < right; x++) drawpixel(x, y, color); }
//draw text using characters contained in font.h void print(int left, int top, char *str, unsigned short color) { int x, y, draw; int pos = 0; char letter; //look at all characters in this string while (*str) { //get current character ASCII code letter = (*str++) - 32; //draw the character for(y = 0; y < 8; y++) for(x = 0; x < 8; x++) { //grab a pixel from the font character draw = font[letter * 64 + y * 8 + x]; //if pixel = 1, then draw it if (draw) drawpixel(left + pos + x, top + y, color); } //jump over 8 pixels pos += 8; } }
void elipse (SDL_Surface *surface, Uint32 color, int xc, int yc, int rx, int ry) { double p; double doble_rx, doble_ry; double x, y; x = 0; y = ry; drawpixel (surface, color, xc + x, yc + y); drawpixel (surface, color, xc + x, yc - y); doble_rx = 2.0 * rx * rx; doble_ry = 2.0 * ry * ry; p = (ry * ry) - (rx * rx * ry) + (rx * rx) / 4.0; while ((doble_ry * x) < (doble_rx * y)) { x++; if (p < 0) { p = p + (doble_ry * x) + (ry * ry); } else { y--; p = p + (doble_ry * x) - (doble_rx * y) + (ry * ry); } drawpixel (surface, color, (int) xc + x, (int) yc + y); drawpixel (surface, color, (int) xc - x, (int) yc + y); drawpixel (surface, color, (int) xc + x, (int) yc - y); drawpixel (surface, color, (int) xc - x, (int) yc - y); } p = (((double) ry * (double) ry) * ((x + 0.5) * (x + 0.5))) + (((double) rx * (double) rx) * ((y - 1.0) * (y - 1.0))) - ((double) rx * (double) rx * (double) ry * (double) ry); while (y > 0) { y--; if (p > 0.0) { p = p - (doble_rx * y) + (rx * rx); } else { x++; p = p + (doble_ry * x) - (doble_rx * y) + (rx * rx); } drawpixel (surface, color, (int) xc + x, (int) yc + y); drawpixel (surface, color, (int) xc - x, (int) yc + y); drawpixel (surface, color, (int) xc + x, (int) yc - y); drawpixel (surface, color, (int) xc - x, (int) yc - y); } }
static void background_draw(PANEL *UNUSED(p), int UNUSED(x), int UNUSED(y), int width, int height) { drawrect(0, 0, LIST_RIGHT, LIST_Y - 1, LIST_DARK); drawhline(0, LIST_Y - 1, LIST_RIGHT, LIST_EDGE); drawrect(0, LIST_Y, LIST_RIGHT, height + LIST_BOTTOM, LIST_MAIN); drawrect(0, height + LIST_BOTTOM, LIST_RIGHT, height, LIST_DARK); drawself(); drawrect(LIST_RIGHT, 0, width, height, WHITE); drawvline(LIST_RIGHT, 1, LIST_Y - 1, LIST_EDGE3); drawpixel(LIST_RIGHT, LIST_Y - 1, LIST_EDGE2); drawvline(LIST_RIGHT, LIST_Y, height - SCALE * 15, LIST_EDGE4); drawpixel(LIST_RIGHT, height - SCALE * 15, LIST_EDGE5); drawhline(LIST_RIGHT + 1, LIST_Y - 1, width, C_GRAY); }
void drawcursor(uint x, uint y) { u8 row, bit; uartputc('W'); for(row=0; row<15; row++) for(bit=0; bit<8; bit++) drawpixel(x+bit, y+row); uartputc('X'); }
void drawpattern(int x,int y,int w,char patt,GrColor fg,GrColor bg) { GR_int8u mask; GRX_ENTER(); mask = 0x80; w += x; do { drawpixel(x,y,(patt & mask) ? fg : bg); if((mask >>= 1) == 0) mask = 0x80; } while(++x != w); GRX_LEAVE(); }
void show_glut() { glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); for (int j = 0; j < GOL_WIDTH; j++) { for (int i = 0; i < GOL_HEIGHT; i++) { drawpixel(i, j, gol.getLife(i, j)); } } glFlush(); }
static void w32_drawpixel(int x, int y, GrxColor color) { HDC hDC; COLORREF c; GRX_ENTER(); drawpixel(x, y, color); c = GetPixel ( hDCMem, x, y ); hDC = GetDC ( hGRXWnd ); SetPixelV ( hDC, x, y, c ); ReleaseDC ( hGRXWnd, hDC ); GRX_LEAVE(); }
static PyObject* emb_draw_pixel(PyObject *self, PyObject *args) { int x,y,r,g,b,a; a=255; if (!PyArg_ParseTuple(args, "IIIII|I:draw_pixel",&x,&y,&r,&g,&b,&a)) return NULL; if (vid_buf!=NULL) { drawpixel(vid_buf,x,y,r,g,b,a); return Py_BuildValue("i",1); } return Py_BuildValue("i",-1); }
int mira(double a, double b, double x, double y, int niter, int color) { int i; double c, t, u, w; c = 2 - 2 * a; w = a * x + c * (x * x) / (1 + x * x); for(i = 0; i < niter; ++i) { if(i > 8) drawpixel(x, y, color); t = x; x = b * y + w; u = x * x; w = a * x + c * u / (1 + u); y = w - t; } return 0; }
void drawcharacter(u8 c, uint x, uint y) { u8 *faddr; u8 row, bit, bits; uint tv; if(c > 127) return; tv = ((uint)c) << 4; faddr = font + tv; for(row=0; row<15; row++){ bits = *(faddr+row); for(bit=0; bit<8; bit++){ if((bits>>bit) & 1) drawpixel(x+bit, y+row); } } }
void scanfill(float x1,float y1,float x2,float y2,float x3,float y3,float x4,float y4) { int le[500],re[500]; int i,y; for(i=0;i<500;i++) { le[i]=500; re[i]=0; } edge(x1,y1,x2,y2,le,re); edge(x2,y2,x3,y3,le,re); edge(x3,y3,x4,y4,le,re); edge(x4,y4,x1,y1,le,re); for(y=0;y<500;y++) { if(le[y]<=re[y]) for(i=(int)le[y];i<(int)re[y];i++) drawpixel(i,y,WHITE); } }
void w32_putscanline(int x, int y, int w, const GrxColor *scl, GrxColor op ) { GrxColor skipc; RECT Rect; GRX_ENTER(); Rect.left = x; Rect.top = y; Rect.right = x + w; Rect.bottom = y + 1; skipc = op ^ GRX_COLOR_MODE_IMAGE; op &= GRX_COLOR_MODE_MASK; for ( w += x; x < w; ++x) { GrxColor c = *(scl++); if (c != skipc) drawpixel(x, y, (c|op)); } InvalidateRect(hGRXWnd, &Rect, FALSE); GRX_LEAVE(); }
void setpixel(int color, int column, int row) { drawpixel(color,row*320+column); }
void circle (SDL_Surface *surface, Uint32 color, int xc, int yc, int r) { int p; int x, y; p = 1 - r; x = 0; y = r; drawpixel (surface, color, xc + x, yc + y); drawpixel (surface, color, xc - x, yc + y); drawpixel (surface, color, xc + x, yc - y); drawpixel (surface, color, xc - x, yc - y); drawpixel (surface, color, xc + y, yc + x); drawpixel (surface, color, xc - y, yc + x); drawpixel (surface, color, xc + y, yc - x); drawpixel (surface, color, xc - y, yc - x); while (x < y) { if (p < 0) { x++; p = p + (2 * x) + 1; } else { x++; y--; p = p + (2 * x) + 1 - (2 * y); } drawpixel (surface, color, xc + x, yc + y); drawpixel (surface, color, xc - x, yc + y); drawpixel (surface, color, xc + x, yc - y); drawpixel (surface, color, xc - x, yc - y); drawpixel (surface, color, xc + y, yc + x); drawpixel (surface, color, xc - y, yc + x); drawpixel (surface, color, xc + y, yc - x); drawpixel (surface, color, xc - y, yc - x); } }
void checkgrid() { if(selectedwindow()==3) { int x1,x2,y1,y2; if(mousestat()==1) { if(selected(1,0)==0) { for(int loopx=0;loopx<maxx;loopx++) { for(int loopy=0;loopy<maxy;loopy++) { x1=windows[3].x1+4+(loopx*size); x2=x1+size-1; y1=windows[3].y1+17+(loopy*size); y2=y1+size-1; if(x>=x1 && x<x2 && y>=y1 && y<y2) { graph[loopx][loopy]=selected(0,0); drawpixel(loopx,loopy); } } } thumb(); } } if(mousestat()==3) { if(selected(1,0)==2 || selected(1,0)==3) { for(int loopx=0;loopx<maxx;loopx++) { for(int loopy=0;loopy<maxy;loopy++) { x1=windows[3].x1+4+(loopx*size); x2=x1+size-1; y1=windows[3].y1+17+(loopy*size); y2=y1+size-1; if(x>=x1 && x<x2 && y>=y1 && y<y2) { sx=loopx; sy=loopy; } } } } if(selected(1,0)==1) { for(int loopx=0;loopx<maxx;loopx++) { for(int loopy=0;loopy<maxy;loopy++) { x1=windows[3].x1+4+(loopx*size); x2=x1+size-1; y1=windows[3].y1+17+(loopy*size); y2=y1+size-1; if(x>=x1 && x<x2 && y>=y1 && y<y2) { fillit(loopx,loopy,graph[loopx][loopy],selected(0,0)); drawgrid(); } } } } } if(mousestat()==4 && select==1) { if(selected(1,0)==2) { for(int loopx=0;loopx<maxx;loopx++) { for(int loopy=0;loopy<maxy;loopy++) { x1=windows[3].x1+4+(loopx*size); x2=x1+size-1; y1=windows[3].y1+17+(loopy*size); y2=y1+size-1; if(x>=x1 && x<x2 && y>=y1 && y<y2) { ex=loopx; ey=loopy; makeline(sx,sy,ex,ey); drawgrid(); } } } } if(selected(1,0)==3) { for(int loopx=0;loopx<maxx;loopx++) { for(int loopy=0;loopy<maxy;loopy++) { x1=windows[3].x1+4+(loopx*size); x2=x1+size-1; y1=windows[3].y1+17+(loopy*size); y2=y1+size-1; if(x>=x1 && x<x2 && y>=y1 && y<y2) { ex=loopx; ey=loopy; rect(sx,sy,ex,ey); drawgrid(); } } } } } } }