/** \file
* SVG <fespotlight> implementation.
*/
/*
* Authors:
* Hugo Rodrigues <haa.rodrigues@gmail.com>
* Niko Kiirala <niko@kiirala.com>
* Jean-Rene Reinhard <jr@komite.net>
* Abhishek Sharma
*
* Copyright (C) 2006,2007 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <glib.h>
#include "attributes.h"
#include "document.h"
#include "filters/spotlight.h"
#include "filters/diffuselighting.h"
#include "filters/specularlighting.h"
#define SP_MACROS_SILENT
#include "macros.h"
: SPObject(), x(0), x_set(FALSE), y(0), y_set(FALSE), z(0), z_set(FALSE), pointsAtX(0), pointsAtX_set(FALSE),
{
}
SPFeSpotLight::~SPFeSpotLight() {
}
/**
* Reads the Inkscape::XML::Node, and initializes SPPointLight 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.
*/
//Read values of key attributes from XML nodes into object.
this->readAttr( "x" );
this->readAttr( "y" );
this->readAttr( "z" );
this->readAttr( "pointsAtX" );
this->readAttr( "pointsAtY" );
this->readAttr( "pointsAtZ" );
this->readAttr( "specularExponent" );
this->readAttr( "limitingConeAngle" );
//is this necessary?
}
/**
* Drops any allocated memory.
*/
if ( this->document ) {
// Unregister ourselves
}
//TODO: release resources here
}
/**
* Sets a specific value in the SPFeSpotLight.
*/
switch (key) {
case SP_ATTR_X:
if (value) {
if (end_ptr) {
}
}
this->x = 0;
}
if (this->parent &&
(SP_IS_FEDIFFUSELIGHTING(this->parent) ||
SP_IS_FESPECULARLIGHTING(this->parent))) {
}
break;
case SP_ATTR_Y:
if (value) {
if (end_ptr) {
}
}
this->y = 0;
}
if (this->parent &&
(SP_IS_FEDIFFUSELIGHTING(this->parent) ||
SP_IS_FESPECULARLIGHTING(this->parent))) {
}
break;
case SP_ATTR_Z:
if (value) {
if (end_ptr) {
}
}
this->z = 0;
}
if (this->parent &&
(SP_IS_FEDIFFUSELIGHTING(this->parent) ||
SP_IS_FESPECULARLIGHTING(this->parent))) {
}
break;
case SP_ATTR_POINTSATX:
if (value) {
if (end_ptr) {
this->pointsAtX_set = TRUE;
}
}
this->pointsAtX = 0;
this->pointsAtX_set = FALSE;
}
if (this->parent &&
(SP_IS_FEDIFFUSELIGHTING(this->parent) ||
SP_IS_FESPECULARLIGHTING(this->parent))) {
}
break;
case SP_ATTR_POINTSATY:
if (value) {
if (end_ptr) {
this->pointsAtY_set = TRUE;
}
}
this->pointsAtY = 0;
this->pointsAtY_set = FALSE;
}
if (this->parent &&
(SP_IS_FEDIFFUSELIGHTING(this->parent) ||
SP_IS_FESPECULARLIGHTING(this->parent))) {
}
break;
case SP_ATTR_POINTSATZ:
if (value) {
if (end_ptr) {
this->pointsAtZ_set = TRUE;
}
}
this->pointsAtZ = 0;
this->pointsAtZ_set = FALSE;
}
if (this->parent &&
(SP_IS_FEDIFFUSELIGHTING(this->parent) ||
SP_IS_FESPECULARLIGHTING(this->parent))) {
}
break;
case SP_ATTR_SPECULAREXPONENT:
if (value) {
if (end_ptr) {
this->specularExponent_set = TRUE;
}
}
this->specularExponent = 1;
this->specularExponent_set = FALSE;
}
if (this->parent &&
(SP_IS_FEDIFFUSELIGHTING(this->parent) ||
SP_IS_FESPECULARLIGHTING(this->parent))) {
}
break;
if (value) {
if (end_ptr) {
this->limitingConeAngle_set = TRUE;
}
}
this->limitingConeAngle = 90;
this->limitingConeAngle_set = FALSE;
}
if (this->parent &&
(SP_IS_FEDIFFUSELIGHTING(this->parent) ||
SP_IS_FESPECULARLIGHTING(this->parent))) {
}
break;
default:
// See if any parents need this value.
break;
}
}
/**
* * Receives update notifications.
* */
if (flags & SP_OBJECT_MODIFIED_FLAG) {
/* do something to trigger redisplay, updates? */
this->readAttr( "x" );
this->readAttr( "y" );
this->readAttr( "z" );
this->readAttr( "pointsAtX" );
this->readAttr( "pointsAtY" );
this->readAttr( "pointsAtZ" );
this->readAttr( "specularExponent" );
this->readAttr( "limitingConeAngle" );
}
}
/**
* Writes its settings to an incoming repr object, if any.
*/
Inkscape::XML::Node* SPFeSpotLight::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
if (!repr) {
}
if (this->x_set)
if (this->y_set)
if (this->z_set)
if (this->pointsAtX_set)
if (this->pointsAtY_set)
if (this->pointsAtZ_set)
if (this->specularExponent_set)
if (this->limitingConeAngle_set)
return repr;
}
/*
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 :