## GogRenderer

GogRenderer — Multi-backend renderer

## Synopsis

                        GogRenderer;
    void                gog_renderer_request_update         (GogRenderer *r);
    void                gog_renderer_push_style             (GogRenderer *rend,
                                                             GogStyle const *style);
    void                gog_renderer_push_selection_style   (GogRenderer *renderer);
    void                gog_renderer_pop_style              (GogRenderer *rend);
    void                gog_renderer_push_clip              (GogRenderer *rend,
                                                             ArtVpath *clip_path);
    void                gog_renderer_pop_clip               (GogRenderer *rend);
    ArtVpath*           gog_renderer_get_rectangle_vpath    (GogViewAllocation const *rect);
    ArtBpath*           gog_renderer_get_ring_wedge_bpath   (double cx,
                                                             double cy,
                                                             double rx_out,
                                                             double ry_out,
                                                             double rx_in,
                                                             double ry_in,
                                                             double th0,
                                                             double th1);
    void                gog_renderer_draw_sharp_path        (GogRenderer *rend,
                                                             ArtVpath *path);
    void                gog_renderer_draw_sharp_polygon     (GogRenderer *rend,
                                                             ArtVpath *path,
                                                             gboolean narrow);
    void                gog_renderer_draw_sharp_rectangle   (GogRenderer *r,
                                                             GogViewAllocation const *rect);
    void                gog_renderer_draw_ring_wedge        (GogRenderer *rend,
                                                             double cx,
                                                             double cy,
                                                             double rx_out,
                                                             double ry_out,
                                                             double rx_in,
                                                             double ry_in,
                                                             double th0,
                                                             double th1,
                                                             gboolean narrow);
    void                gog_renderer_draw_path              (GogRenderer *rend,
                                                             ArtVpath const *path);
    void                gog_renderer_draw_polygon           (GogRenderer *rend,
                                                             ArtVpath const *path,
                                                             gboolean narrow);
    void                gog_renderer_draw_rectangle         (GogRenderer *rend,
                                                             GogViewAllocation const *rect);
    void                gog_renderer_draw_bezier_path       (GogRenderer *rend,
                                                             ArtBpath const *path);
    void                gog_renderer_draw_text              (GogRenderer *rend,
                                                             char const *text,
                                                             GogViewAllocation const *pos,
                                                             GtkAnchorType anchor,
                                                             gboolean use_markup);
    void                gog_renderer_draw_marker            (GogRenderer *rend,
                                                             double x,
                                                             double y);
    void                gog_renderer_draw_grip              (GogRenderer *renderer,
                                                             double x,
                                                             double y);
    #define             gog_renderer_in_grip                (x,y,grip_x,grip_y)
    void                gog_renderer_get_text_OBR           (GogRenderer *rend,
                                                             char const *text,
                                                             gboolean use_markup,
                                                             GOGeometryOBR *obr);
    void                gog_renderer_get_text_AABR          (GogRenderer *rend,
                                                             char const *text,
                                                             gboolean use_markup,
                                                             GOGeometryAABR *aabr);
    #define             gog_renderer_draw_arc               (r,cx,cy,rx,ry,th0,th1)
    #define             gog_renderer_draw_pie_wedge         (r,cx,cy,rx,ry,th0,th1,narrow)
    double              gog_renderer_line_size              (GogRenderer const *r,
                                                             double width);
    double              gog_renderer_pt2r_x                 (GogRenderer const *r,
                                                             double d);
    double              gog_renderer_pt2r_y                 (GogRenderer const *r,
                                                             double d);
    double              gog_renderer_pt2r                   (GogRenderer const *r,
                                                             double d);
    GogRenderer*        gog_renderer_new_for_pixbuf         (GogGraph *graph);
    GogRenderer*        gog_renderer_new_for_format         (GogGraph *graph,
                                                             GOImageFormat format);
    gboolean            gog_renderer_export_image           (GogRenderer *renderer,
                                                             GOImageFormat format,
                                                             GsfOutput *output,
                                                             double x_dpi,
                                                             double y_dpi);
    gboolean            gog_renderer_update                 (GogRenderer *renderer,
                                                             double w,
                                                             double h,
                                                             double zoom);
    GdkPixbuf*          gog_renderer_get_pixbuf             (GogRenderer *renderer);

    void                gog_graph_print_to_gnome_print      (GogGraph *graph,
                                                             GnomePrintContext *gp_context,
                                                             double width,
                                                             double height);

