## GogRenderer

GogRenderer

## Synopsis

                        GogRenderer;
    GogRenderer *       gog_renderer_new                    (GogGraph *graph);
    void                gog_renderer_draw_selection_rectangle
                                                            (GogRenderer *renderer,
                                                             GogViewAllocation const *rectangle);
    void                gog_renderer_draw_shape             (GogRenderer *renderer,
                                                             GOPath const *path);
    void                gog_renderer_fill_serie             (GogRenderer *renderer,
                                                             GOPath const *path,
                                                             GOPath const *close_path);
    void                gog_renderer_fill_shape             (GogRenderer *renderer,
                                                             GOPath const *path);
    void                gog_renderer_fill_circle            (GogRenderer *rend,
                                                             double x,
                                                             double y,
                                                             double r);
    void                gog_renderer_fill_rectangle         (GogRenderer *rend,
                                                             GogViewAllocation const *rect);
    double              gog_renderer_get_hairline_width_pts (GogRenderer const *rend);
    void                gog_renderer_push_clip_rectangle    (GogRenderer *rend,
                                                             double x,
                                                             double y,
                                                             double w,
                                                             double h);
    gboolean            gog_renderer_render_to_cairo        (GogRenderer *renderer,
                                                             cairo_t *cairo,
                                                             double width,
                                                             double height);
    void                gog_renderer_stroke_serie           (GogRenderer *renderer,
                                                             GOPath const *path);
    void                gog_renderer_stroke_shape           (GogRenderer *renderer,
                                                             GOPath const *path);
    void                gog_renderer_stroke_circle          (GogRenderer *rend,
                                                             double x,
                                                             double y,
                                                             double r);
    void                gog_renderer_stroke_rectangle       (GogRenderer *rend,
                                                             GogViewAllocation const *rect);
    void                gog_renderer_request_update         (GogRenderer *renderer);
    void                gog_renderer_push_style             (GogRenderer *rend,
                                                             GOStyle const *style);
    void                gog_renderer_pop_style              (GogRenderer *rend);
    void                gog_renderer_push_clip              (GogRenderer *rend,
                                                             GOPath const *path);
    void                gog_renderer_pop_clip               (GogRenderer *rend);
    void                gog_renderer_draw_circle            (GogRenderer *rend,
                                                             double x,
                                                             double y,
                                                             double r);
    void                gog_renderer_draw_rectangle         (GogRenderer *rend,
                                                             GogViewAllocation const *rect);
    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);
    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);
    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);
    GdkPixbuf *         gog_renderer_get_pixbuf             (GogRenderer *renderer);
    cairo_surface_t *   gog_renderer_get_cairo_surface      (GogRenderer *renderer);

## Object Hierarchy

      GObject
       +----GogRenderer

## Properties

      "model"                    GogGraph*             : Read / Write
      "view"                     GogView*              : Read

## Signals

      "request-update"                                 : Run Last

## Description

## Details

### GogRenderer

    typedef struct _GogRenderer GogRenderer;

### gog_renderer_new ()

    GogRenderer *       gog_renderer_new                    (GogGraph *graph);

`graph` : | graph model
Returns : | a new GogRenderer which can render into a pixbuf, and sets `graph` as its model.

### gog_renderer_draw_selection_rectangle ()

    void                gog_renderer_draw_selection_rectangle
                                                            (GogRenderer *renderer,
                                                             GogViewAllocation const *rectangle);

`renderer` : |
`rectangle` : |

### gog_renderer_draw_shape ()

    void                gog_renderer_draw_shape             (GogRenderer *renderer,
                                                             GOPath const *path);

`renderer` : |
`path` : |

### gog_renderer_fill_serie ()

    void                gog_renderer_fill_serie             (GogRenderer *renderer,
                                                             GOPath const *path,
                                                             GOPath const *close_path);

`renderer` : |
`path` : |
`close_path` : |

### gog_renderer_fill_shape ()

    void                gog_renderer_fill_shape             (GogRenderer *renderer,
                                                             GOPath const *path);

`renderer` : |
`path` : |

### gog_renderer_fill_circle ()

    void                gog_renderer_fill_circle            (GogRenderer *rend,
                                                             double x,
                                                             double y,
                                                             double r);

`rend` : |
`x` : |
`y` : |
`r` : |

### gog_renderer_fill_rectangle ()

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

`rend` : |
`rect` : |

### gog_renderer_get_hairline_width_pts ()

    double              gog_renderer_get_hairline_width_pts (GogRenderer const *rend);

`rend` : | a GogRenderer
Returns : | the hairline width in pts.

### gog_renderer_push_clip_rectangle ()

    void                gog_renderer_push_clip_rectangle    (GogRenderer *rend,
                                                             double x,
                                                             double y,
                                                             double w,
                                                             double h);

Defines a rectangular clipping region. For efficient screen rendering, this function takes care to round the coordinates.

`rend` : | GogRenderer
`x` : | left coordinate
`y` : | top coordinate
`w` : | width of clipping rectangle
`h` : | height of clipping rectangle

### gog_renderer_render_to_cairo ()

    gboolean            gog_renderer_render_to_cairo        (GogRenderer *renderer,
                                                             cairo_t *cairo,
                                                             double width,
                                                             double height);

`renderer` : |
`cairo` : |
`width` : |
`height` : |
Returns : |

### gog_renderer_stroke_serie ()

    void                gog_renderer_stroke_serie           (GogRenderer *renderer,
                                                             GOPath const *path);

`renderer` : |
`path` : |

### gog_renderer_stroke_shape ()

    void                gog_renderer_stroke_shape           (GogRenderer *renderer,
                                                             GOPath const *path);

`renderer` : |
`path` : |

### gog_renderer_stroke_circle ()

    void                gog_renderer_stroke_circle          (GogRenderer *rend,
                                                             double x,
                                                             double y,
                                                             double r);

`rend` : |
`x` : |
`y` : |
`r` : |

### gog_renderer_stroke_rectangle ()

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

`rend` : |
`rect` : |

### gog_renderer_request_update ()

    void                gog_renderer_request_update         (GogRenderer *renderer);

`renderer` : |

### gog_renderer_push_style ()

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

`rend` : |
`style` : |

### gog_renderer_pop_style ()

    void                gog_renderer_pop_style              (GogRenderer *rend);

`rend` : |

### gog_renderer_push_clip ()

    void                gog_renderer_push_clip              (GogRenderer *rend,
                                                             GOPath const *path);

Defines the current clipping region.

`rend` : | GogRenderer
`path` : | a GOPath

### gog_renderer_pop_clip ()

    void                gog_renderer_pop_clip               (GogRenderer *rend);

End the current clipping.

`rend` : | GogRenderer

### gog_renderer_draw_circle ()

    void                gog_renderer_draw_circle            (GogRenderer *rend,
                                                             double x,
                                                             double y,
                                                             double r);

`rend` : |
`x` : |
`y` : |
`r` : |

### 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_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_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_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);

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

`renderer` : | a GogRenderer
`w` : | requested width
`h` : | requested height
Returns : | `TRUE` if a redraw is necessary.

### 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. or `NULL` on error.

### gog_renderer_get_cairo_surface ()

    cairo_surface_t *   gog_renderer_get_cairo_surface      (GogRenderer *renderer);

`renderer` : |
Returns : |

## 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.

## 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.