1 #ifndef EXTENSION_INTERNAL_CAIRO_RENDERER_H_SEEN
2 #define EXTENSION_INTERNAL_CAIRO_RENDERER_H_SEEN
4 /** \file
5 * Declaration of CairoRenderer, a class used for rendering via a CairoRenderContext.
6 */
7 /*
8 * Authors:
9 * Miklos Erdelyi <erdelyim@gmail.com>
10 *
11 * Copyright (C) 2006 Miklos Erdelyi
12 *
13 * Licensed under GNU GPL
14 */
16 #ifdef HAVE_CONFIG_H
17 # include "config.h"
18 #endif
20 #ifdef HAVE_CAIRO_PDF
22 #include "extension/extension.h"
23 #include <set>
24 #include <string>
26 #include "libnr/nr-path.h"
27 //#include "libnrtype/font-instance.h"
28 #include "style.h"
30 #include <cairo.h>
32 class SPClipPath;
33 class SPMask;
35 namespace Inkscape {
36 namespace Extension {
37 namespace Internal {
39 class CairoRenderer;
40 class CairoRenderContext;
42 class CairoRenderer {
43 public:
44 CairoRenderer(void);
45 virtual ~CairoRenderer(void);
47 CairoRenderContext *createContext(void);
48 void destroyContext(CairoRenderContext *ctx);
50 void setStateForItem(CairoRenderContext *ctx, SPItem const *item);
52 void applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp);
53 void applyMask(CairoRenderContext *ctx, SPMask const *mask);
55 /** Initializes the CairoRenderContext according to the specified
56 SPDocument. A set*Target function can only be called on the context
57 before setupDocument. */
58 bool setupDocument(CairoRenderContext *ctx, SPDocument *doc);
60 /** Traverses the object tree and invokes the render methods. */
61 void renderItem(CairoRenderContext *ctx, SPItem *item);
62 };
64 // FIXME: this should be a static method of CairoRenderer
65 void calculatePreserveAspectRatio(unsigned int aspect_align, unsigned int aspect_clip, double vp_width,
66 double vp_height, double *x, double *y, double *width, double *height);
68 } /* namespace Internal */
69 } /* namespace Extension */
70 } /* namespace Inkscape */
72 #endif /* HAVE_CAIRO_PDF */
74 #endif /* !EXTENSION_INTERNAL_CAIRO_RENDERER_H_SEEN */
76 /*
77 Local Variables:
78 mode:c++
79 c-file-style:"stroustrup"
80 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
81 indent-tabs-mode:nil
82 fill-column:99
83 End:
84 */
85 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :