Re: goffice and cairo



Le mardi 23 mai 2006 à 11:04 +0200, Emmanuel Pacaud a écrit :
Hi,

Here's some words on what I'm working on currently.

Last weeks, I've tried to finalize the cairo SVG backend for its
inclusion as supported backend. So I hope next stable cairo will have
good PDF, PS and SVG backends.

It will then be possible to ditch our current rendering engine and
replace it by a simplified one, based on cairo.

So my plan is to implement this simplified engine, and validate it by
using it in two plot plugins, via a new GogView::cairo_render.

Here's the current in-progress API:

typedef struct _GOPathPoint     GOPathPoint;

GOPath *go_path_new         (void);
GOPath *go_path_new_with_size (int size);
void    go_path_free          (GOPath *path);

void go_path_set_sharp  (GOPath *path, gboolean sharp);

void go_path_move_to  (GOPath *path, double x, double y);
void go_path_line_to  (GOPath *path, double x, double y);
void go_path_curve_to         (GOPath *path, double x0, double y0, 
                                     double x1, double y1, 
                                     double x2, double y2);
void go_path_rectangle  (GOPath *path, double x, double y, 
                                     double width, double height);
void go_path_ring_wedge (GOPath *path, double cx, double xy,
                                     double rx_out, double ry_out, 
                                     double rx_in, double ry_in, 
                                     double th0, double th1);
void go_path_arc      (GOPath *path, double cx, double cy, 
                                     double rx, double ry, 
                                     double th0, double th1);
void go_path_pie_wedge  (GOPath *path, double cx, double cy, 
                                     double rx, double ry, 
                                     double th0, double th1);
void go_path_marker   (GOPath *path);
void go_path_close    (GOPath *path);

typedef struct _GOCairo GOCairo;

GOCairo *go_cairo_new         (void);
void go_cairo_free            (GOCairo *gcairo);

void go_cairo_push_style      (GOCairo *gcairo, GogStyle const *style);
void go_cairo_pop_style               (GOCairo *gcairo);

void go_cairo_push_clip       (GOCairo *gcairo, GOPath const *path);
void go_cairo_pop_clip        (GOCairo *gcairo);

void go_cairo_stroke          (GOCairo *gcairo, GOPath const *path);
void go_cairo_fill            (GOCairo *gcairo, GOPath const *path);
void go_cairo_draw_shape      (GOCairo *gcairo, GOPath const *path);
void go_cairo_draw_markers    (GOCairo *gcairo, GOPath const *path);
void go_cairo_draw_text               (GOCairo *gcairo, double x, double y, char
const *text, GtkAnchorType anchor);

void go_cairo_get_text_OBR    (GOCairo *gcairo, char const *text,
GOGeometryOBR *obr);
void go_cairo_get_text_AABR   (GOCairo *gcairo, char const *text,
GOGeometryAABR *aabr);

double go_cairo_line_size     (GOCairo const *gcairo, double width);
double go_cairo_pt_2r_x               (GOCairo const *gcairo, double d);
double go_cairo_pt_2r_y               (GOCairo const *gcairo, double d);
double go_cairo_pt_2r         (GOCairo const *gcairo, double d);

void go_cairo_render (GOCairo *gcairo, cairo_surface_t *surface);

All that might be included in the GOImage code I'm currently working on,
IMHO. I hope I can have something operational as soon as tomorrow ;-)

The final step would be to port all existing plot plugins. I think I'll
move pixbuf caching to gog_control_foo_canvas, and image_export and
get_pixbuf to GogGraphView.

Regarding printing, since there's no gnome-print backend for cairo, I
guess we can just render graphs as raster image.

Please, don't do that! It would be a serious regression (unless you use
high resolution. Let's use the gnome-print renderer as long as we use
gnome-print (hopefully not too long).

Cheers,
Jean




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]