nr-filter.cpp revision a2caee48c5638948a54ef6048c7fc0026d1e92df
#define __NR_FILTER_CPP__
/*
* SVG filters rendering
*
* Author:
* Niko Kiirala <niko@kiirala.com>
*
* Copyright (C) 2006 Niko Kiirala
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <glib.h>
#include "display/nr-filter.h"
#include "display/nr-filter-primitive.h"
#include "display/nr-filter-gaussian.h"
#include "display/nr-filter-slot.h"
#include "display/nr-filter-types.h"
#include "display/nr-arena-item.h"
#include "libnr/nr-pixblock.h"
#include "svg/svg-length.h"
#include "sp-filter-units.h"
//#include "display/nr-arena-shape.h"
namespace NR {
{
_primitive_count = 1;
_primitive[0] = new FilterGaussian;
_common_init();
}
{
_primitive_count = 0;
_primitive = new FilterPrimitive*[n];
for ( int i = 0 ; i < n ; i++ ) {
_primitive[i] = NULL;
}
_common_init();
}
void Filter::_common_init() {
_slot_count = 1;
_x_pixels = -1.0;
_y_pixels = -1.0;
}
{
delete[] _primitive;
}
{
* NR_PIXBLOCK_BPP(pb);
return 0;
}
{
int enlarge = 0;
for ( int i = 0 ; i < _primitive_count ; i++ ) {
}
return enlarge;
}
{
/* TODO: fetch somehow the object ex and em lengths */
} else {
}
} else {
}
} else {
}
} else {
}
} else if (_filter_units == SP_FILTER_UNITS_USERSPACEONUSE) {
/* TODO: make sure bbox and fe region are in same coordinate system */
} else {
g_warning("Error in NR::Filter::bbox_enlarge: unrecognized value of _filter_units");
}
}
typedef FilterPrimitive*(*FilterConstructor)();
void Filter::_create_constructor_table()
{
static bool created = false;
if(created) return;
/* Filter effects not yet implemented are set to NULL */
}
void Filter::_enlarge_primitive_table() {
for (int i = 0 ; i < _primitive_count ; i++) {
new_tbl[i] = _primitive[i];
}
_primitive_table_size *= 2;
for (int i = _primitive_count ; i < _primitive_table_size ; i++) {
}
delete[] _primitive;
}
{
// Check that we can create a new filter of specified type
return NULL;
// If there is no space for new filter primitive, enlarge the table
if (_primitive_count >= _primitive_table_size) {
}
return created;
}
{
// Check that target is valid primitive inside this filter
int place = -1;
for (int i = 0 ; i < _primitive_count ; i++) {
if (target == _primitive[i]) {
place = i;
break;
}
}
// Check that we can create a new filter of specified type
return NULL;
// If there is no space for new filter primitive, enlarge the table
if (_primitive_count >= _primitive_table_size) {
}
delete target;
return created;
}
void Filter::clear_primitives()
{
for (int i = 0 ; i < _primitive_count ; i++) {
if (_primitive[i]) delete _primitive[i];
}
_primitive_count = 0;
}
} /* namespace NR */
/*
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:encoding=utf-8:textwidth=99 :