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