/*
* 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 UnmultiplyAlpha {
EXTRACT_ARGB32(in, a, r, g, b);
if (a == 0 )
return in;
r = unpremul_alpha(r, a);
g = unpremul_alpha(g, a);
b = unpremul_alpha(b, a);
ASSEMBLE_ARGB32(out, a, r, g, b);
return out;
}
};
struct MultiplyAlpha {
EXTRACT_ARGB32(in, a, r, g, b);
if (a == 0 )
return in;
r = premul_alpha(r, a);
g = premul_alpha(g, a);
b = premul_alpha(b, a);
ASSEMBLE_ARGB32(out, a, r, g, b);
return out;
}
};
struct ComponentTransfer {
{}
protected:
};
{
}
}
}
private:
};
{
}
}
}
private:
};
{}
// TODO: this can probably be reduced to something simpler
}
private:
};
{}
component /= 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.
if( _style ) {
}
//cairo_surface_t *outtemp = ink_cairo_surface_create_identical(out);
// We need to operate on unmultipled by alpha color values otherwise a change in alpha screws
// up the premultiplied by alpha r, g, b values.
// parameters: R = 0, G = 1, B = 2, A = 3
// Cairo: R = 2, G = 1, B = 0, A = 3
// If tableValues is empty, use identity.
for (unsigned i = 0; i < 4; ++i) {
switch (type[i]) {
if(!tableValues[i].empty()) {
}
break;
if(!tableValues[i].empty()) {
}
break;
break;
break;
default:
break;
}
//ink_cairo_surface_blit(out, outtemp);
}
//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 :