Code

Initial commit of Cairo renderer for PDF export
authormiklosh <miklosh@users.sourceforge.net>
Sun, 1 Oct 2006 13:53:34 +0000 (13:53 +0000)
committermiklosh <miklosh@users.sourceforge.net>
Sun, 1 Oct 2006 13:53:34 +0000 (13:53 +0000)
src/extension/internal/cairo-renderer.h [new file with mode: 0644]

diff --git a/src/extension/internal/cairo-renderer.h b/src/extension/internal/cairo-renderer.h
new file mode 100644 (file)
index 0000000..7ce30b9
--- /dev/null
@@ -0,0 +1,85 @@
+#ifndef EXTENSION_INTERNAL_CAIRO_RENDERER_H_SEEN
+#define EXTENSION_INTERNAL_CAIRO_RENDERER_H_SEEN
+
+/** \file
+ * Declaration of CairoRenderer, a class used for rendering via a CairoRenderContext.
+ */
+/*
+ * Authors:
+ *        Miklos Erdelyi <erdelyim@gmail.com>
+ *
+ * Copyright (C) 2006 Miklos Erdelyi
+ * 
+ * Licensed under GNU GPL
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef HAVE_CAIRO_PDF
+
+#include "extension/extension.h"
+#include <set>
+#include <string>
+
+#include "libnr/nr-path.h"
+//#include "libnrtype/font-instance.h"
+#include "style.h"
+
+#include <cairo.h>
+
+class SPClipPath;
+class SPMask;
+
+namespace Inkscape {
+namespace Extension {
+namespace Internal {
+
+class CairoRenderer;
+class CairoRenderContext;
+
+class CairoRenderer {
+public:
+    CairoRenderer(void);
+    ~CairoRenderer(void);
+    
+    CairoRenderContext *createContext(void);
+    void destroyContext(CairoRenderContext *ctx);
+
+    void setStateForItem(CairoRenderContext *ctx, SPItem const *item);
+
+    void applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp);
+    void applyMask(CairoRenderContext *ctx, SPMask const *mask);
+
+    /** Initializes the CairoRenderContext according to the specified
+    SPDocument. A set*Target function can only be called on the context
+    before setupDocument. */
+    bool setupDocument(CairoRenderContext *ctx, SPDocument *doc);
+
+    /** Traverses the object tree and invokes the render methods. */
+    void renderItem(CairoRenderContext *ctx, SPItem *item);
+};
+
+// FIXME: this should be a static method of CairoRenderer
+void calculatePreserveAspectRatio(unsigned int aspect_align, unsigned int aspect_clip, double vp_width,
+                                  double vp_height, double *x, double *y, double *width, double *height);
+
+}  /* namespace Internal */
+}  /* namespace Extension */
+}  /* namespace Inkscape */
+
+#endif /* HAVE_CAIRO_PDF */
+
+#endif /* !EXTENSION_INTERNAL_CAIRO_RENDERER_H_SEEN */
+
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+  indent-tabs-mode:nil
+  fill-column:99
+  End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :