nr-filter-diffuselighting.cpp revision cf99b5253f47e8fa5ba3c655712fc15031d1d91a
/*
* feDiffuseLighting renderer
*
* Authors:
* Niko Kiirala <niko@kiirala.com>
* Jean-Rene Reinhard <jr@komite.net>
* Krzysztof KosiĆski <tweenk.pl@gmail.com>
*
* Copyright (C) 2007-2010 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <glib.h>
#include "display/cairo-templates.h"
#include "display/cairo-utils.h"
#include "display/nr-3dutils.h"
#include "display/nr-filter-diffuselighting.h"
#include "display/nr-filter-slot.h"
#include "display/nr-filter-units.h"
#include "display/nr-filter-utils.h"
#include "display/nr-light.h"
#include "svg/svg-icc-color.h"
#include "svg/svg-color.h"
namespace Inkscape {
namespace Filters {
{
diffuseConstant = 1;
surfaceScale = 1;
lighting_color = 0xffffffff;
}
return new FilterDiffuseLighting();
}
{}
struct DiffuseLight : public SurfaceSynth {
{}
protected:
guint32 diffuseLighting(int x, int y, NR::Fvector const &light, NR::Fvector const &light_components) {
return pxout;
}
};
struct DiffuseDistantLight : public DiffuseLight {
double scale, double diffuse_constant)
{
}
guint32 operator()(int x, int y) {
}
private:
};
struct DiffusePointLight : public DiffuseLight {
{
}
guint32 operator()(int x, int y) {
}
private:
};
struct DiffuseSpotLight : public DiffuseLight {
{}
guint32 operator()(int x, int y) {
}
private:
};
{
double r = SP_RGBA32_R_F(lighting_color);
double g = SP_RGBA32_G_F(lighting_color);
double b = SP_RGBA32_B_F(lighting_color);
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
if (icc) {
r = SP_COLOR_U_TO_F(ru);
g = SP_COLOR_U_TO_F(gu);
b = SP_COLOR_U_TO_F(bu);
}
#endif
// Only alpha channel of input is used, no need to check input color_interpolation_filter value.
if( _style ) {
// Lighting color is always defined in terms of sRGB, preconvert to linearRGB
// if color_interpolation_filters set to linearRGB (for efficiency assuming
// next filter primitive has same value of cif).
if( ci_fp == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) {
srgb_to_linear( &r );
srgb_to_linear( &g );
srgb_to_linear( &b );
}
}
switch (light_type) {
case DISTANT_LIGHT:
break;
case POINT_LIGHT:
break;
case SPOT_LIGHT:
break;
default: {
} break;
}
}
}
{
// TODO: support kernelUnitLength
// We expand the area by 1 in every direction to avoid artifacts on tile edges.
// However, it means that edge pixels will be incorrect.
}
{
return 9.0;
}
} /* namespace Filters */
} /* namespace Inkscape */
/*
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 :