int *min, int *max);
static int ascii_measure_cell_height (void *, const struct table_cell *,
int width);
-static void ascii_draw_cell (void *, const struct table_cell *,
+static void ascii_draw_cell (void *, const struct table_cell *, int color_idx,
int bb[TABLE_N_AXES][2],
int spill[TABLE_N_AXES][2],
int clip[TABLE_N_AXES][2]);
}
static void
-ascii_draw_cell (void *a_, const struct table_cell *cell,
+ascii_draw_cell (void *a_, const struct table_cell *cell, int color_idx UNUSED,
int bb[TABLE_N_AXES][2],
int spill[TABLE_N_AXES][2] UNUSED,
int clip[TABLE_N_AXES][2])
int *min, int *max);
static int xr_measure_cell_height (void *, const struct table_cell *,
int width);
-static void xr_draw_cell (void *, const struct table_cell *,
+static void xr_draw_cell (void *, const struct table_cell *, int color_idx,
int bb[TABLE_N_AXES][2],
int spill[TABLE_N_AXES][2],
int clip[TABLE_N_AXES][2]);
static void xr_clip (struct xr_driver *, int clip[TABLE_N_AXES][2]);
static void
-xr_draw_cell (void *xr_, const struct table_cell *cell,
+xr_draw_cell (void *xr_, const struct table_cell *cell, int color_idx,
int bb[TABLE_N_AXES][2],
int spill[TABLE_N_AXES][2],
int clip[TABLE_N_AXES][2])
}
xr_clip (xr, bg_clip);
cairo_set_source_rgb (xr->cairo,
- cell->style->bg.r / 255.,
- cell->style->bg.g / 255.,
- cell->style->bg.b / 255.);
+ cell->style->bg[color_idx].r / 255.,
+ cell->style->bg[color_idx].g / 255.,
+ cell->style->bg[color_idx].b / 255.);
fill_rectangle (xr,
bb[H][0] - spill[H][0],
bb[V][0] - spill[V][0],
cairo_save (xr->cairo);
cairo_set_source_rgb (xr->cairo,
- cell->style->fg.r / 255.,
- cell->style->fg.g / 255.,
- cell->style->fg.b / 255.);
+ cell->style->fg[color_idx].r / 255.,
+ cell->style->fg[color_idx].g / 255.,
+ cell->style->fg[color_idx].b / 255.);
for (int axis = 0; axis < TABLE_N_AXES; axis++)
{
spill[axis][1] = rule_width (page, axis, cell->d[axis][1]) / 2;
}
- page->params->draw_cell (page->params->aux, cell, bb, spill, clip);
+ int color_idx = (cell->d[V][0] < page->h[V][0]
+ || page->n[V] - (cell->d[V][0] + 1) < page->h[V][1]
+ ? 0
+ : (cell->d[V][0] - page->h[V][0]) & 1);
+ page->params->draw_cell (page->params->aux, cell, color_idx,
+ bb, spill, clip);
}
/* Draws the cells of PAGE indicated in BB. */
case) or a subregion enclosed by BB. In the latter case only the part
of the cell that lies within CLIP should actually be drawn, although BB
should used to determine the layout of the cell. */
- void (*draw_cell) (void *aux, const struct table_cell *cell,
+ void (*draw_cell) (void *aux, const struct table_cell *cell, int color_idx,
int bb[TABLE_N_AXES][2],
int spill[TABLE_N_AXES][2],
int clip[TABLE_N_AXES][2]);
struct cell_style
{
- struct cell_color fg, bg;
+ struct cell_color fg[2], bg[2];
int margin[TABLE_N_AXES][2];
char *font;
int font_size;
#define CELL_STYLE_INITIALIZER \
{ \
- .fg = CELL_COLOR_BLACK, \
- .bg = CELL_COLOR_WHITE, \
+ .fg = { [0] = CELL_COLOR_BLACK, [1] = CELL_COLOR_BLACK}, \
+ .bg = { [0] = CELL_COLOR_WHITE, [1] = CELL_COLOR_WHITE}, \
.margin = { [TABLE_HORZ][0] = 8, [TABLE_HORZ][1] = 11, \
[TABLE_VERT][0] = 1, [TABLE_VERT][1] = 1 }, \
.font = NULL, \