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