diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-03-22 18:26:07 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-03-22 18:26:07 +0100 |
commit | b8efb1cf3ce4c57fd4a0396c2a9102630d3d6e36 (patch) | |
tree | 56280079aa0552c1c2bf3911a277be4f1fe67c7d /xps/xpsvisual.c | |
parent | 3dfc6934f9a0e355991a021ba995686714975499 (diff) | |
download | mupdf-b8efb1cf3ce4c57fd4a0396c2a9102630d3d6e36.tar.xz |
xps: import ghostxps source
Diffstat (limited to 'xps/xpsvisual.c')
-rw-r--r-- | xps/xpsvisual.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/xps/xpsvisual.c b/xps/xpsvisual.c new file mode 100644 index 00000000..f23ef991 --- /dev/null +++ b/xps/xpsvisual.c @@ -0,0 +1,62 @@ +/* Copyright (C) 2006-2010 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - visual brush functions */ + +#include "ghostxps.h" + +enum { TILE_NONE, TILE_TILE, TILE_FLIP_X, TILE_FLIP_Y, TILE_FLIP_X_Y }; + +struct userdata +{ + xps_context_t *ctx; + xps_resource_t *dict; + xps_item_t *visual_tag; +}; + +static int +xps_paint_visual_brush(xps_context_t *ctx, char *base_uri, xps_resource_t *dict, xps_item_t *root, void *visual_tag) +{ + return xps_parse_element(ctx, base_uri, dict, (xps_item_t *)visual_tag); +} + +int +xps_parse_visual_brush(xps_context_t *ctx, char *base_uri, xps_resource_t *dict, xps_item_t *root) +{ + xps_item_t *node; + int code; + + char *visual_uri; + char *visual_att; + xps_item_t *visual_tag = NULL; + + visual_att = xps_att(root, "Visual"); + + for (node = xps_down(root); node; node = xps_next(node)) + { + if (!strcmp(xps_tag(node), "VisualBrush.Visual")) + visual_tag = xps_down(node); + } + + visual_uri = base_uri; + xps_resolve_resource_reference(ctx, dict, &visual_att, &visual_tag, &visual_uri); + + if (visual_tag) + { + code = xps_parse_tiling_brush(ctx, visual_uri, dict, root, xps_paint_visual_brush, visual_tag); + if (code) + return gs_rethrow(code, "cannot parse tiling brush"); + } + + return 0; +} |