]> www.fi.muni.cz Git - evince.git/blob - backend/impress/render.c
Bump api and libtool versions and rename libview and libdocument libraries
[evince.git] / backend / impress / render.c
1 /* imposter (OO.org Impress viewer)
2 ** Copyright (C) 2003-2005 Gurer Ozen
3 ** This code is free software; you can redistribute it and/or
4 ** modify it under the terms of GNU General Public License.
5 */
6
7 #include <config.h>
8 #include "common.h"
9 #include "internal.h"
10
11 ImpRenderCtx *
12 imp_create_context(const ImpDrawer *drw)
13 {
14         ImpRenderCtx *ctx;
15
16         ctx = calloc(1, sizeof(ImpRenderCtx));
17         if (!ctx) return NULL;
18         ctx->drw = drw;
19         return ctx;
20 }
21
22 void
23 imp_context_set_page(ImpRenderCtx *ctx, ImpPage *page)
24 {
25         ctx->page = page;
26         ctx->content = page->doc->content;
27         ctx->styles = page->doc->styles;
28 }
29
30 void
31 imp_context_set_step(ImpRenderCtx *ctx, int step)
32 {
33         ctx->step = step;
34 }
35
36 void
37 imp_render(ImpRenderCtx *ctx, void *drw_data)
38 {
39         // find drawing area size
40         ctx->drw->get_size(drw_data, &ctx->pix_w, &ctx->pix_h);
41         // find page size
42         ctx->page->doc->get_geometry(ctx);
43         // calculate ratio
44         ctx->fact_x = ctx->pix_w / ctx->cm_w;
45         ctx->fact_y = ctx->pix_h / ctx->cm_h;
46         // call renderer
47         ctx->page->doc->render_page(ctx, drw_data);
48 }
49
50 void
51 imp_delete_context(ImpRenderCtx *ctx)
52 {
53         free(ctx);
54 }