## Object Hierarchy

      GObject
       +----GogRenderer

## Properties

      "model"                    GogGraph              : Read / Write
      "view"                     GogView               : Read
      "zoom"                     gdouble               : Read / Write

## Signals

      "request-update"                                 : Run Last

## Description

## Details

### GogRenderer

    typedef struct _GogRenderer GogRenderer;

### gog_renderer_request_update ()

    void                gog_renderer_request_update         (GogRenderer *r);

`r` : |

### gog_renderer_push_style ()

    void                gog_renderer_push_style             (GogRenderer *rend,
                                                             GogStyle const *style);

`rend` : |
`style` : |

### gog_renderer_push_selection_style ()

    void                gog_renderer_push_selection_style   (GogRenderer *renderer);

Push a style used for selection and grip rendering.

`renderer` : | GogRenderer

### gog_renderer_pop_style ()

    void                gog_renderer_pop_style              (GogRenderer *rend);

`rend` : |

### gog_renderer_push_clip ()

    void                gog_renderer_push_clip              (GogRenderer *rend,
                                                             ArtVpath *clip_path);

Defines the current clipping region.

`rend` : | GogRenderer
`clip_path` : | ArtVpath array

### gog_renderer_pop_clip ()

    void                gog_renderer_pop_clip               (GogRenderer *rend);

End the current clipping.

`rend` : | GogRenderer

### gog_renderer_get_rectangle_vpath ()

    ArtVpath*           gog_renderer_get_rectangle_vpath    (GogViewAllocation const *rect);

a utility routine to build a rectangle path.

`rect` : |
Returns : |

### gog_renderer_get_ring_wedge_bpath ()

    ArtBpath*           gog_renderer_get_ring_wedge_bpath   (double cx,
                                                             double cy,
                                                             double rx_out,
                                                             double ry_out,
                                                             double rx_in,
                                                             double ry_in,
                                                             double th0,
                                                             double th1);

`cx` : |
`cy` : |
`rx_out` : |
`ry_out` : |
`rx_in` : |
`ry_in` : |
`th0` : |
`th1` : |
Returns : |

### gog_renderer_draw_sharp_path ()

    void                gog_renderer_draw_sharp_path        (GogRenderer *rend,
                                                             ArtVpath *path);

Draws `path` using the outline elements of the current style, trying to make line with sharp edge.

`rend` : | GogRenderer
`path` : | ArtVpath

### gog_renderer_draw_sharp_polygon ()

    void                gog_renderer_draw_sharp_polygon     (GogRenderer *rend,
                                                             ArtVpath *path,
                                                             gboolean narrow);

Draws `path` and fills it with the fill elements of the current style, trying to draw line with sharp edge. If `narrow` is false it alos outlines it using the outline elements.

`rend` : | GogRenderer
`path` : | ArtVpath
`narrow` : | if TRUE skip any outline the current style specifies.

### gog_renderer_draw_sharp_rectangle ()

    void                gog_renderer_draw_sharp_rectangle   (GogRenderer *r,
                                                             GogViewAllocation const *rect);

`r` : |
`rect` : |

### gog_renderer_draw_ring_wedge ()

    void                gog_renderer_draw_ring_wedge        (GogRenderer *rend,
                                                             double cx,
                                                             double cy,
                                                             double rx_out,
                                                             double ry_out,
                                                             double rx_in,
                                                             double ry_in,
                                                             double th0,
                                                             double th1,
                                                             gboolean narrow);

