sp-pattern.cpp revision e4d0d1c466c86f5b22ab20cd2acd612978d3e86e
970N/A#ifdef HAVE_CONFIG_H
970N/A#include "display/cairo-utils.h"
970N/A#include "display/drawing-context.h"
970N/A#include "display/drawing-surface.h"
970N/A#include "display/drawing-group.h"
970N/A#include "attributes.h"
970N/A#include "document-private.h"
970N/A#include "sp-pattern.h"
970N/A#include "display/grayscale.h"
970N/A#include "sp-factory.h"
1356N/A this->patternUnits_set = false;
1356N/A this->patternContentUnits_set = false;
1356N/A this->patternTransform_set = false;
if (this->document) {
if (this->ref) {
delete this->ref;
switch (key) {
case SP_ATTR_PATTERNUNITS:
if (value) {
this->patternUnits_set = true;
this->patternUnits_set = false;
if (value) {
this->patternContentUnits_set = true;
this->patternContentUnits_set = false;
case SP_ATTR_PATTERNTRANSFORM: {
this->patternTransform = t;
this->patternTransform_set = true;
this->patternTransform_set = false;
case SP_ATTR_X:
case SP_ATTR_Y:
case SP_ATTR_WIDTH:
case SP_ATTR_HEIGHT:
case SP_ATTR_VIEWBOX:
case SP_ATTR_XLINK_HREF:
if (value) {
if (value) {
pattern_getchildren (this, l);
pattern_getchildren (this, l);
if (old_ref) {
pat->modified_connection = ref->connectModified(sigc::bind<2>(sigc::ptr_fun(&pattern_ref_modified), pat));
static guint
guint i = 0;
if (style
if (style
return pattern;
// this formula is for a different interpretation of pattern transforms as described in (*) in sp-pattern.cpp
//pattern->patternTransform = premul * item->transform * pattern->patternTransform * item->transform.inverse() * postmul;
if (set) {
return pat_id;
return pat_i;
return pat; // document is broken, we can't get to root; but at least we can return pat which is supposedly a valid pattern
// Access functions that look up fields up the chain of referenced patterns and return the first one which is set
// FIXME: all of them must use chase_hrefs the same as in SPGradient, to avoid lockup on circular refs
for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
return patternUnits;
for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
return patternContentUnits;
for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
return patternTransform;
for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
for (SPPattern const *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
return viewbox;
bool hasChildren = false;
hasChildren = true;
return hasChildren;
cairo_pattern_t* SPPattern::pattern_new(cairo_t *base_ct, Geom::OptRect const &bbox, double opacity) {
if (!visible) {
return NULL;
if (!shown) {
return cairo_pattern_create_rgba(0,0,0,0);
if (effective_view_box) {
if (needs_opacity) {
// cairo_surface_write_to_png( pattern_surface.raw(), filename.c_str() );
if (needs_opacity) {
return cp;