cairo-render-context.h revision 3c286c39653509ce12cd7221cc471934b1f2f475
/** \file
* Declaration of CairoRenderContext, a class used for rendering with Cairo.
*/
/*
* Authors:
* Miklos Erdelyi <erdelyim@gmail.com>
*
* Copyright (C) 2006 Miklos Erdelyi
*
* Licensed under GNU GPL
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "extension/extension.h"
#include <set>
#include <string>
#include "style.h"
#include <cairo.h>
// Holds info for rendering a glyph
struct CairoGlyphInfo {
unsigned long index;
double x;
double y;
};
struct CairoRenderState {
unsigned int need_layer : 1;
unsigned int has_overflow : 1;
float opacity;
bool has_filtereffect;
};
CairoRenderContext *cloneMe(void) const;
bool finish(void);
CairoRenderer *getRenderer(void) const;
cairo_t *getCairoContext(void) const;
typedef enum CairoRenderMode {
};
typedef enum CairoClipMode {
};
/** Set the cairo_surface_t from an external source */
void setPSLevel(unsigned int level);
unsigned int getPSLevel(void);
void setPDFLevel(unsigned int level);
void setTextToPath(bool texttopath);
bool getTextToPath(void);
void setFilterToBitmap(bool filtertobitmap);
bool getFilterToBitmap(void);
void setBitmapResolution(int resolution);
int getBitmapResolution(void);
/** Creates the cairo_surface_t for the context with the
given width, height and with the currently set target
surface type. */
cairo_surface_t *getSurface(void);
/** Saves the contents of the context to a PNG file. */
CairoRenderMode getRenderMode(void) const;
CairoClipMode getClipMode(void) const;
void pushLayer(void);
void popLayer(void);
/* Graphics state manipulation */
void pushState(void);
void popState(void);
CairoRenderState *getCurrentState(void) const;
CairoRenderState *getParentState(void) const;
/* Clipping methods */
/* Rendering methods */
/* More general rendering methods will have to be added (like fill, stroke) */
virtual ~CairoRenderContext(void);
float _width;
float _height;
unsigned short _dpi;
unsigned int _pdf_level;
unsigned int _ps_level;
bool _eps;
bool _is_texttopath;
bool _is_filtertobitmap;
int _bitmapresolution;
unsigned int _is_valid : 1;
unsigned int _vector_based_target : 1;
unsigned int _clip_rule : 8;
unsigned int _clip_winding_failed : 1;
unsigned int _showGlyphs(cairo_t *cr, PangoFont *font, std::vector<CairoGlyphInfo> const &glyphtext, bool is_stroke);
void _concatTransform(cairo_t *cr, double xx, double yx, double xy, double yy, double x0, double y0);
CairoRenderState *_createState(void);
};
} /* namespace Internal */
} /* namespace Extension */
} /* namespace Inkscape */
#endif /* !EXTENSION_INTERNAL_CAIRO_RENDER_CONTEXT_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 :