GogRenderer

## GogRenderer GogRenderer — Rendering |

## Functions

void | gog_renderer_draw_circle ()
void | gog_renderer_draw_color_map ()
void | gog_renderer_draw_data_label ()
void | gog_renderer_draw_gostring ()
void | gog_renderer_draw_grip ()
void | gog_renderer_draw_marker ()
void | gog_renderer_draw_rectangle ()
void | gog_renderer_draw_rotated_rectangle ()
void | gog_renderer_draw_selection_rectangle ()
void | gog_renderer_draw_shape ()
void | gog_renderer_draw_text ()
gboolean | gog_renderer_export_image ()
void | gog_renderer_fill_circle ()
void | gog_renderer_fill_rectangle ()
void | gog_renderer_fill_serie ()
void | gog_renderer_fill_shape ()
cairo_surface_t * | gog_renderer_get_cairo_surface ()
void | gog_renderer_get_gostring_AABR ()
void | gog_renderer_get_gostring_OBR ()
double | gog_renderer_get_hairline_width_pts ()
GdkPixbuf * | gog_renderer_get_pixbuf ()
double | gog_renderer_get_scale ()
void | gog_renderer_get_text_AABR ()
void | gog_renderer_get_text_OBR ()
#define | gog_renderer_in_grip()
double | gog_renderer_line_size ()
GogRenderer * | gog_renderer_new ()
void | gog_renderer_pop_clip ()
void | gog_renderer_pop_style ()
double | gog_renderer_pt2r ()
double | gog_renderer_pt2r_x ()
double | gog_renderer_pt2r_y ()
void | gog_renderer_push_clip ()
void | gog_renderer_push_clip_rectangle ()
void | gog_renderer_push_style ()
gboolean | gog_renderer_render_to_cairo ()
void | gog_renderer_request_update ()
void | gog_renderer_stroke_circle ()
void | gog_renderer_stroke_rectangle ()
void | gog_renderer_stroke_serie ()
void | gog_renderer_stroke_shape ()
gboolean | gog_renderer_update ()

## Types and Values

enum | GoJustification
#define | GOG_RENDERER_GRIP_SIZE
#define | GOG_RENDERER_HAIRLINE_WIDTH_PTS

## Description

Note that GogGraph has a functions for export/rendering, so you do not always need to use a GogRenderer directly.

## Functions

### gog_renderer_draw_circle ()

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

### gog_renderer_draw_color_map ()

    void
    gog_renderer_draw_color_map (GogRenderer *rend,
                                 GogAxisColorMap const *map,
                                 int discrete,
                                 gboolean horizontal,
                                 GogViewAllocation const *rect);

### gog_renderer_draw_data_label ()

    void
    gog_renderer_draw_data_label (GogRenderer *rend,
                                  GogSeriesLabelElt const *elt,
                                  GogViewAllocation const *pos,
                                  GOAnchorType anchor,
                                  GOStyle *legend_style);

### gog_renderer_draw_gostring ()

    void
    gog_renderer_draw_gostring (GogRenderer *rend,
                                GOString *str,
                                GogViewAllocation const *pos,
                                GOAnchorType anchor,
                                GoJustification justification,
                                double width);

Have `rend` draw `layout` 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.

#### Parameters

rend | GogRenderer |
str | the GOString to draw |
pos | GogViewAllocation |
anchor | GOAnchorType how to draw relative to `pos` |
justification | GoJustification for multiline string. |
width | if positive, the maximum width to get a multiline string if needed. |

### gog_renderer_draw_grip ()

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

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

#### Parameters

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

### gog_renderer_draw_marker ()

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

#### Parameters

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

### gog_renderer_draw_rectangle ()

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

A utility routine to build a closed rectangle vpath.

#### Parameters

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

### gog_renderer_draw_rotated_rectangle ()

    void
    gog_renderer_draw_rotated_rectangle (GogRenderer *rend,
                                         GogViewAllocation const *rect,
                                         gboolean rotate_bg);

### gog_renderer_draw_selection_rectangle ()

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

### gog_renderer_draw_shape ()

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

### gog_renderer_draw_text ()

    void
    gog_renderer_draw_text (GogRenderer *rend,
                            char const *text,
                            GogViewAllocation const *pos,
                            GOAnchorType anchor,
                            gboolean use_markup,
                            GoJustification justification,
                            double width);

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.

#### Parameters

rend | GogRenderer |
text | the string to draw |
pos | GogViewAllocation |
anchor | GOAnchorType how to draw relative to `pos` |
use_markup | wether to use pango markup |
justification | GoJustification for multiline text. |
width | if positive, the maximum width to get a multiline text if needed. |

### 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()`).

#### Parameters

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_fill_circle ()

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

### gog_renderer_fill_rectangle ()

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

### gog_renderer_fill_serie ()

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

### gog_renderer_fill_shape ()

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

### gog_renderer_get_cairo_surface ()

    cairo_surface_t *
    gog_renderer_get_cairo_surface (GogRenderer *renderer);

### gog_renderer_get_gostring_AABR ()

    void
    gog_renderer_get_gostring_AABR (GogRenderer *rend,
                                    GOString *str,
                                    GOGeometryAABR *aabr,
                                    double max_width);

#### Parameters

rend | GogRenderer |
str | the string to draw |
aabr | GOGeometryAABR to store the Axis Aligned Bounding Rectangle of `text` . |

### gog_renderer_get_gostring_OBR ()

    void
    gog_renderer_get_gostring_OBR (GogRenderer *rend,
                                   GOString *str,
                                   GOGeometryOBR *obr,
                                   double max_width);

#### Parameters

rend | GogRenderer |
str | the string to draw |
obr | GOGeometryOBR to store the Object Bounding Rectangle of `text` . |

### gog_renderer_get_hairline_width_pts ()

    double
    gog_renderer_get_hairline_width_pts (GogRenderer const *rend);

#### Parameters

rend | a GogRenderer |

#### Returns

the hairline width in pts.

### gog_renderer_get_pixbuf ()

    GdkPixbuf *
    gog_renderer_get_pixbuf (GogRenderer *renderer);

#### Parameters

renderer | GogRenderer |

#### Returns

current pixbuf buffer from a renderer that can render into a pixbuf. or `NULL` on error.

[transfer none]

### gog_renderer_get_scale ()

    double
    gog_renderer_get_scale (GogRenderer *renderer);

### gog_renderer_get_text_AABR ()

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

#### Parameters

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

### gog_renderer_get_text_OBR ()

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

#### Parameters

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_in_grip()

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

### gog_renderer_line_size ()

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

### gog_renderer_new ()

    GogRenderer *
    gog_renderer_new (GogGraph *graph);

#### Parameters

graph | graph model |

#### Returns

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

### gog_renderer_pop_clip ()

    void
    gog_renderer_pop_clip (GogRenderer *rend);

End the current clipping.

#### Parameters

rend | GogRenderer |

### gog_renderer_pop_style ()

    void
    gog_renderer_pop_style (GogRenderer *rend);

### gog_renderer_pt2r ()

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

### gog_renderer_pt2r_x ()

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

### gog_renderer_pt2r_y ()

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

### gog_renderer_push_clip ()

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

Defines the current clipping region.

#### Parameters

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.

#### Parameters

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

### gog_renderer_push_style ()

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

### gog_renderer_render_to_cairo ()

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

### gog_renderer_request_update ()

    void
    gog_renderer_request_update (GogRenderer *renderer);

### gog_renderer_stroke_circle ()

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

### gog_renderer_stroke_rectangle ()

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

### gog_renderer_stroke_serie ()

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

### gog_renderer_stroke_shape ()

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

### gog_renderer_update ()

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

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

#### Parameters

renderer | a GogRenderer |
w | requested width |
h | requested height |

#### Returns

`TRUE` if a redraw is necessary.

## Types and Values

### enum GoJustification

Used for justifying the text inside multiline label.

#### Members

GO_JUSTIFY_LEFT | The text is placed at the left edge of the label. |
GO_JUSTIFY_RIGHT | The text is placed at the right edge of the label. |
GO_JUSTIFY_CENTER | The text is placed in the center of the label. |
GO_JUSTIFY_FILL | The text is placed is distributed across the label. |

### GOG_RENDERER_GRIP_SIZE

    #define GOG_RENDERER_GRIP_SIZE 4

### GOG_RENDERER_HAIRLINE_WIDTH_PTS

    #define GOG_RENDERER_HAIRLINE_WIDTH_PTS 0.5