From 0cff63c03b1535b636a67174c3ed51cae07a6200 Mon Sep 17 00:00:00 2001 From: miklosh Date: Sun, 1 Oct 2006 13:53:34 +0000 Subject: [PATCH] Initial commit of Cairo renderer for PDF export --- src/extension/internal/cairo-renderer.h | 85 +++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/extension/internal/cairo-renderer.h diff --git a/src/extension/internal/cairo-renderer.h b/src/extension/internal/cairo-renderer.h new file mode 100644 index 000000000..7ce30b9ec --- /dev/null +++ b/src/extension/internal/cairo-renderer.h @@ -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 + * + * 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 +#include + +#include "libnr/nr-path.h" +//#include "libnrtype/font-instance.h" +#include "style.h" + +#include + +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 : -- 2.30.2