turbulence.cpp revision 76750e3eb87017e5b9aefb0c0148a67bbb3d7232
#define __SP_FETURBULENCE_CPP__
/** \file
* SVG <feTurbulence> implementation.
*
*/
/*
* Authors:
* Felipe CorrĂȘa da Silva Sanches <felipe.sanches@gmail.com>
* hugo Rodrigues <haa.rodrigues@gmail.com>
*
* Copyright (C) 2007 Felipe Sanches
* 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 "turbulence.h"
#include "helper-fns.h"
#include <string.h>
#include "display/nr-filter.h"
#include "display/nr-filter-turbulence.h"
/* FeTurbulence base class */
static void sp_feTurbulence_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static Inkscape::XML::Node *sp_feTurbulence_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_feTurbulence_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter);
{
static GType feTurbulence_type = 0;
if (!feTurbulence_type) {
sizeof(SPFeTurbulenceClass),
sizeof(SPFeTurbulence),
16,
NULL, /* value_table */
};
feTurbulence_type = g_type_register_static(SP_TYPE_FILTER_PRIMITIVE, "SPFeTurbulence", &feTurbulence_info, (GTypeFlags)0);
}
return feTurbulence_type;
}
static void
{
}
static void
{
feTurbulence->updated=false;
}
/**
* 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.
*/
static void
{
}
/*LOAD ATTRIBUTES FROM REPR HERE*/
}
/**
* Drops any allocated memory.
*/
static void
{
}
if (!value) return false; // 'noStitch' is default
switch(value[0]){
case 's':
break;
case 'n':
break;
}
return false; // 'noStitch' is default
}
switch(value[0]){
case 'f':
break;
case 't':
break;
}
}
/**
* Sets a specific value in the SPFeTurbulence.
*/
static void
{
(void)feTurbulence;
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.
feTurbulence->updated = false;
break;
case SP_ATTR_NUMOCTAVES:
feTurbulence->updated = false;
}
break;
case SP_ATTR_SEED:
feTurbulence->updated = false;
}
break;
case SP_ATTR_STITCHTILES:
feTurbulence->updated = false;
}
break;
case SP_ATTR_TYPE:
feTurbulence->updated = false;
}
break;
default:
break;
}
}
/**
* Receives update notifications.
*/
static void
{
/* do something to trigger redisplay, updates? */
}
}
}
/**
* Writes its settings to an incoming repr object, if any.
*/
sp_feTurbulence_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
{
// Inkscape-only object, not copied during an "plain SVG" dump:
if (flags & SP_OBJECT_WRITE_EXT) {
if (repr) {
// is this sane?
//repr->mergeFrom(SP_OBJECT_REPR(object), "id");
} else {
}
}
}
return repr;
}
static void sp_feTurbulence_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) {
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:encoding=utf-8:textwidth=99 :