componenttransfer-funcnode.cpp revision 87223513f0edf4dcd1727917ded980e3ac4fd4ae
/** \file
* SVG <funcR>, <funcG>, <funcB> and <funcA> implementations.
*/
/*
* Authors:
* Hugo Rodrigues <haa.rodrigues@gmail.com>
* Niko Kiirala <niko@kiirala.com>
* Felipe CorrĂȘa da Silva Sanches <juca@members.fsf.org>
* Abhishek Sharma
*
* Copyright (C) 2006, 2007, 2008 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <glib.h>
#include "attributes.h"
#include "document.h"
#include "componenttransfer.h"
#include "componenttransfer-funcnode.h"
#include "display/nr-filter-component-transfer.h"
#include "helper-fns.h"
#define SP_MACROS_SILENT
#include "macros.h"
#include "sp-factory.h"
namespace {
SPObject* createFuncR() {
return new SPFeFuncNode(SPFeFuncNode::R);
}
SPObject* createFuncG() {
return new SPFeFuncNode(SPFeFuncNode::G);
}
SPObject* createFuncB() {
return new SPFeFuncNode(SPFeFuncNode::B);
}
SPObject* createFuncA() {
return new SPFeFuncNode(SPFeFuncNode::A);
}
}
/* FeFuncNode class */
}
SPFeFuncNode::~SPFeFuncNode() {
}
/**
* Reads the Inkscape::XML::Node, and initializes SPDistantLight 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.
*/
//Read values of key attributes from XML nodes into object.
this->readAttr( "type" );
this->readAttr( "tableValues" );
this->readAttr( "slope" );
this->readAttr( "intercept" );
this->readAttr( "amplitude" );
this->readAttr( "exponent" );
this->readAttr( "offset" );
//is this necessary?
}
/**
* Drops any allocated memory.
*/
void SPFeFuncNode::release() {
if ( this->document ) {
// Unregister ourselves
}
//TODO: release resources here
}
static Inkscape::Filters::FilterComponentTransferType sp_feComponenttransfer_read_type(gchar const *value){
if (!value) {
}
switch(value[0]){
case 'i':
}
break;
case 't':
}
break;
case 'd':
}
break;
case 'l':
}
break;
case 'g':
}
break;
}
}
/**
* Sets a specific value in the SPFeFuncNode.
*/
double read_num;
switch(key) {
case SP_ATTR_TYPE:
}
break;
case SP_ATTR_TABLEVALUES:
if (value){
}
break;
case SP_ATTR_SLOPE:
}
break;
case SP_ATTR_INTERCEPT:
}
break;
case SP_ATTR_AMPLITUDE:
}
break;
case SP_ATTR_EXPONENT:
}
break;
case SP_ATTR_OFFSET:
}
break;
default:
break;
}
}
/**
* * Receives update notifications.
* */
if (flags & SP_OBJECT_MODIFIED_FLAG) {
/* do something to trigger redisplay, updates? */
//TODO
//this->readAttr( "azimuth" );
//this->readAttr( "elevation" );
}
}
/**
* Writes its settings to an incoming repr object, if any.
*/
Inkscape::XML::Node* SPFeFuncNode::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
if (!repr) {
}
/*
TODO: I'm not sure what to do here...
if (fefuncnode->azimuth_set)
sp_repr_set_css_double(repr, "azimuth", fefuncnode->azimuth);
if (fefuncnode->elevation_set)
sp_repr_set_css_double(repr, "elevation", fefuncnode->elevation);*/
return repr;
}
/*
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 :