index 33e89ac3eb3bede580cf4aa2cfc76f4ec2733dc9..34a33e2b88bbcd4acc53f4916c7a7858c768aee0 100644 (file)
#include "display/nr-filter-types.h"
#include "display/pixblock-scaler.h"
#include "display/pixblock-transform.h"
-#include "display/nr-filter-gaussian.h"
+
#include "display/nr-filter-blend.h"
+#include "display/nr-filter-composite.h"
+#include "display/nr-filter-convolve-matrix.h"
+#include "display/nr-filter-colormatrix.h"
+#include "display/nr-filter-component-transfer.h"
+#include "display/nr-filter-diffuselighting.h"
+#include "display/nr-filter-displacement-map.h"
+#include "display/nr-filter-flood.h"
+#include "display/nr-filter-gaussian.h"
+#include "display/nr-filter-image.h"
+#include "display/nr-filter-merge.h"
+#include "display/nr-filter-morphology.h"
#include "display/nr-filter-offset.h"
+#include "display/nr-filter-specularlighting.h"
+#include "display/nr-filter-tile.h"
+#include "display/nr-filter-turbulence.h"
#include "display/nr-arena-item.h"
#include "libnr/nr-pixblock.h"
static bool created = false;
if(created) return;
- /* Filter effects not yet implemented are set to NULL */
+/* Some filter classes are not implemented yet.
+ Some of them still have only boilerplate code.*/
_constructor[NR_FILTER_BLEND] = &FilterBlend::create;
- _constructor[NR_FILTER_COLORMATRIX] = NULL;
- _constructor[NR_FILTER_COMPONENTTRANSFER] = NULL;
- _constructor[NR_FILTER_COMPOSITE] = NULL;
- _constructor[NR_FILTER_CONVOLVEMATRIX] = NULL;
- _constructor[NR_FILTER_DIFFUSELIGHTING] = NULL;
- _constructor[NR_FILTER_DISPLACEMENTMAP] = NULL;
- _constructor[NR_FILTER_FLOOD] = NULL;
+ _constructor[NR_FILTER_COLORMATRIX] = &FilterColorMatrix::create;
+ _constructor[NR_FILTER_COMPONENTTRANSFER] = &FilterComponentTransfer::create;
+ _constructor[NR_FILTER_COMPOSITE] = &FilterComposite::create;
+ _constructor[NR_FILTER_CONVOLVEMATRIX] = &FilterConvolveMatrix::create;
+ _constructor[NR_FILTER_DIFFUSELIGHTING] = &FilterDiffuseLighting::create;
+ _constructor[NR_FILTER_DISPLACEMENTMAP] = &FilterDisplacementMap::create;
+ _constructor[NR_FILTER_FLOOD] = &FilterFlood::create;
_constructor[NR_FILTER_GAUSSIANBLUR] = &FilterGaussian::create;
- _constructor[NR_FILTER_IMAGE] = NULL;
- _constructor[NR_FILTER_MERGE] = NULL;
- _constructor[NR_FILTER_MORPHOLOGY] = NULL;
+ _constructor[NR_FILTER_IMAGE] = &FilterImage::create;
+ _constructor[NR_FILTER_MERGE] = &FilterMerge::create;
+ _constructor[NR_FILTER_MORPHOLOGY] = &FilterMorphology::create;
_constructor[NR_FILTER_OFFSET] = &FilterOffset::create;
- _constructor[NR_FILTER_SPECULARLIGHTING] = NULL;
- _constructor[NR_FILTER_TILE] = NULL;
- _constructor[NR_FILTER_TURBULENCE] = NULL;
+ _constructor[NR_FILTER_SPECULARLIGHTING] = &FilterSpecularLighting::create;
+ _constructor[NR_FILTER_TILE] = &FilterTile::create;
+ _constructor[NR_FILTER_TURBULENCE] = &FilterTurbulence::create;
created = true;
}
_primitive_count = 0;
}
-void Filter::set_x(SVGLength &length)
+void Filter::set_x(SVGLength const &length)
{
if (length._set)
_region_x = length;
}
-void Filter::set_y(SVGLength &length)
+void Filter::set_y(SVGLength const &length)
{
if (length._set)
_region_y = length;
}
-void Filter::set_width(SVGLength &length)
+void Filter::set_width(SVGLength const &length)
{
if (length._set)
_region_width = length;
}
-void Filter::set_height(SVGLength &length)
+void Filter::set_height(SVGLength const &length)
{
if (length._set)
_region_height = length;
}
+void Filter::set_resolution(double const pixels) {
+ if (pixels > 0) {
+ _x_pixels = pixels;
+ _y_pixels = pixels;
+ }
+}
+
+void Filter::set_resolution(double const x_pixels, double const y_pixels) {
+ if (x_pixels >= 0 && y_pixels >= 0) {
+ _x_pixels = x_pixels;
+ _y_pixels = y_pixels;
+ }
+}
+
+void Filter::reset_resolution() {
+ _x_pixels = -1;
+ _y_pixels = -1;
+}
+
} /* namespace NR */
/*