a utility routine to draw an arc.

`rend` : | GogRenderer
`cx` : | center x coordinate
`cy` : | center y coordinate
`rx_out` : | x radius
`ry_out` : | y radius
`rx_in` : |
`ry_in` : |
`th0` : | start arc angle
`th1` : | stop arc angle
`narrow` : |

### gog_renderer_draw_path ()

    void                gog_renderer_draw_path              (GogRenderer *rend,
                                                             ArtVpath const *path);

Draws `path` using the outline elements of the current style.

`rend` : | GogRenderer
`path` : | ArtVpath

### gog_renderer_draw_polygon ()

    void                gog_renderer_draw_polygon           (GogRenderer *rend,
                                                             ArtVpath const *path,
                                                             gboolean narrow);

Draws `path` and fills it with the fill elements of the current style. If `narrow` is false it alos outlines it using the outline elements.

`rend` : | GogRenderer
`path` : | ArtVpath
`narrow` : | if TRUE skip any outline the current style specifies.

### gog_renderer_draw_rectangle ()

    void                gog_renderer_draw_rectangle         (GogRenderer *rend,
                                                             GogViewAllocation const *rect);

A utility routine to build a closed rectangle vpath.

`rend` : | a GogRenderer
`rect` : | position and extent of rectangle

### gog_renderer_draw_bezier_path ()

    void                gog_renderer_draw_bezier_path       (GogRenderer *rend,
                                                             ArtBpath const *path);

Draws `path` using the outline elements of the current style.

`rend` : | GogRenderer
`path` : | ArtBpath

### gog_renderer_draw_text ()

    void                gog_renderer_draw_text              (GogRenderer *rend,
                                                             char const *text,
                                                             GogViewAllocation const *pos,
                                                             GtkAnchorType anchor,
                                                             gboolean use_markup);

Have `rend` draw `text` in the at `pos`.{x,y} anchored by the `anchor` corner. If `pos.w` or `pos.h` are >= 0 then clip the results to less than that size.

`rend` : | GogRenderer
`text` : | the string to draw
`pos` : | GogViewAllocation
`anchor` : | GtkAnchorType how to draw relative to `pos`
`use_markup` : | wether to use pango markup

### gog_renderer_draw_marker ()

    void                gog_renderer_draw_marker            (GogRenderer *rend,
                                                             double x,
                                                             double y);

`rend` : | GogRenderer
`x` : | X-coordinate
`y` : | Y-coordinate

### gog_renderer_draw_grip ()

    void                gog_renderer_draw_grip              (GogRenderer *renderer,
                                                             double x,
                                                             double y);

Draw a grip, used for moving/resizing of objects.

`renderer` : | GogRenderer
`x` : | x position of grip
`y` : | y position of grip

### gog_renderer_in_grip()

    #define             gog_renderer_in_grip(x,y,grip_x,grip_y)

`x` : |
`y` : |
`grip_x` : |
`grip_y` : |

### gog_renderer_get_text_OBR ()

    void                gog_renderer_get_text_OBR           (GogRenderer *rend,
                                                             char const *text,
                                                             gboolean use_markup,
                                                             GOGeometryOBR *obr);

`rend` : | GogRenderer
`text` : | the string to draw
`use_markup` : | wether to use pango markup
`obr` : | GOGeometryOBR to store the Object Bounding Rectangle of `text`.

### gog_renderer_get_text_AABR ()

    void                gog_renderer_get_text_AABR          (GogRenderer *rend,
                                                             char const *text,
                                                             gboolean use_markup,
                                                             GOGeometryAABR *aabr);

`rend` : | GogRenderer
`text` : | the string to draw
`use_markup` : | wether to use pango markup
`aabr` : | GOGeometryAABR to store the Axis Aligned Bounding Rectangle of `text`.

