void mvpw_expose(const mvp_widget_t *widget) { if (widget) { if (widget->type == MVPW_SURFACE) { if(widget->wid != widget->data.surface.wid) { GrClearArea(widget->wid, 0, 0, 0, 0, 1); } } else { GrClearArea(widget->wid, 0, 0, 0, 0, 1); } } }
int XClearArea (Display *dpy, Window w, int x, int y, unsigned int width, unsigned int height, Bool exposures) { GrClearArea(w, x, y, width, height, exposures); return 1; }
/* Draw all roaches. */ void DrawRoaches(void) { Roach *roach; int rx; for (rx=0; rx<curRoaches; rx++) { roach = &roaches[rx]; if (roach->intX >= 0) { GrClearArea(GR_ROOT_WINDOW_ID, roach->intX, roach->intY, roach->rp->width, roach->rp->height, GR_FALSE); } } for (rx=0; rx<curRoaches; rx++) { roach = &roaches[rx]; if (!roach->hidden) { int size = roach->rp->width * roach->rp->height; GR_PIXELVAL roachbuf[size]; GR_PIXELVAL screenbuf[size]; int i; roach->intX = roach->x; roach->intY = roach->y; roach->rp = &roachPix[roach->index]; /* //XSetForeground(display, gc, AllocNamedColor(roachColor, black)); //XSetFillStyle(display, gc, FillStippled); //XSetStipple(display, gc, roach->rp->pixmap); //XSetTSOrigin(display, gc, roach->intX, roach->intY); //XFillRectangle(display, rootWin, gc, //roach->intX, roach->intY, roach->rp->width, roach->rp->height); */ /* read roach bitmap*/ GrReadArea(roach->rp->pixmap, 0, 0, roach->rp->width, roach->rp->height, roachbuf); /* read root window*/ GrReadArea(GR_ROOT_WINDOW_ID, roach->intX, roach->intY, roach->rp->width, roach->rp->height, screenbuf); /* convert fg roach bitmap bits to roach color on root window bits*/ for (i=0; i<size; ++i) if (roachbuf[i] != BLACK) screenbuf[i] = roachColor; /* write root window*/ GrArea(GR_ROOT_WINDOW_ID, gc, roach->intX, roach->intY, roach->rp->width, roach->rp->height, screenbuf, MWPF_PIXELVAL); } else { roach->intX = -1; } } GrFlush(); }
static void GrClearAreaWrapper(void *r) { nxClearAreaReq *req = r; GrClearArea(req->windowid, req->x, req->y, req->width, req->height, req->exposeflag); }
void draw_eyes(nxeyes_state *state, int full_redraw) { GR_COORD x, y; GR_BITMAP *bits; if(full_redraw) { if(state->eyes_closed) bits = eyeclose_bits; else bits = eyefg_bits; GrBitmap(state->wid, state->gc, 0, 0, EYEFG_WIDTH, EYEFG_HEIGHT, bits); GrBitmap(state->wid, state->gc, EYEFG_WIDTH + EYE_SPACING, 0, EYEFG_WIDTH, EYEFG_HEIGHT, bits); } if(state->mouse_moved) { x = EYEFG_WIDTH / 2; y = EYEFG_HEIGHT / 2; calculate_pupil_position(state->oldx, state->oldy, (EYEFG_WIDTH / 2), (EYEFG_HEIGHT / 2), state->mousex, state->mousey, &state->lx, &state->ly); calculate_pupil_position(state->oldx, state->oldy, (EYEFG_WIDTH / 2) + EYEFG_WIDTH + EYE_SPACING, (EYEFG_WIDTH / 2), state->mousex, state->mousey, &state->rx, &state->ry); } if(state->eyes_closed) return; GrClearArea(state->wid, state->olx, state->oly, PUPIL_WIDTH, PUPIL_HEIGHT, 0); GrBitmap(state->wid, state->gc, state->lx, state->ly, PUPIL_WIDTH, PUPIL_HEIGHT, pupil_bits); GrClearArea(state->wid, state->orx, state->ory, PUPIL_WIDTH, PUPIL_HEIGHT, 0); GrBitmap(state->wid, state->gc, state->rx, state->ry, PUPIL_WIDTH, PUPIL_HEIGHT, pupil_bits); state->olx = state->lx; state->oly = state->ly; state->orx = state->rx; state->ory = state->ry; }