void i_box_filled(i_img *im,i_img_dim x1,i_img_dim y1,i_img_dim x2,i_img_dim y2, const i_color *val) { i_img_dim x, y, width; i_palidx index; dIMCTXim(im); im_log((aIMCTX,1,"i_box_filled(im* %p, p1(" i_DFp "), p2(" i_DFp "),val %p)\n", im, i_DFcp(x1, y1), i_DFcp(x2,y2) ,val)); if (x1 > x2 || y1 > y2 || x2 < 0 || y2 < 0 || x1 >= im->xsize || y1 > im->ysize) return; if (x1 < 0) x1 = 0; if (x2 >= im->xsize) x2 = im->xsize - 1; if (y1 < 0) y1 = 0; if (y2 >= im->ysize) y2 = im->ysize - 1; width = x2 - x1 + 1; if (im->type == i_palette_type && i_findcolor(im, val, &index)) { i_palidx *line = mymalloc(sizeof(i_palidx) * width); for (x = 0; x < width; ++x) line[x] = index; for (y = y1; y <= y2; ++y) i_ppal(im, x1, x2+1, y, line); myfree(line); } else { i_color *line = mymalloc(sizeof(i_color) * width); for (x = 0; x < width; ++x) line[x] = *val; for (y = y1; y <= y2; ++y) i_plin(im, x1, x2+1, y, line); myfree(line); } }
/* =item i_ppal(im, left, right, y, indexes) =category Drawing Writes palette indexes for the horizontal line (left, y) to (right-1, y) from C<indexes>. Returns the number of indexes written. Always returns 0 for direct color images. =cut */ i_img_dim (i_ppal)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, const i_palidx *vals) { return i_ppal(im, x, r, y, vals); }