Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / extension / internal / cairo-renderer.h
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  *   Abhishek Sharma
11  *
12  * Copyright (C) 2006 Miklos Erdelyi
13  * 
14  * Licensed under GNU GPL
15  */
17 #ifdef HAVE_CONFIG_H
18 # include "config.h"
19 #endif
21 #include "extension/extension.h"
22 #include <set>
23 #include <string>
25 //#include "libnrtype/font-instance.h"
26 #include "style.h"
27 #include "sp-item.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);
44     
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);
61     /** If _omitText is true, no text will be output to the PDF document.
62         The PDF will be exactly the same as if the text was written to it and then erased. */
63     bool _omitText;
64 };
66 // FIXME: this should be a static method of CairoRenderer
67 void calculatePreserveAspectRatio(unsigned int aspect_align, unsigned int aspect_clip, double vp_width,
68                                   double vp_height, double *x, double *y, double *width, double *height);
70 }  /* namespace Internal */
71 }  /* namespace Extension */
72 }  /* namespace Inkscape */
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:fileencoding=utf-8:textwidth=99 :