## GogRenderer GogRenderer — Rendering engine |

## Synopsis

                        GdkPixbuf;
    enum                GtkAnchorType;
    #define             GOG_RENDERER_CAIRO_WITH_SVG
    #define             GOG_RENDERER_CAIRO_WITH_PDF
    #define             GOG_RENDERER_CAIRO_WITH_PS
    #define             GOG_RENDERER_HAIRLINE_WIDTH_PTS
    #define             GOG_RENDERER_GRIP_SIZE
    #define             GOG_RENDERER_TYPE
    #define             GOG_RENDERER                        (o)
    #define             IS_GOG_RENDERER                     (o)
    #define             GOG_RENDERER_GET_CLASS              (o)
    GType               gog_renderer_get_type               (void);
    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);
    double              gog_renderer_get_hairline_width_pts (GogRenderer const *rend);
    void                gog_renderer_stroke_serie           (GogRenderer *renderer,
                                                             GOPath const *path);
    void                gog_renderer_fill_serie             (GogRenderer *renderer,
                                                             GOPath const *path,
                                                             GOPath const *close_path);
    void                gog_renderer_draw_shape             (GogRenderer *renderer,
                                                             GOPath const *path);
    void                gog_renderer_stroke_shape           (GogRenderer *renderer,
                                                             GOPath const *path);
    void                gog_renderer_fill_shape             (GogRenderer *renderer,
                                                             GOPath const *path);
    void                gog_renderer_draw_circle            (GogRenderer *rend,
                                                             double x,
                                                             double y,
                                                             double r);
    void                gog_renderer_stroke_circle          (GogRenderer *rend,
                                                             double x,
                                                             double y,
                                                             double r);
    void                gog_renderer_fill_circle            (GogRenderer *rend,
                                                             double x,
                                                             double y,
                                                             double r);
    void                gog_renderer_draw_rectangle         (GogRenderer *rend,
                                                             GogViewAllocation const *rect);
    void                gog_renderer_stroke_rectangle       (GogRenderer *rend,
                                                             GogViewAllocation const *rect);
    void                gog_renderer_fill_rectangle         (GogRenderer *rend,
                                                             GogViewAllocation const *rect);
    void                gog_renderer_draw_grip              (GogRenderer *renderer,
                                                             double x,
                                                             double y);
    void                gog_renderer_draw_selection_rectangle
                                                            (GogRenderer *renderer,
                                                             GogViewAllocation const *rectangle);
    #define             gog_renderer_in_grip                (x,y,grip_x,grip_y)
    void                gog_renderer_draw_marker            (GogRenderer *rend,
                                                             double x,
                                                             double y);
    void                gog_renderer_draw_text              (GogRenderer *rend,
                                                             char const *text,
                                                             GogViewAllocation const *pos,
                                                             GtkAnchorType anchor,
                                                             gboolean use_markup);
    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);
    void                gog_renderer_push_style             (GogRenderer *rend,
                                                             GogStyle const *style);
    void                gog_renderer_pop_style              (GogRenderer *rend);
    void                gog_renderer_push_clip              (GogRenderer *rend,
                                                             GOPath const *path);
    void                gog_renderer_push_clip_rectangle    (GogRenderer *rend,
                                                             double x,
                                                             double y,
                                                             double w,
                                                             double h);
    void                gog_renderer_pop_clip               (GogRenderer *rend);
    gboolean            gog_renderer_update                 (GogRenderer *renderer,
                                                             double w,
                                                             double h);
    cairo_surface_t*    gog_renderer_get_cairo_surface      (GogRenderer *renderer);
    GdkPixbuf*          gog_renderer_get_pixbuf             (GogRenderer *renderer);
    void                gog_renderer_request_update         (GogRenderer *renderer);
    gboolean            gog_renderer_render_to_cairo        (GogRenderer *renderer,
                                                             cairo_t *cairo,
                                                             double width,
                                                             double height);
    gboolean            gog_renderer_export_image           (GogRenderer *renderer,
                                                             GOImageFormat format,
                                                             GsfOutput *output,
                                                             double x_dpi,
                                                             double y_dpi);
    GogRenderer*        gog_renderer_new                    (GogGraph *graph);
    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_path              (GogRenderer *rend,
                                                             ArtVpath const *path);
    void                gog_renderer_draw_polygon           (GogRenderer *rend,
                                                             ArtVpath const *path,
                                                             gboolean narrow);
    void                gog_renderer_draw_bezier_path       (GogRenderer *rend,
                                                             ArtBpath const *path);

## Object Hierarchy

      GObject
       +----GdkPixbuf

## Description

## Details

### GdkPixbuf

    typedef struct _GdkPixbuf GdkPixbuf;

### enum GtkAnchorType

    typedef enum
    {
      GTK_ANCHOR_CENTER,
      GTK_ANCHOR_NORTH,
      GTK_ANCHOR_NORTH_WEST,
      GTK_ANCHOR_NORTH_EAST,
      GTK_ANCHOR_SOUTH,
      GTK_ANCHOR_SOUTH_WEST,
      GTK_ANCHOR_SOUTH_EAST,
      GTK_ANCHOR_WEST,
      GTK_ANCHOR_EAST,
      GTK_ANCHOR_N		= GTK_ANCHOR_NORTH,
      GTK_ANCHOR_NW		= GTK_ANCHOR_NORTH_WEST,
      GTK_ANCHOR_NE		= GTK_ANCHOR_NORTH_EAST,
      GTK_ANCHOR_S		= GTK_ANCHOR_SOUTH,
      GTK_ANCHOR_SW		= GTK_ANCHOR_SOUTH_WEST,
      GTK_ANCHOR_SE		= GTK_ANCHOR_SOUTH_EAST,
      GTK_ANCHOR_W		= GTK_ANCHOR_WEST,
      GTK_ANCHOR_E		= GTK_ANCHOR_EAST
    } GtkAnchorType;

### GOG_RENDERER_CAIRO_WITH_SVG

    #define GOG_RENDERER_CAIRO_WITH_SVG

### GOG_RENDERER_CAIRO_WITH_PDF

    #define GOG_RENDERER_CAIRO_WITH_PDF

### GOG_RENDERER_CAIRO_WITH_PS

    #define GOG_RENDERER_CAIRO_WITH_PS

### GOG_RENDERER_HAIRLINE_WIDTH_PTS

    #define GOG_RENDERER_HAIRLINE_WIDTH_PTS	0.5

### GOG_RENDERER_GRIP_SIZE

    #define GOG_RENDERER_GRIP_SIZE	4

### GOG_RENDERER_TYPE

    #define GOG_RENDERER_TYPE	  (gog_renderer_get_type ())

### GOG_RENDERER()

    #define GOG_RENDERER(o)           (G_TYPE_CHECK_INSTANCE_CAST((o), GOG_RENDERER_TYPE, GogRenderer))

`o` : |

### IS_GOG_RENDERER()

    #define IS_GOG_RENDERER(o)        (G_TYPE_CHECK_INSTANCE_TYPE((o), GOG_RENDERER_TYPE))

`o` : |

### GOG_RENDERER_GET_CLASS()

    #define GOG_RENDERER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GOG_RENDERER_TYPE, GogRendererClass))

`o` : |

### gog_renderer_get_type ()

    GType               gog_renderer_get_type               (void);

Returns : |

### 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_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_stroke_serie ()

    void                gog_renderer_stroke_serie           (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_draw_shape ()

    void                gog_renderer_draw_shape             (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_fill_shape ()

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

`renderer` : |
`path` : |

### gog_renderer_draw_circle ()

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

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

### gog_renderer_stroke_circle ()

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

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

### gog_renderer_fill_circle ()

    void                gog_renderer_fill_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_stroke_rectangle ()

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

`rend` : |
`rect` : |

### gog_renderer_fill_rectangle ()

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

`rend` : |
`rect` : |

### 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_draw_selection_rectangle ()

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

`renderer` : |
`rectangle` : |

### gog_renderer_in_grip()

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

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

### 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_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_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_push_style ()

    void                gog_renderer_push_style             (GogRenderer *rend,
                                                             GogStyle 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_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_pop_clip ()

    void                gog_renderer_pop_clip               (GogRenderer *rend);

End the current clipping.

`rend` : | GogRenderer

### 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_cairo_surface ()

    cairo_surface_t*    gog_renderer_get_cairo_surface      (GogRenderer *renderer);

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

### gog_renderer_request_update ()

    void                gog_renderer_request_update         (GogRenderer *renderer);

`renderer` : |

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