]> www.fi.muni.cz Git - evince.git/blob - backend/impress/r_back.c
Include config.h. Bug #504721.
[evince.git] / backend / impress / r_back.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 int
12 _imp_fill_back(ImpRenderCtx *ctx, void *drw_data, iks *node)
13 {
14         ImpColor col;
15         char *type;
16         char *stil, *gfx;
17         iks *x;
18
19         type = r_get_style(ctx, node, "draw:fill");
20         if (type == 0) return 0;
21
22         if (strcmp(type, "solid") == 0) {
23                 if (r_get_color(ctx, node, "draw:fill-color", &col)) {
24                         ctx->drw->set_fg_color(drw_data, &col);
25                 }
26                 ctx->drw->draw_rect(drw_data, 1, 0, 0, ctx->pix_w, ctx->pix_h);
27         } else if (strcmp (type, "bitmap") == 0) {
28                 stil = r_get_style(ctx, node, "draw:fill-image-name");
29                 x = iks_find_with_attrib(iks_find(ctx->styles, "office:styles"),
30                         "draw:fill-image", "draw:name", stil
31                 );
32                 gfx = iks_find_attrib(x, "xlink:href");
33                 if (gfx) {
34                         if (iks_strcmp(r_get_style(ctx, node, "style:repeat"), "stretch") == 0) {
35                                 _imp_draw_image(ctx, drw_data, gfx, 0, 0, ctx->pix_w, ctx->pix_h);
36                         } else {
37                                 _imp_tile_image(ctx, drw_data, gfx, 0, 0, ctx->pix_w, ctx->pix_h);
38                         }
39                 }
40         } else if (strcmp(type, "gradient") == 0) {
41                 r_draw_gradient(ctx, drw_data, node);
42         } else {
43                 return 0;
44         }
45         return 1;
46 }