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 #include "extension/extension.h"
21 #include <set>
22 #include <string>
24 #include "libnr/nr-path.h"
25 //#include "libnrtype/font-instance.h"
26 #include "style.h"
28 #include <cairo.h>
30 class SPClipPath;
31 class SPMask;
33 namespace Inkscape {
34 namespace Extension {
35 namespace Internal {
37 class CairoRenderer;
38 class CairoRenderContext;
40 class CairoRenderer {
41 public:
42 CairoRenderer(void);
43 virtual ~CairoRenderer(void);
45 CairoRenderContext *createContext(void);
46 void destroyContext(CairoRenderContext *ctx);
48 void setStateForItem(CairoRenderContext *ctx, SPItem const *item);
50 void applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp);
51 void applyMask(CairoRenderContext *ctx, SPMask const *mask);
53 /** Initializes the CairoRenderContext according to the specified
54 SPDocument. A set*Target function can only be called on the context
55 before setupDocument. */
56 bool setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool pageBoundingBox, SPItem *base);
58 /** Traverses the object tree and invokes the render methods. */
59 void renderItem(CairoRenderContext *ctx, SPItem *item);
60 };
62 // FIXME: this should be a static method of CairoRenderer
63 void calculatePreserveAspectRatio(unsigned int aspect_align, unsigned int aspect_clip, double vp_width,
64 double vp_height, double *x, double *y, double *width, double *height);
66 } /* namespace Internal */
67 } /* namespace Extension */
68 } /* namespace Inkscape */
70 #endif /* !EXTENSION_INTERNAL_CAIRO_RENDERER_H_SEEN */
72 /*
73 Local Variables:
74 mode:c++
75 c-file-style:"stroustrup"
76 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
77 indent-tabs-mode:nil
78 fill-column:99
79 End:
80 */
81 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :