diff --git a/src/ag-chart.c b/src/ag-chart.c index 0dc0e6f..d0b1e87 100644 --- a/src/ag-chart.c +++ b/src/ag-chart.c @@ -1892,16 +1892,15 @@ ag_chart_export_svg_to_file(AgChart *chart, ); } -void -ag_chart_export_jpg_to_file(AgChart *chart, - GFile *file, - AgDisplayTheme *theme, - GError **err) +GdkPixbuf * +ag_chart_get_pixbuf(AgChart *chart, + guint image_size, + guint icon_size, + AgDisplayTheme *theme, + GError **err) { - gchar *svg, - *jpg; - gsize svg_length, - jpg_length; + gchar *svg; + gsize svg_length; RsvgHandle *svg_handle; GdkPixbuf *pixbuf; @@ -1910,10 +1909,11 @@ ag_chart_export_jpg_to_file(AgChart *chart, &svg_length, TRUE, theme, - 0, 0, + image_size, + icon_size, err )) == NULL) { - return; + return NULL; } if ((svg_handle = rsvg_handle_new_from_data( @@ -1923,7 +1923,7 @@ ag_chart_export_jpg_to_file(AgChart *chart, )) == NULL) { g_free(svg); - return; + return NULL; } g_free(svg); @@ -1935,6 +1935,25 @@ ag_chart_export_jpg_to_file(AgChart *chart, _("Unknown rendering error") ); + return NULL; + } + + return pixbuf; +} + +void +ag_chart_export_jpg_to_file(AgChart *chart, + GFile *file, + AgDisplayTheme *theme, + GError **err) +{ + gchar *jpg; + gsize jpg_length; + GdkPixbuf *pixbuf; + + pixbuf = ag_chart_get_pixbuf(chart, 0, 0, theme, err); + + if (pixbuf == NULL) { return; } diff --git a/src/ag-chart.h b/src/ag-chart.h index 8bc85fb..0bf8bb3 100644 --- a/src/ag-chart.h +++ b/src/ag-chart.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "ag-db.h" #include "ag-display-theme.h" @@ -140,6 +141,12 @@ const gchar *ag_chart_get_note(AgChart *chart); AgDbChartSave *ag_chart_get_db_save(AgChart *chart, gint db_id); +GdkPixbuf *ag_chart_get_pixbuf(AgChart *chart, + guint image_size, + guint icon_size, + AgDisplayTheme *theme, + GError **err); + #define AG_CHART_ERROR (ag_chart_error_quark()) GQuark ag_chart_error_quark(void);