/** \file
* SVG <feTurbulence> implementation.
*
*/
/*
* Authors:
* Felipe CorrĂȘa da Silva Sanches <juca@members.fsf.org>
* hugo Rodrigues <haa.rodrigues@gmail.com>
* Abhishek Sharma
*
* Copyright (C) 2007 Felipe Sanches
* Copyright (C) 2006 Hugo Rodrigues
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "attributes.h"
#include "turbulence.h"
#include "helper-fns.h"
#include <string.h>
#include "display/nr-filter.h"
#include "display/nr-filter-turbulence.h"
this->stitchTiles = 0;
this->seed = 0;
this->numOctaves = 0;
this->updated=false;
}
SPFeTurbulence::~SPFeTurbulence() {
}
/**
* Reads the Inkscape::XML::Node, and initializes SPFeTurbulence variables. For this to get called,
* our name must be associated with a repr via "sp_object_type_register". Best done through
* sp-object-repr.cpp's repr_name_entries array.
*/
/*LOAD ATTRIBUTES FROM REPR HERE*/
this->readAttr( "baseFrequency" );
this->readAttr( "numOctaves" );
this->readAttr( "seed" );
this->readAttr( "stitchTiles" );
this->readAttr( "type" );
}
/**
* Drops any allocated memory.
*/
}
if (!value) {
return false; // 'noStitch' is default
}
switch(value[0]){
case 's':
return true;
}
break;
case 'n':
return false;
}
break;
}
return false; // 'noStitch' is default
}
if (!value) {
}
switch(value[0]){
case 'f':
}
break;
case 't':
}
break;
}
}
/**
* Sets a specific value in the SPFeTurbulence.
*/
int read_int;
double read_num;
bool read_bool;
switch(key) {
/*DEAL WITH SETTING ATTRIBUTES HERE*/
case SP_ATTR_BASEFREQUENCY:
// From SVG spec: If two <number>s are provided, the first number represents
// a base frequency in the X direction and the second value represents a base
// frequency in the Y direction. If one number is provided, then that value is
// used for both X and Y.
if (this->baseFrequency.optNumIsSet() == false) {
}
this->updated = false;
break;
case SP_ATTR_NUMOCTAVES:
if (read_int != this->numOctaves){
this->numOctaves = read_int;
this->updated = false;
}
break;
case SP_ATTR_SEED:
this->updated = false;
}
break;
case SP_ATTR_STITCHTILES:
if (read_bool != this->stitchTiles){
this->stitchTiles = read_bool;
this->updated = false;
}
break;
case SP_ATTR_TYPE:
this->updated = false;
}
break;
default:
break;
}
}
/**
* Receives update notifications.
*/
/* do something to trigger redisplay, updates? */
}
}
/**
* Writes its settings to an incoming repr object, if any.
*/
Inkscape::XML::Node* SPFeTurbulence::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
/* TODO: Don't just clone, but create a new repr node and write all
* relevant values into it */
if (!repr) {
}
/* turbulence doesn't take input */
return repr;
}
Inkscape::Filters::FilterTurbulence *nr_turbulence = dynamic_cast<Inkscape::Filters::FilterTurbulence*>(nr_primitive);
}
/*
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:fileencoding=utf-8:textwidth=99 :