nr-filter-component-transfer.cpp revision 9f6f7e74a1ded383518676e0ecb2ccc5caa73d25
/*
* feComponentTransfer filter primitive renderer
*
* Authors:
* Felipe CorrĂȘa da Silva Sanches <juca@members.fsf.org>
* Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
*
* Copyright (C) 2007 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <math.h>
#include "display/cairo-templates.h"
#include "display/cairo-utils.h"
#include "display/nr-filter-component-transfer.h"
#include "display/nr-filter-slot.h"
namespace Inkscape {
namespace Filters {
{
}
return new FilterComponentTransfer();
}
{}
struct ComponentTransfer {
{}
protected:
};
template <bool alpha>
struct ComponentTransferTable;
template <>
{
}
}
}
private:
};
template <>
struct ComponentTransferTable<true> {
{
}
}
}
private:
};
template <bool alpha>
struct ComponentTransferDiscrete;
template <>
{
}
}
}
private:
};
template <>
struct ComponentTransferDiscrete<true> {
{
}
}
}
private:
};
template <bool alpha>
struct ComponentTransferLinear;
template <>
{}
if (alpha == 0) return 0;
// TODO: this can probably be reduced to something simpler
}
private:
};
template <>
struct ComponentTransferLinear<true> {
{}
}
private:
};
template <bool alpha>
struct ComponentTransferGamma;
template <>
{}
if (alpha == 0) return 0;
}
private:
double _amplitude;
double _exponent;
double _offset;
};
template <>
struct ComponentTransferGamma<true> {
{}
alpha /= 255.0;
}
private:
double _amplitude;
double _exponent;
double _offset;
};
{
// We may need to transform input surface to correct color interpolation space. The input surface
// might be used as input to another primitive but it is likely that all the primitives in a given
// filter use the same color interpolation space so we don't copy the input before converting.
// The converting function tags surface with the proper ci value.
if( _style ) {
}
if( ci_in == SP_CSS_COLOR_INTERPOLATION_SRGB &&
//std::cout << "FilterComponentTransfer: srgb -> linear" << std::endl;
}
if( ci_in == SP_CSS_COLOR_INTERPOLATION_LINEARRGB &&
//std::cout << "FilterComponentTransfer: linear -> srgb" << std::endl;
}
// std::cout << "FilterComponentTransfer: ci data: "
// << " in1: " << get_cairo_surface_ci(input)
// << " out: " << get_cairo_surface_ci(out)
// << std::endl;
//cairo_surface_t *outtemp = ink_cairo_surface_create_identical(out);
// parameters: R = 0, G = 1, B = 2, A = 3
// Cairo: R = 2, G = 1, B = 0, A = 3
for (unsigned i = 0; i < 3; ++i) {
switch (type[i]) {
break;
break;
break;
break;
default:
break;
}
//ink_cairo_surface_blit(out, outtemp);
}
// fast paths for alpha channel
switch (type[3]) {
break;
break;
break;
break;
default:
break;
}
//cairo_surface_destroy(outtemp);
}
{
return true;
}
{
return 2.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 :