### gog_renderer_draw_arc()

    #define             gog_renderer_draw_arc(r,cx,cy,rx,ry,th0,th1)

`r` : |
`cx` : |
`cy` : |
`rx` : |
`ry` : |
`th0` : |
`th1` : |

### gog_renderer_draw_pie_wedge()

    #define             gog_renderer_draw_pie_wedge(r,cx,cy,rx,ry,th0,th1,narrow)

`r` : |
`cx` : |
`cy` : |
`rx` : |
`ry` : |
`th0` : |
`th1` : |
`narrow` : |

### gog_renderer_line_size ()

    double              gog_renderer_line_size              (GogRenderer const *r,
                                                             double width);

`r` : |
`width` : |
Returns : |

### gog_renderer_pt2r_x ()

    double              gog_renderer_pt2r_x                 (GogRenderer const *r,
                                                             double d);

`r` : |
`d` : |
Returns : |

### gog_renderer_pt2r_y ()

    double              gog_renderer_pt2r_y                 (GogRenderer const *r,
                                                             double d);

`r` : |
`d` : |
Returns : |

### gog_renderer_pt2r ()

    double              gog_renderer_pt2r                   (GogRenderer const *r,
                                                             double d);

`r` : |
`d` : |
Returns : |

### gog_renderer_new_for_pixbuf ()

    GogRenderer*        gog_renderer_new_for_pixbuf         (GogGraph *graph);

Creates a new renderer which can render into a pixbuf, and sets `graph` as its model.

`graph` : | graph model
Returns : |

### gog_renderer_new_for_format ()

    GogRenderer*        gog_renderer_new_for_format         (GogGraph *graph,
                                                             GOImageFormat format);

Creates a new GogRenderer which is capable of export to `format`.

`graph` : | a GogGraph
`format` : | image format
Returns : | a new GogRenderer.

### gog_renderer_export_image ()

    gboolean            gog_renderer_export_image           (GogRenderer *renderer,
                                                             GOImageFormat format,
                                                             GsfOutput *output,
                                                             double x_dpi,
                                                             double y_dpi);

Exports an image of `graph` in given `format`, writing results in a GsfOutput stream. If export format type is a bitmap one, it computes image size with x_dpi, y_dpi and `graph` size (see `gog_graph_get_size()`).

`renderer` : | a GogRenderer
`format` : | image format for export
`output` : | a GsfOutput stream
`x_dpi` : | x resolution of exported graph
`y_dpi` : | y resolution of exported graph
Returns : | `TRUE` if export succeed.

### gog_renderer_update ()

    gboolean            gog_renderer_update                 (GogRenderer *renderer,
                                                             double w,
                                                             double h,
                                                             double zoom);

Requests a renderer update, only useful for pixbuf based renderer.

`renderer` : | a GogRenderer
`w` : | requested width
`h` : | requested height
`zoom` : | requested zoom
Returns : |

### gog_renderer_get_pixbuf ()

    GdkPixbuf*          gog_renderer_get_pixbuf             (GogRenderer *renderer);

`renderer` : | GogRenderer
Returns : | current pixbuf buffer from a renderer that can render into a pixbuf.

### gog_graph_print_to_gnome_print ()

    void                gog_graph_print_to_gnome_print      (GogGraph *graph,
                                                             GnomePrintContext *gp_context,
                                                             double width,
                                                             double height);

`graph` : |
`gp_context` : |
`width` : |
`height` : |

## Property Details

### The `"model"` property

      "model"                    GogGraph              : Read / Write

The GogGraph this renderer displays.

### The `"view"` property

      "view"                     GogView               : Read

the GogView this renderer is displaying.

### The `"zoom"` property

      "zoom"                     gdouble               : Read / Write

Global scale factor.

Allowed values: >= 1

Default value: 1

## Signal Details

### The `"request-update"` signal

    void                user_function                      (GogRenderer *gogrenderer,
                                                            gpointer     user_data)        : Run Last

`gogrenderer` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.