displacementmap.cpp revision a4030d5ca449e7e384bc699cd249ee704faaeab0
#define __SP_FEDISPLACEMENTMAP_CPP__
/** \file
* SVG <feDisplacementMap> implementation.
*
*/
/*
* Authors:
* hugo Rodrigues <haa.rodrigues@gmail.com>
*
* 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 "displacementmap.h"
#include "display/nr-filter-displacement-map.h"
#include "helper-fns.h"
/* FeDisplacementMap base class */
static void sp_feDisplacementMap_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_feDisplacementMap_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter);
static Inkscape::XML::Node *sp_feDisplacementMap_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
{
static GType feDisplacementMap_type = 0;
if (!feDisplacementMap_type) {
sizeof(SPFeDisplacementMapClass),
sizeof(SPFeDisplacementMap),
16,
NULL, /* value_table */
};
feDisplacementMap_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeDisplacementMap", &feDisplacementMap_info, (GTypeFlags)0);
}
return feDisplacementMap_type;
}
static void
{
}
static void
{
}
/**
* Reads the Inkscape::XML::Node, and initializes SPFeDisplacementMap 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.
*/
static void
{
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
/* Unlike normal in, in2 is required attribute. Make sure, we can call
* it by some name. */
{
}
}
/**
* Drops any allocated memory.
*/
static void
{
}
static FilterDisplacementMapChannelSelector sp_feDisplacementMap_readChannelSelector(gchar const *value)
{
if (!value) return DISPLACEMENTMAP_CHANNEL_ALPHA;
switch (value[0]) {
case 'R':
return DISPLACEMENTMAP_CHANNEL_RED;
break;
case 'G':
return DISPLACEMENTMAP_CHANNEL_GREEN;
break;
case 'B':
return DISPLACEMENTMAP_CHANNEL_BLUE;
break;
case 'A':
return DISPLACEMENTMAP_CHANNEL_ALPHA;
break;
default:
// error
g_warning("Invalid attribute for Channel Selector. Valid modes are 'R', 'G', 'B' or 'A'");
break;
}
return DISPLACEMENTMAP_CHANNEL_ALPHA; //default is Alpha Channel
}
/**
* Sets a specific value in the SPFeDisplacementMap.
*/
static void
{
(void)feDisplacementMap;
int input;
double read_num;
switch(key) {
/*DEAL WITH SETTING ATTRIBUTES HERE*/
case SP_ATTR_XCHANNELSELECTOR:
}
break;
case SP_ATTR_YCHANNELSELECTOR:
}
break;
case SP_ATTR_SCALE:
}
break;
case SP_ATTR_IN2:
}
break;
default:
break;
}
}
/**
* Receives update notifications.
*/
static void
{
/* do something to trigger redisplay, updates? */
}
/* Unlike normal in, in2 is required attribute. Make sure, we can call
* it by some name. */
{
}
}
}
switch(selector) {
return "R";
return "G";
return "B";
return "A";
default:
return 0;
}
}
/**
* Writes its settings to an incoming repr object, if any.
*/
sp_feDisplacementMap_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
{
if (!repr) {
}
if (out_name) {
} else {
if (!out_name) {
g_warning("Unable to set in2 for feDisplacementMap");
}
}
}
return repr;
}
static void sp_feDisplacementMap_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) {
Inkscape::Filters::FilterDisplacementMap *nr_displacement_map = dynamic_cast<Inkscape::Filters::FilterDisplacementMap*>(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 :