void Fgl_setpixel (int x, int y, int col) { int i; if (clipping_flag) if (x < xclip_x1 || x > xclip_x2 || y < xclip_y1 || y > xclip_y2) return; col &= 0xff; i = pixmap_index(x,y); #ifdef ALLOW_PIX_DOUBLING if (pix_double) { if ((int) pixmap[i] != col) { pixmap[i] = (unsigned char) col; XFillRectangle (display.dpy, display.win, display.pixcolour_gc[col], x * 2, y * 2, 2, 2); } } else { #endif if ((int) pixmap[i] != col) { pixmap[i] = (unsigned char) col; XDrawPoint (display.dpy, display.win, display.pixcolour_gc[col], x + borderx, y + bordery); } #ifdef ALLOW_PIX_DOUBLING } #endif }
void pixmap_vline (int x1, int y1, int y2, int col) { int i, j; i = pixmap_index (x1, y1); for (j = 0; j <= y2 - y1; j++) pixmap[i+j*pixmap_width] = col; }
void pixmap_hline (int x1, int y1, int x2, int col) { int i, j; i = pixmap_index (x1, y1); for (j = 0; j <= x2 - x1; j++) pixmap[i+j] = col; }
/* Clear target pixels. So see them get synthesized when animated debugging. Note the initial values of the target are never used, but totally synthesized. */ static void clear_target_pixels(guint bpp) { guint x; guint y; for(y=0;y<targetMapCopy->height;y++) for(x=0;x<targetMapCopy->width;x++) { Coordinates coords = {x,y}; if (pixmap_index(targetMapCopy, coords)[MASK_PIXELEL_INDEX] != MASK_UNSELECTED) // if (isSelectedTarget(coords, targetMapCopy)) { guint pixelel; Pixelel * pixel = pixmap_index(targetMapCopy, coords); for (pixelel = FIRST_PIXELEL_INDEX; pixelel < bpp; pixelel++) // Color channels only pixel[pixelel] = PIXELEL_BLACK; } } }
void pixmap_fillbox (int x, int y, int w, int h, int col) { int xx, yy; int i = pixmap_index (x, y); for (yy = y; yy < y + h; yy++) { for (xx = x; xx < x + w; xx++) { pixmap[i++] = col; } i += pixmap_width - w; } }
void update_pixmap (int x1, int y1, int sizex, int sizey, int dx, int dy, int real_size, char *g) { /* Copy graphic from g into pixmap */ char *i, *j; int x, y; for (y = 0; y < sizey; y++) { i = pixmap + pixmap_index (dx, dy + y); j = (g + ((y1 + y) * real_size * 16 + x1)); for (x = 0; x < sizex; x++) *(i++) = *(j++); } }
void pixmap_putbox (char* src, int src_x, int src_y, int src_w, int dst_x, int dst_y, int w, int h) { int x, y; int i = pixmap_index (dst_x, dst_y); int j = src_x + src_y * src_w; for (y = src_y; y < src_y + h; y++) { for (x = src_x; x < src_x + w; x++) { pixmap[i++] = src[j++]; } i += pixmap_width - w; j += src_w - w; } }
void pixmap_setpixel (int x, int y, int col) { pixmap[pixmap_index(x,y)] = col; }
int pixmap_getpixel (int x, int y) { return (int) pixmap[pixmap_index(x,y)]; }