cairo-renderer.cpp revision 16dc3cff4d07c7f5afdd8c74cf34530b0a6ee93b
333N/A#define __SP_CAIRO_RENDERER_C__
333N/A#ifdef HAVE_CONFIG_H
333N/A#ifndef PANGO_ENABLE_BACKEND
333N/A#define PANGO_ENABLE_BACKEND
333N/A#ifndef PANGO_ENABLE_ENGINE
333N/A#define PANGO_ENABLE_ENGINE
2899N/A#include "libnr/nr-matrix-rotate-ops.h"
3817N/A#include "libnr/nr-matrix-translate-ops.h"
3817N/A#include "libnr/nr-rotate-fns.h"
3817N/A#include "libnr/nr-scale-ops.h"
333N/A#include "libnr/nr-scale-translate-ops.h"
333N/A#include "libnr/nr-translate-matrix-ops.h"
333N/A#include "libnr/nr-translate-scale-ops.h"
333N/A#include "libnr/nr-convert2geom.h"
3899N/A#include "display/nr-arena.h"
333N/A#include "display/nr-arena-item.h"
3477N/A#include "display/nr-arena-group.h"
333N/A#include "display/canvas-bpath.h"
333N/A#include "sp-item-group.h"
333N/A#include "sp-linear-gradient.h"
3899N/A#include "sp-radial-gradient.h"
333N/A#include "sp-shape.h"
3817N/A#include "sp-flowtext.h"
#include "sp-image.h"
#include "sp-symbol.h"
#include "sp-pattern.h"
#include "sp-mask.h"
#include "sp-clippath.h"
#include <unit-constants.h>
#include "helper/png-write.h"
#include "helper/pixbuf-ops.h"
#include "cairo-renderer.h"
#include "cairo-render-context.h"
#include <cairo.h>
#ifdef CAIRO_HAS_PDF_SURFACE
#include <cairo-pdf.h>
#ifdef CAIRO_HAS_PS_SURFACE
#include <cairo-ps.h>
// FIXME: expose these from sp-clippath/mask.cpp
struct SPClipPathView {
unsigned int key;
struct SPMaskView {
unsigned int key;
namespace Inkscape {
namespace Extension {
namespace Internal {
return new_context;
delete ctx;
/* TODO FIXME: this does not render painting-marker-01-f.svg of SVG1.1 Test suite correctly. (orientation of one of the markers middle left ) */
++curve_it1;
++curve_it2;
if (index > 0) {
index--;
TRACE(("sp_group_renderer opacity: %f\n", SP_SCALE24_TO_FLOAT(SP_OBJECT_STYLE(item)->opacity.value)));
if (SP_IS_ITEM(o)) {
l = g_slist_remove (l, o);
bool translated = false;
translated = true;
if (translated) {
int w, h, rs;
ctx->addClippingRect(image->x.computed, image->y.computed, image->width.computed, image->height.computed);
ctx->addClippingRect(root->x.computed, root->y.computed, root->width.computed, root->height.computed);
double res;
if(res == 0) {
//gchar const *filter = prefs_get_string_attribute ("options.createbitmap", "filter");
gchar const *param1 = prefs_get_string_attribute ("options.createbitmap", "filter_param1");
// Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects
shift_y = -round (-shift_y); // this gets correct rounding despite coordinate inversion, remove the negations when the inversion is gone
t = (Geom::Matrix)(Geom::Scale(scale_x, -scale_y) * (Geom::Matrix)(Geom::Translate (shift_x, shift_y)* eek.inverse()));
if (pb) {
matrix = t;
//matrix.set_identity();
CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool pageBoundingBox, SPItem *base)
NRRect d;
return ret;
ctx->addClippingRect(mask_bbox.x0, mask_bbox.y0, mask_bbox.x1 - mask_bbox.x0, mask_bbox.y1 - mask_bbox.y0);
calculatePreserveAspectRatio(unsigned int aspect_align, unsigned int aspect_clip, double vp_width, double vp_height,
switch (aspect_align) {
case SP_ASPECT_XMIN_YMIN:
case SP_ASPECT_XMID_YMIN:
case SP_ASPECT_XMAX_YMIN:
case SP_ASPECT_XMIN_YMID:
case SP_ASPECT_XMID_YMID:
case SP_ASPECT_XMAX_YMID:
case SP_ASPECT_XMIN_YMAX:
case SP_ASPECT_XMID_YMAX:
case SP_ASPECT_XMAX_YMAX:
#include "clear-n_.h"