composite.cpp revision e874cb491fbb2e54741b9ee2434fcefa629796e5
/** \file
* SVG <feComposite> implementation.
*
*/
/*
* Authors:
* hugo Rodrigues <haa.rodrigues@gmail.com>
* Abhishek Sharma
*
* Copyright (C) 2006 Hugo Rodrigues
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "attributes.h"
#include "filters/composite.h"
#include "helper-fns.h"
#include "display/nr-filter.h"
#include "display/nr-filter-composite.h"
#include "sp-filter.h"
#include "sp-factory.h"
namespace {
SPObject* createComposite() {
return new SPFeComposite();
}
bool compositeRegistered = SPFactory::instance().registerObject("svg:feComposite", createComposite);
}
{
}
SPFeComposite::~SPFeComposite() {
}
/**
* Reads the Inkscape::XML::Node, and initializes SPFeComposite 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.
*/
this->readAttr( "operator" );
if (this->composite_operator == COMPOSITE_ARITHMETIC) {
this->readAttr( "k1" );
this->readAttr( "k2" );
this->readAttr( "k3" );
this->readAttr( "k4" );
}
this->readAttr( "in2" );
/* Unlike normal in, in2 is required attribute. Make sure, we can call
* it by some name. */
{
this->in2 = sp_filter_primitive_name_previous_out(this);
}
}
/**
* Drops any allocated memory.
*/
void SPFeComposite::release() {
}
static FeCompositeOperator
if (!value) {
return COMPOSITE_DEFAULT;
}
return COMPOSITE_OVER;
return COMPOSITE_IN;
return COMPOSITE_OUT;
return COMPOSITE_ATOP;
return COMPOSITE_XOR;
return COMPOSITE_ARITHMETIC;
}
#ifdef WITH_CSSCOMPOSITE
return COMPOSITE_CLEAR;
return COMPOSITE_COPY;
return COMPOSITE_DESTINATION;
return COMPOSITE_DESTINATION_OVER;
return COMPOSITE_DESTINATION_IN;
return COMPOSITE_DESTINATION_OUT;
return COMPOSITE_DESTINATION_ATOP;
return COMPOSITE_LIGHTER;
}
#endif
std::cout << "Inkscape::Filters::FilterCompositeOperator: Unimplemented operator: " << value << std::endl;
return COMPOSITE_DEFAULT;
}
/**
* Sets a specific value in the SPFeComposite.
*/
int input;
double k_n;
switch(key) {
/*DEAL WITH SETTING ATTRIBUTES HERE*/
case SP_ATTR_OPERATOR:
if (op != this->composite_operator) {
this->composite_operator = op;
}
break;
case SP_ATTR_K1:
if (this->composite_operator == COMPOSITE_ARITHMETIC)
}
break;
case SP_ATTR_K2:
if (this->composite_operator == COMPOSITE_ARITHMETIC)
}
break;
case SP_ATTR_K3:
if (this->composite_operator == COMPOSITE_ARITHMETIC)
}
break;
case SP_ATTR_K4:
if (this->composite_operator == COMPOSITE_ARITHMETIC)
}
break;
case SP_ATTR_IN2:
}
break;
default:
break;
}
}
/**
* Receives update notifications.
*/
/* do something to trigger redisplay, updates? */
}
/* Unlike normal in, in2 is required attribute. Make sure, we can call
* it by some name. */
{
this->in2 = sp_filter_primitive_name_previous_out(this);
//XML Tree being used directly here while it shouldn't be.
}
}
/**
* Writes its settings to an incoming repr object, if any.
*/
Inkscape::XML::Node* SPFeComposite::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
if (!repr) {
}
if (out_name) {
} else {
while (i && i->next != this) {
i = i->next;
}
if (!out_name) {
g_warning("Unable to set in2 for feComposite");
}
}
char const *comp_op;
switch (this->composite_operator) {
case COMPOSITE_OVER:
comp_op = "over"; break;
case COMPOSITE_IN:
comp_op = "in"; break;
case COMPOSITE_OUT:
comp_op = "out"; break;
case COMPOSITE_ATOP:
comp_op = "atop"; break;
case COMPOSITE_XOR:
comp_op = "xor"; break;
case COMPOSITE_ARITHMETIC:
comp_op = "arithmetic"; break;
#ifdef WITH_CSSCOMPOSITE
// New CSS operators
case COMPOSITE_CLEAR:
comp_op = "clear"; break;
case COMPOSITE_COPY:
comp_op = "copy"; break;
case COMPOSITE_DESTINATION:
comp_op = "destination"; break;
comp_op = "destination-over"; break;
case COMPOSITE_DESTINATION_IN:
comp_op = "destination-in"; break;
comp_op = "destination-out"; break;
comp_op = "destination-atop"; break;
case COMPOSITE_LIGHTER:
comp_op = "lighter"; break;
#endif
default:
comp_op = 0;
}
if (this->composite_operator == COMPOSITE_ARITHMETIC) {
} else {
}
return repr;
}
Inkscape::Filters::FilterComposite *nr_composite = dynamic_cast<Inkscape::Filters::FilterComposite*>(nr_primitive);
if (this->composite_operator == COMPOSITE_ARITHMETIC) {
}
}
/*
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 :