X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcairo.c;h=2debb27f4725a344e3a9a53a98059cfa95878e64;hb=refs%2Fbuilds%2F20131224033012%2Fpspp;hp=cb901258d3acaaf8f760d371f7fc6010a31de98c;hpb=d036c4b79922f2339e7db9d0aef7ecad5e93bd91;p=pspp diff --git a/src/output/cairo.c b/src/output/cairo.c index cb901258d3..2debb27f47 100644 --- a/src/output/cairo.c +++ b/src/output/cairo.c @@ -110,13 +110,6 @@ struct xr_render_fsm void (*destroy) (struct xr_render_fsm *); }; -struct xr_color -{ - double red; - double green; - double blue; -}; - /* Cairo output driver. */ struct xr_driver { @@ -191,7 +184,7 @@ opt (struct output_driver *d, struct string_map *options, const char *key, Future implementations might allow things like "yellow" and "sky-blue-ultra-brown" */ -static void +void parse_color (struct output_driver *d, struct string_map *options, const char *key, const char *default_value, struct xr_color *color) @@ -1034,11 +1027,9 @@ xr_rendering_measure (struct xr_rendering *r, int *w, int *h) static void xr_draw_chart (const struct chart_item *, cairo_t *, double x, double y, double width, double height); -/* Draws onto CR at least the region of R that is enclosed in (X,Y)-(X+W,Y+H), - and possibly some additional parts. */ +/* Draws onto CR */ void -xr_rendering_draw (struct xr_rendering *r, cairo_t *cr, - int x, int y, int w, int h) +xr_rendering_draw_all (struct xr_rendering *r, cairo_t *cr) { if (is_table_item (r->item)) { @@ -1054,9 +1045,7 @@ xr_rendering_draw (struct xr_rendering *r, cairo_t *cr, } xr->y = r->title_height; - render_page_draw_region (r->page, - x * XR_POINT, (y * XR_POINT) - r->title_height, - w * XR_POINT, h * XR_POINT); + render_page_draw (r->page); } else xr_draw_chart (to_chart_item (r->item), cr, @@ -1096,7 +1085,10 @@ xr_draw_chart (const struct chart_item *chart_item, cairo_t *cr, char * xr_draw_png_chart (const struct chart_item *item, - const char *file_name_template, int number) + const char *file_name_template, int number, + const struct xr_color *fg, + const struct xr_color *bg + ) { const int width = 640; const int length = 480; @@ -1117,7 +1109,10 @@ xr_draw_png_chart (const struct chart_item *item, surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, length); cr = cairo_create (surface); - cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); + cairo_set_source_rgb (cr, bg->red, bg->green, bg->blue); + cairo_paint (cr); + + cairo_set_source_rgb (cr, fg->red, fg->green, fg->blue); xr_draw_chart (item, cr, 0.0, 0.0, width, length);