blend.cpp revision 67a1c38ffe3fe6089e7c5aa5756aa8a00621d661
/** \file
* SVG <feBlend> implementation.
*
*/
/*
* Authors:
* Hugo Rodrigues <haa.rodrigues@gmail.com>
* Niko Kiirala <niko@kiirala.com>
* Abhishek Sharma
*
* Copyright (C) 2006,2007 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <string.h>
#include "sp-filter.h"
#include "attributes.h"
#include "display/nr-filter.h"
#include "display/nr-filter-primitive.h"
#include "display/nr-filter-blend.h"
#include "display/nr-filter-types.h"
#include "sp-factory.h"
namespace {
SPObject* createBlend() {
return new SPFeBlend();
}
}
{
}
}
/**
* Reads the Inkscape::XML::Node, and initializes SPFeBlend 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( "mode" );
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.
*/
}
if (!value) {
}
switch (value[0]) {
case 'n':
break;
case 'm':
break;
case 's':
break;
case 'd':
break;
case 'l':
break;
case 'o':
break;
case 'c':
break;
case 'h':
break;
case 'e':
default:
// do nothing by default
break;
}
}
/**
* Sets a specific value in the SPFeBlend.
*/
int input;
switch(key) {
/*DEAL WITH SETTING ATTRIBUTES HERE*/
case SP_ATTR_MODE:
if (mode != this->blend_mode) {
this->blend_mode = mode;
}
break;
case SP_ATTR_IN2:
}
break;
default:
break;
}
}
/**
* Receives update notifications.
*/
if (flags & SP_OBJECT_MODIFIED_FLAG) {
this->readAttr( "mode" );
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);
// TODO: XML Tree being used directly here while it shouldn't be.
}
}
/**
* Writes its settings to an incoming repr object, if any.
*/
Inkscape::XML::Node* SPFeBlend::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 feBlend");
}
}
char const *mode;
switch(this->blend_mode) {
mode = "normal"; break;
mode = "multiply"; break;
mode = "screen"; break;
mode = "darken"; break;
mode = "lighten"; break;
// New
mode = "overlay"; break;
mode = "color-dodge"; break;
mode = "color-burn"; break;
mode = "hard-light"; break;
mode = "soft-light"; break;
mode = "difference"; break;
mode = "exclusion"; break;
mode = "hue"; break;
mode = "saturation"; break;
mode = "color"; break;
mode = "luminosity"; break;
default:
mode = 0;
}
return repr;
}
Inkscape::Filters::FilterBlend *nr_blend = dynamic_cast<Inkscape::Filters::FilterBlend*>(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 :