Code

Fixed messed up transformations because of a missing cairo_restore() and removed...
[inkscape.git] / src / extension / internal / cairo-render-context.h
index 7659c3518162432456b476847ddc60178c83f7b7..58b0a10e2812b814c92ab75204f68686e1004291 100644 (file)
@@ -9,7 +9,7 @@
  *        Miklos Erdelyi <erdelyim@gmail.com>
  *
  * Copyright (C) 2006 Miklos Erdelyi
- * 
+ *
  * Licensed under GNU GPL
  */
 
@@ -17,8 +17,6 @@
 # include "config.h"
 #endif
 
-#ifdef HAVE_CAIRO_PDF
-
 #include "extension/extension.h"
 #include <set>
 #include <string>
@@ -55,6 +53,7 @@ struct CairoRenderState {
     unsigned int has_overflow : 1;
     unsigned int parent_has_userspace : 1;  // whether the parent's ctm should be applied
     float opacity;
+    bool has_filtereffect;
 
     SPClipPath *clip_path;
     SPMask* mask;
@@ -76,14 +75,22 @@ public:
         RENDER_MODE_NORMAL,
         RENDER_MODE_CLIP
     };
-    
+
     typedef enum CairoClipMode {
         CLIP_MODE_PATH,
         CLIP_MODE_MASK
     };
-    
+
     bool setImageTarget(cairo_format_t format);
     bool setPdfTarget(gchar const *utf8_fn);
+    bool setPsTarget(gchar const *utf8_fn);
+    /** Set the cairo_surface_t from an external source */
+    bool setSurfaceTarget(cairo_surface_t *surface, bool is_vector);
+
+    void setPSLevel(unsigned int level);
+    void setPDFLevel(unsigned int level);
+    void setTextToPath(bool texttopath);
+    void setFilterToBitmap(bool filtertobitmap);
 
     /** Creates the cairo_surface_t for the context with the
     given width, height and with the currently set target
@@ -100,10 +107,10 @@ public:
     CairoRenderMode getRenderMode(void) const;
     void setClipMode(CairoClipMode mode);
     CairoClipMode getClipMode(void) const;
-    
+
     void addBpath(NArtBpath const *bp);
     void setBpath(NArtBpath const *bp);
-    
+
     void pushLayer(void);
     void popLayer(void);
 
@@ -134,14 +141,18 @@ public:
 
 protected:
     CairoRenderContext(CairoRenderer *renderer);
-    ~CairoRenderContext(void);
-    
+    virtual ~CairoRenderContext(void);
+
     float _width;
     float _height;
     unsigned short _dpi;
-    
+    unsigned int _pdf_level;
+    unsigned int _ps_level;
+    bool _is_texttopath;
+    bool _is_filtertobitmap;
+
     FILE *_stream;
-    
+
     unsigned int _is_valid : 1;
     unsigned int _vector_based_target : 1;
 
@@ -150,13 +161,13 @@ protected:
     cairo_surface_type_t _target;
     cairo_format_t _target_format;
     PangoLayout *_layout;
-    
+
     unsigned int _clip_rule : 8;
     unsigned int _clip_winding_failed : 1;
-    
+
     GSList *_state_stack;
     CairoRenderState *_state;    // the current state
-    
+
     CairoRenderer *_renderer;
 
     CairoRenderMode _render_mode;
@@ -165,12 +176,13 @@ protected:
     cairo_pattern_t *_createPatternForPaintServer(SPPaintServer const *const paintserver,
                                                   NRRect const *pbox, float alpha);
     cairo_pattern_t *_createPatternPainter(SPPaintServer const *const paintserver, NRRect const *pbox);
-   
+
     unsigned int _showGlyphs(cairo_t *cr, PangoFont *font, std::vector<CairoGlyphInfo> const &glyphtext, bool is_stroke);
 
+    bool _finishSurfaceSetup(cairo_surface_t *surface);
     void _setFillStyle(SPStyle const *style, NRRect const *pbox);
     void _setStrokeStyle(SPStyle const *style, NRRect const *pbox);
-    
+
     void _initCairoMatrix(cairo_matrix_t *matrix, NRMatrix const *transform);
     void _concatTransform(cairo_t *cr, double xx, double yx, double xy, double yy, double x0, double y0);
     void _concatTransform(cairo_t *cr, NRMatrix const *transform);
@@ -182,8 +194,6 @@ protected:
 }  /* namespace Extension */
 }  /* namespace Inkscape */
 
-#endif /* HAVE_CAIRO_PDF */
-
 #endif /* !EXTENSION_INTERNAL_CAIRO_RENDER_CONTEXT_H_SEEN */
 
 /*