/*
* feFlood filter primitive renderer
*
* Authors:
* Felipe CorrĂȘa da Silva Sanches <juca@members.fsf.org>
* Tavmjong Bah <tavmjong@free.fr> (use primitive filter region)
*
* Copyright (C) 2007, 2011 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "display/cairo-utils.h"
#include "display/nr-filter-flood.h"
#include "display/nr-filter-slot.h"
#include "svg/svg-icc-color.h"
#include "svg/svg-color.h"
#include "color.h"
namespace Inkscape {
namespace Filters {
{}
return new FilterFlood();
}
{}
{
double r = SP_RGBA32_R_F(color);
double g = SP_RGBA32_G_F(color);
double b = SP_RGBA32_B_F(color);
double a = opacity;
#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
if( _style ) {
// Flood 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 ) {
r = srgb_to_linear( r );
g = srgb_to_linear( g );
b = srgb_to_linear( b );
}
}
// Get filter primitive area in user units
// Convert to Cairo units
// Get area in slot (tile to fill)
// Get overlap
if( optoverlap ) {
cairo_set_source_rgba(ct, r, g, b, a);
cairo_fill(ct);
}
}
{
// flood is a per-pixel primitive and is immutable under transformations
return true;
}
color = c;
}
opacity = o;
}
}
{
// flood is actually less expensive than normal rendering,
// but when flood is processed, the object has already been rendered
return 1.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 :