diffuselighting.cpp revision cf99b5253f47e8fa5ba3c655712fc15031d1d91a
/** \file
* SVG <feDiffuseLighting> implementation.
*
*/
/*
* Authors:
* hugo Rodrigues <haa.rodrigues@gmail.com>
* Jean-Rene Reinhard <jr@komite.net>
* Abhishek Sharma
*
* Copyright (C) 2006 Hugo Rodrigues
* 2007 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "strneq.h"
#include "attributes.h"
#include "sp-object.h"
#include "svg/svg-color.h"
#include "svg/svg-icc-color.h"
#include "filters/diffuselighting.h"
#include "filters/distantlight.h"
#include "filters/pointlight.h"
#include "filters/spotlight.h"
#include "display/nr-filter.h"
#include "display/nr-filter-diffuselighting.h"
/* FeDiffuseLighting base class */
static void sp_feDiffuseLighting_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
//we assume that svg:feDiffuseLighting can have any number of children
//only the first one is considered as the light source of the filter
//TODO is that right?
//if not modify child_added and remove_child to raise errors
static void sp_feDiffuseLighting_order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref);
static Inkscape::XML::Node *sp_feDiffuseLighting_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_feDiffuseLighting_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter);
static void
{
}
static void
{
//TODO kernelUnit
}
/**
* Reads the Inkscape::XML::Node, and initializes SPFeDiffuseLighting 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
{
}
/**
* Sets a specific value in the SPFeDiffuseLighting.
*/
static void
{
switch(key) {
/*DEAL WITH SETTING ATTRIBUTES HERE*/
//TODO test forbidden values
case SP_ATTR_SURFACESCALE:
if (value) {
if (end_ptr) {
}
}
}
if (feDiffuseLighting->renderer) {
}
break;
case SP_ATTR_DIFFUSECONSTANT:
if (value) {
} else {
g_warning("feDiffuseLighting: diffuseConstant should be a positive number ... defaulting to 1");
}
}
}
if (feDiffuseLighting->renderer) {
}
break;
case SP_ATTR_KERNELUNITLENGTH:
//TODO kernelUnit
//feDiffuseLighting->kernelUnitLength.set(value);
/*TODOif (feDiffuseLighting->renderer) {
feDiffuseLighting->renderer->surfaceScale = feDiffuseLighting->renderer;
}
*/
break;
case SP_PROP_LIGHTING_COLOR:
//if a value was read
if (cend_ptr) {
while (g_ascii_isspace(*cend_ptr)) {
++cend_ptr;
}
delete feDiffuseLighting->icc;
}
}
} else {
//lighting_color already contains the default value
}
if (feDiffuseLighting->renderer) {
}
break;
default:
break;
}
}
/**
* Receives update notifications.
*/
static void
{
if (flags & (SP_OBJECT_MODIFIED_FLAG)) {
}
}
}
/**
* Writes its settings to an incoming repr object, if any.
*/
sp_feDiffuseLighting_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags)
{
/* TODO: Don't just clone, but create a new repr node and write all
* relevant values _and children_ into it */
if (!repr) {
//repr = doc->createElement("svg:feDiffuseLighting");
}
else
else
/*TODO kernelUnits */
if (fediffuselighting->lighting_color_set) {
gchar c[64];
} else
}
return repr;
}
/**
* Callback for child_added event.
*/
static void
sp_feDiffuseLighting_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
}
/**
* Callback for remove_child event.
*/
static void
{
}
static void
sp_feDiffuseLighting_order_changed (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref)
{
(* ((SPObjectClass *) (sp_feDiffuseLighting_parent_class))->order_changed) (object, child, old_ref, new_ref);
}
{
if (sp_diffuselighting->renderer) {
}
}
}
}
}
static void sp_feDiffuseLighting_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) {
Inkscape::Filters::FilterDiffuseLighting *nr_diffuselighting = dynamic_cast<Inkscape::Filters::FilterDiffuseLighting*>(nr_primitive);
//We assume there is at most one child
}
}
}
//nr_offset->set_dx(sp_offset->dx);
//nr_offset->set_dy(sp_offset->dy);
}
/*
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 :