From: johanengelen Date: Fri, 2 Jan 2009 12:18:25 +0000 (+0000) Subject: Move filters into their own namespace Inkscape::Filters (from NR::) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d9a7c806ee7f408ddb61ff4f233c9d96111ee2b5;p=inkscape.git Move filters into their own namespace Inkscape::Filters (from NR::) --- diff --git a/src/display/nr-3dutils.cpp b/src/display/nr-3dutils.cpp index ffeaebe8e..dd1419f2b 100644 --- a/src/display/nr-3dutils.cpp +++ b/src/display/nr-3dutils.cpp @@ -136,11 +136,11 @@ void compute_surface_normal(Fvector &N, gdouble ss, NRPixBlock *in, int i, int j //std::cout << "(" << N[X_3D] << ", " << N[Y_3D] << ", " << N[Z_3D] << ")" << std::endl; } -void convert_coord(gdouble &x, gdouble &y, gdouble &z, Matrix const &trans) { +void convert_coord(gdouble &x, gdouble &y, gdouble &z, Geom::Matrix const &trans) { Point p = Point(x, y); p *= trans; - x = p[X]; - y = p[Y]; + x = p[Geom::X]; + y = p[Geom::Y]; z *= trans[0]; } diff --git a/src/display/nr-3dutils.h b/src/display/nr-3dutils.h index 4baa9cc86..dbbc7c9a4 100644 --- a/src/display/nr-3dutils.h +++ b/src/display/nr-3dutils.h @@ -4,6 +4,7 @@ /* * 3D utils. Definition of gdouble vectors of dimension 3 and of some basic * functions. + * This looks redundant, why not just use Geom::Point for this? * * Authors: * Jean-Rene Reinhard @@ -14,13 +15,12 @@ */ #include +#include <2geom/forward.h> struct NRPixBlock; namespace NR { -struct Matrix; - #define X_3D 0 #define Y_3D 1 #define Z_3D 2 @@ -94,7 +94,7 @@ void compute_surface_normal(Fvector &N, gdouble ss, NRPixBlock *in, int i, int j * \param z a reference to a z coordinate * \param z a reference to a transformation matrix */ -void convert_coord(gdouble &x, gdouble &y, gdouble &z, Matrix const &trans); +void convert_coord(gdouble &x, gdouble &y, gdouble &z, Geom::Matrix const &trans); } /* namespace NR */ diff --git a/src/display/nr-arena-group.cpp b/src/display/nr-arena-group.cpp index 7692cbf15..d73a0ecbf 100644 --- a/src/display/nr-arena-group.cpp +++ b/src/display/nr-arena-group.cpp @@ -201,7 +201,7 @@ void nr_arena_group_set_style (NRArenaGroup *group, SPStyle *style) if (style->filter.set && style->getFilter()) { if (!group->filter) { int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter())); - group->filter = new NR::Filter(primitives); + group->filter = new Inkscape::Filters::Filter(primitives); } sp_filter_build_renderer(SP_FILTER(style->getFilter()), group->filter); } else { diff --git a/src/display/nr-arena-image.cpp b/src/display/nr-arena-image.cpp index 147513f6b..da2f5ce7e 100644 --- a/src/display/nr-arena-image.cpp +++ b/src/display/nr-arena-image.cpp @@ -369,7 +369,7 @@ void nr_arena_image_set_style (NRArenaImage *image, SPStyle *style) if (style->filter.set && style->getFilter()) { if (!image->filter) { int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter())); - image->filter = new NR::Filter(primitives); + image->filter = new Inkscape::Filters::Filter(primitives); } sp_filter_build_renderer(SP_FILTER(style->getFilter()), image->filter); } else { diff --git a/src/display/nr-arena-item.h b/src/display/nr-arena-item.h index 22c15daef..17a223b31 100644 --- a/src/display/nr-arena-item.h +++ b/src/display/nr-arena-item.h @@ -99,7 +99,7 @@ struct NRArenaItem : public NRObject { /* Mask item */ NRArenaItem *mask; /* Filter to be applied after rendering this object, NULL if none */ - NR::Filter *filter; + Inkscape::Filters::Filter *filter; /* Rendered buffer */ unsigned char *px; diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index 906d9166c..aafdc37d6 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -1336,7 +1336,7 @@ nr_arena_shape_set_style(NRArenaShape *shape, SPStyle *style) if (style->filter.set && style->getFilter()) { if (!shape->filter) { int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter())); - shape->filter = new NR::Filter(primitives); + shape->filter = new Inkscape::Filters::Filter(primitives); } sp_filter_build_renderer(SP_FILTER(style->getFilter()), shape->filter); } else { diff --git a/src/display/nr-filter-blend.cpp b/src/display/nr-filter-blend.cpp index 2544d8bfb..2a066b563 100644 --- a/src/display/nr-filter-blend.cpp +++ b/src/display/nr-filter-blend.cpp @@ -24,7 +24,8 @@ #include "libnr/nr-blit.h" #include "libnr/nr-pixops.h" -namespace NR { +namespace Inkscape { +namespace Filters { /* * From http://www.w3.org/TR/SVG11/filters.html#feBlend @@ -218,7 +219,8 @@ void FilterBlend::set_mode(FilterBlendMode mode) { } } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-blend.h b/src/display/nr-filter-blend.h index 3e3bf71b2..ffdd62118 100644 --- a/src/display/nr-filter-blend.h +++ b/src/display/nr-filter-blend.h @@ -21,7 +21,8 @@ #include "display/nr-filter-slot.h" #include "display/nr-filter-units.h" -namespace NR { +namespace Inkscape { +namespace Filters { enum FilterBlendMode { BLEND_NORMAL, @@ -50,7 +51,8 @@ private: }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ diff --git a/src/display/nr-filter-colormatrix.cpp b/src/display/nr-filter-colormatrix.cpp index f619e2685..e5dc3fb20 100644 --- a/src/display/nr-filter-colormatrix.cpp +++ b/src/display/nr-filter-colormatrix.cpp @@ -16,7 +16,8 @@ #include "libnr/nr-blit.h" #include -namespace NR { +namespace Inkscape { +namespace Filters { FilterColorMatrix::FilterColorMatrix() { @@ -210,7 +211,8 @@ void FilterColorMatrix::set_values(std::vector &v){ values = v; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-colormatrix.h b/src/display/nr-filter-colormatrix.h index 85d2ab758..1c331a5b0 100644 --- a/src/display/nr-filter-colormatrix.h +++ b/src/display/nr-filter-colormatrix.h @@ -17,7 +17,8 @@ #include "display/nr-filter-units.h" #include -namespace NR { +namespace Inkscape { +namespace Filters { enum FilterColorMatrixType { COLORMATRIX_MATRIX, @@ -44,7 +45,8 @@ private: FilterColorMatrixType type; }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_COLOR_MATRIX_H__ */ /* diff --git a/src/display/nr-filter-component-transfer.cpp b/src/display/nr-filter-component-transfer.cpp index caf053bcf..74d66fbe4 100644 --- a/src/display/nr-filter-component-transfer.cpp +++ b/src/display/nr-filter-component-transfer.cpp @@ -18,7 +18,8 @@ #include "libnr/nr-pixops.h" #include -namespace NR { +namespace Inkscape { +namespace Filters { FilterComponentTransfer::FilterComponentTransfer() { @@ -157,7 +158,8 @@ void FilterComponentTransfer::area_enlarge(NRRectL &/*area*/, Geom::Matrix const { } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-component-transfer.h b/src/display/nr-filter-component-transfer.h index 3a7c015cb..3d8be272e 100644 --- a/src/display/nr-filter-component-transfer.h +++ b/src/display/nr-filter-component-transfer.h @@ -17,7 +17,8 @@ #include "display/nr-filter-units.h" #include -namespace NR { +namespace Inkscape { +namespace Filters { enum FilterComponentTransferType { COMPONENTTRANSFER_TYPE_IDENTITY, @@ -46,7 +47,8 @@ public: double offset[4]; }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_COMPONENT_TRANSFER_H__ */ /* diff --git a/src/display/nr-filter-composite.cpp b/src/display/nr-filter-composite.cpp index 568c093b9..34a2d2e63 100644 --- a/src/display/nr-filter-composite.cpp +++ b/src/display/nr-filter-composite.cpp @@ -73,21 +73,23 @@ static int arith_k1, arith_k2, arith_k3, arith_k4; inline void composite_arithmetic(unsigned char *r, unsigned char const *a, unsigned char const *b) { - r[0] = NR_NORMALIZE_31(NR::clamp3(arith_k1 * a[0] * b[0] + using Inkscape::Filters::clamp3; + r[0] = NR_NORMALIZE_31(clamp3(arith_k1 * a[0] * b[0] + arith_k2 * a[0] + arith_k3 * b[0] + arith_k4)); - r[1] = NR_NORMALIZE_31(NR::clamp3(arith_k1 * a[1] * b[1] + r[1] = NR_NORMALIZE_31(clamp3(arith_k1 * a[1] * b[1] + arith_k2 * a[1] + arith_k3 * b[1] + arith_k4)); - r[2] = NR_NORMALIZE_31(NR::clamp3(arith_k1 * a[2] * b[2] + r[2] = NR_NORMALIZE_31(clamp3(arith_k1 * a[2] * b[2] + arith_k2 * a[2] + arith_k3 * b[2] + arith_k4)); - r[3] = NR_NORMALIZE_31(NR::clamp3(arith_k1 * a[3] * b[3] + r[3] = NR_NORMALIZE_31(clamp3(arith_k1 * a[3] * b[3] + arith_k2 * a[3] + arith_k3 * b[3] + arith_k4)); } -namespace NR { +namespace Inkscape { +namespace Filters { FilterComposite::FilterComposite() : op(COMPOSITE_DEFAULT), k1(0), k2(0), k3(0), k4(0), - _input2(NR::NR_FILTER_SLOT_NOT_SET) + _input2(Inkscape::Filters::NR_FILTER_SLOT_NOT_SET) {} FilterPrimitive * FilterComposite::create() { @@ -216,7 +218,8 @@ void FilterComposite::set_arithmetic(double k1, double k2, double k3, double k4) this->k4 = k4; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-composite.h b/src/display/nr-filter-composite.h index d467213f0..b24666531 100644 --- a/src/display/nr-filter-composite.h +++ b/src/display/nr-filter-composite.h @@ -17,7 +17,8 @@ #include "display/nr-filter-slot.h" #include "display/nr-filter-units.h" -namespace NR { +namespace Inkscape { +namespace Filters { class FilterComposite : public FilterPrimitive { public: @@ -39,7 +40,8 @@ private: int _input2; }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_COMPOSITE_H__ */ /* diff --git a/src/display/nr-filter-convolve-matrix.cpp b/src/display/nr-filter-convolve-matrix.cpp index e29283cf1..3fca952da 100644 --- a/src/display/nr-filter-convolve-matrix.cpp +++ b/src/display/nr-filter-convolve-matrix.cpp @@ -14,7 +14,8 @@ #include "display/nr-filter-utils.h" #include -namespace NR { +namespace Inkscape { +namespace Filters { FilterConvolveMatrix::FilterConvolveMatrix() {} @@ -144,7 +145,8 @@ FilterTraits FilterConvolveMatrix::get_input_traits() { return TRAIT_PARALLER; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-convolve-matrix.h b/src/display/nr-filter-convolve-matrix.h index 8414b60c1..d7a04a766 100644 --- a/src/display/nr-filter-convolve-matrix.h +++ b/src/display/nr-filter-convolve-matrix.h @@ -18,7 +18,8 @@ #include "libnr/nr-rect-l.h" #include -namespace NR { +namespace Inkscape { +namespace Filters { enum FilterConvolveMatrixEdgeMode { CONVOLVEMATRIX_EDGEMODE_DUPLICATE, @@ -57,7 +58,8 @@ private: bool preserveAlpha; }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_CONVOLVE_MATRIX_H__ */ /* diff --git a/src/display/nr-filter-diffuselighting.cpp b/src/display/nr-filter-diffuselighting.cpp index 77879cd89..9ae231d39 100644 --- a/src/display/nr-filter-diffuselighting.cpp +++ b/src/display/nr-filter-diffuselighting.cpp @@ -25,7 +25,8 @@ #include "libnr/nr-rect-l.h" #include "color.h" -namespace NR { +namespace Inkscape { +namespace Filters { FilterDiffuseLighting::FilterDiffuseLighting() { @@ -44,7 +45,7 @@ FilterDiffuseLighting::~FilterDiffuseLighting() #define COMPUTE_INTER(inter, N, L, kd) \ do {\ - (inter) = (kd) * scalar_product((N), (L)); \ + (inter) = (kd) * NR::scalar_product((N), (L)); \ if ((inter) < 0) (inter) = 0; \ }while(0) @@ -68,11 +69,11 @@ int FilterDiffuseLighting::render(FilterSlot &slot, FilterUnits const &units) { int dx = 1; //TODO setup int dy = 1; //TODO setup //surface scale - Matrix trans = units.get_matrix_primitiveunits2pb(); + Geom::Matrix trans = units.get_matrix_primitiveunits2pb(); gdouble ss = surfaceScale * trans[0]; gdouble kd = diffuseConstant; //diffuse lighting constant - Fvector L, N, LC; + NR::Fvector L, N, LC; gdouble inter; nr_pixblock_setup_fast(out, in->mode, @@ -90,7 +91,7 @@ int FilterDiffuseLighting::render(FilterSlot &slot, FilterUnits const &units) { dl->light_components(LC); //finish the work for (i = 0, j = 0; i < w*h; i++) { - compute_surface_normal(N, ss, in, i / w, i % w, dx, dy); + NR::compute_surface_normal(N, ss, in, i / w, i % w, dx, dy); COMPUTE_INTER(inter, N, L, kd); data_o[j++] = CLAMP_D_TO_U8(inter * LC[LIGHT_RED]); @@ -112,7 +113,7 @@ int FilterDiffuseLighting::render(FilterSlot &slot, FilterUnits const &units) { // pixblock coordinates //finish the work for (i = 0, j = 0; i < w*h; i++) { - compute_surface_normal(N, ss, in, i / w, i % w, dx, dy); + NR::compute_surface_normal(N, ss, in, i / w, i % w, dx, dy); pl->light_vector(L, i % w + x0, i / w + y0, @@ -137,7 +138,7 @@ int FilterDiffuseLighting::render(FilterSlot &slot, FilterUnits const &units) { // pixblock coordinates //finish the work for (i = 0, j = 0; i < w*h; i++) { - compute_surface_normal(N, ss, in, i / w, i % w, dx, dy); + NR::compute_surface_normal(N, ss, in, i / w, i % w, dx, dy); sl->light_vector(L, i % w + x0, i / w + y0, @@ -178,7 +179,8 @@ FilterTraits FilterDiffuseLighting::get_input_traits() { return TRAIT_PARALLER; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-diffuselighting.h b/src/display/nr-filter-diffuselighting.h index 36ed8835b..a1c6964cb 100644 --- a/src/display/nr-filter-diffuselighting.h +++ b/src/display/nr-filter-diffuselighting.h @@ -23,7 +23,8 @@ #include "filters/spotlight.h" #include "color.h" -namespace NR { +namespace Inkscape { +namespace Filters { class FilterDiffuseLighting : public FilterPrimitive { public: @@ -46,7 +47,8 @@ public: private: }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_DIFFUSELIGHTING_H__ */ /* diff --git a/src/display/nr-filter-displacement-map.cpp b/src/display/nr-filter-displacement-map.cpp index 928745f31..39e921a38 100644 --- a/src/display/nr-filter-displacement-map.cpp +++ b/src/display/nr-filter-displacement-map.cpp @@ -15,7 +15,8 @@ #include "libnr/nr-blit.h" #include "libnr/nr-pixops.h" -namespace NR { +namespace Inkscape { +namespace Filters { FilterDisplacementMap::FilterDisplacementMap() {} @@ -159,7 +160,8 @@ FilterTraits FilterDisplacementMap::get_input_traits() { return TRAIT_PARALLER; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-displacement-map.h b/src/display/nr-filter-displacement-map.h index f30c5a8a9..2a7b0f195 100644 --- a/src/display/nr-filter-displacement-map.h +++ b/src/display/nr-filter-displacement-map.h @@ -18,7 +18,8 @@ #include "display/nr-filter-units.h" #include "libnr/nr-rect-l.h" -namespace NR { +namespace Inkscape { +namespace Filters { class FilterDisplacementMap : public FilterPrimitive { public: @@ -42,7 +43,8 @@ private: int out_x0, out_y0, out_w, out_h; }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_DISPLACEMENT_MAP_H__ */ /* diff --git a/src/display/nr-filter-flood.cpp b/src/display/nr-filter-flood.cpp index 8e9b51039..026cbce16 100644 --- a/src/display/nr-filter-flood.cpp +++ b/src/display/nr-filter-flood.cpp @@ -12,7 +12,8 @@ #include "display/nr-filter-flood.h" #include "display/nr-filter-utils.h" -namespace NR { +namespace Inkscape { +namespace Filters { FilterFlood::FilterFlood() {} @@ -73,7 +74,8 @@ void FilterFlood::area_enlarge(NRRectL &/*area*/, Geom::Matrix const &/*trans*/) { } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-flood.h b/src/display/nr-filter-flood.h index cd9269913..9e6a53abb 100644 --- a/src/display/nr-filter-flood.h +++ b/src/display/nr-filter-flood.h @@ -16,7 +16,8 @@ #include "display/nr-filter-slot.h" #include "display/nr-filter-units.h" -namespace NR { +namespace Inkscape { +namespace Filters { class FilterFlood : public FilterPrimitive { public: @@ -33,7 +34,8 @@ private: guint32 color; }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_FLOOD_H__ */ /* diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp index 4e4c3ee63..5d071be8c 100644 --- a/src/display/nr-filter-gaussian.cpp +++ b/src/display/nr-filter-gaussian.cpp @@ -90,7 +90,8 @@ static inline Tt clip_round_cast(Ts const& v, Tt const minval=std::numeric_limit return round_cast(v); } -namespace NR { +namespace Inkscape { +namespace Filters { FilterGaussian::FilterGaussian() { @@ -872,7 +873,8 @@ void FilterGaussian::set_deviation(double x, double y) } } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-gaussian.h b/src/display/nr-filter-gaussian.h index 1242a0961..763e42de2 100644 --- a/src/display/nr-filter-gaussian.h +++ b/src/display/nr-filter-gaussian.h @@ -29,7 +29,8 @@ enum { BLUR_QUALITY_WORST = -2 }; -namespace NR { +namespace Inkscape { +namespace Filters { class FilterGaussian : public FilterPrimitive { public: @@ -64,7 +65,8 @@ private: }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ diff --git a/src/display/nr-filter-getalpha.cpp b/src/display/nr-filter-getalpha.cpp index 72c05c797..0b71e28c8 100644 --- a/src/display/nr-filter-getalpha.cpp +++ b/src/display/nr-filter-getalpha.cpp @@ -13,7 +13,8 @@ #include "libnr/nr-blit.h" #include "libnr/nr-pixblock.h" -namespace NR { +namespace Inkscape { +namespace Filters { NRPixBlock *filter_get_alpha(NRPixBlock *src) { @@ -40,7 +41,8 @@ NRPixBlock *filter_get_alpha(NRPixBlock *src) return dst; } -} // namespace NR +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-getalpha.h b/src/display/nr-filter-getalpha.h index cfbca0bc1..fca645776 100644 --- a/src/display/nr-filter-getalpha.h +++ b/src/display/nr-filter-getalpha.h @@ -14,11 +14,13 @@ #include "libnr/nr-pixblock.h" -namespace NR { +namespace Inkscape { +namespace Filters { NRPixBlock *filter_get_alpha(NRPixBlock *src); -} +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_GETALPHA_H__ */ /* diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index da8fe0ac4..986b6502d 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -18,7 +18,8 @@ #include "display/nr-filter-units.h" #include "libnr/nr-rect-l.h" -namespace NR { +namespace Inkscape { +namespace Filters { FilterImage::FilterImage() { @@ -57,11 +58,8 @@ int FilterImage::render(FilterSlot &slot, FilterUnits const &units) { } pb = new NRPixBlock; free_pb_on_exit = true; - - Matrix identity(1.0, 0.0, - 0.0, 1.0, - 0.0, 0.0); - Geom::OptRect area = SVGElem->getBounds(identity); + + Geom::OptRect area = SVGElem->getBounds(Geom::identity()); NRRectL rect; rect.x0=area->min()[Geom::X]; @@ -148,7 +146,7 @@ int FilterImage::render(FilterSlot &slot, FilterUnits const &units) { // Get the object bounding box. Image is placed with respect to box. // Array values: 0: width; 3: height; 4: -x; 5: -y. - Matrix object_bbox = units.get_matrix_user2filterunits().inverse(); + Geom::Matrix object_bbox = units.get_matrix_user2filterunits().inverse(); // feImage is suppose to use the same parameters as a normal SVG image. // If a width or height is set to zero, the image is not suppose to be displayed. @@ -163,7 +161,7 @@ int FilterImage::render(FilterSlot &slot, FilterUnits const &units) { int coordx,coordy; unsigned char *out_data = NR_PIXBLOCK_PX(out); - Matrix unit_trans = units.get_matrix_primitiveunits2pb().inverse(); + Geom::Matrix unit_trans = units.get_matrix_primitiveunits2pb().inverse(); for (x=x0; x < x1; x++){ for (y=y0; y < y1; y++){ //TODO: use interpolation @@ -217,7 +215,8 @@ FilterTraits FilterImage::get_input_traits() { return TRAIT_PARALLER; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-image.h b/src/display/nr-filter-image.h index 42e7f089a..f7f0fe590 100644 --- a/src/display/nr-filter-image.h +++ b/src/display/nr-filter-image.h @@ -18,7 +18,8 @@ #include #include "sp-item.h" -namespace NR { +namespace Inkscape { +namespace Filters { class FilterImage : public FilterPrimitive { public: @@ -43,7 +44,8 @@ private: float feImageX,feImageY,feImageWidth,feImageHeight; }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_IMAGE_H__ */ /* diff --git a/src/display/nr-filter-merge.cpp b/src/display/nr-filter-merge.cpp index 380884223..b913e2cd7 100644 --- a/src/display/nr-filter-merge.cpp +++ b/src/display/nr-filter-merge.cpp @@ -32,7 +32,8 @@ composite_over(unsigned char *r, unsigned char const *a, unsigned char const *b) r[3] = a[3] + NR_NORMALIZE_21(b[3] * (255 - a[3])); } -namespace NR { +namespace Inkscape { +namespace Filters { FilterMerge::FilterMerge() : _input_image(1, NR_FILTER_SLOT_NOT_SET) @@ -128,7 +129,8 @@ void FilterMerge::set_input(int input, int slot) { } } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-merge.h b/src/display/nr-filter-merge.h index 14c16a27a..b7737e347 100644 --- a/src/display/nr-filter-merge.h +++ b/src/display/nr-filter-merge.h @@ -19,7 +19,8 @@ #include "display/nr-filter-slot.h" #include "display/nr-filter-units.h" -namespace NR { +namespace Inkscape { +namespace Filters { class FilterMerge : public FilterPrimitive { public: @@ -36,7 +37,8 @@ private: std::vector _input_image; }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_MERGE_H__ */ /* diff --git a/src/display/nr-filter-morphology.cpp b/src/display/nr-filter-morphology.cpp index b1c790442..fb51099d5 100644 --- a/src/display/nr-filter-morphology.cpp +++ b/src/display/nr-filter-morphology.cpp @@ -13,7 +13,8 @@ #include "display/nr-filter-units.h" #include "libnr/nr-blit.h" -namespace NR { +namespace Inkscape { +namespace Filters { FilterMorphology::FilterMorphology() { @@ -137,7 +138,8 @@ FilterTraits FilterMorphology::get_input_traits() { return TRAIT_PARALLER; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-morphology.h b/src/display/nr-filter-morphology.h index b598a4208..1d3e16be3 100644 --- a/src/display/nr-filter-morphology.h +++ b/src/display/nr-filter-morphology.h @@ -16,7 +16,8 @@ #include "display/nr-filter-slot.h" #include "display/nr-filter-units.h" -namespace NR { +namespace Inkscape { +namespace Filters { enum FilterMorphologyOperator { MORPHOLOGY_OPERATOR_ERODE, @@ -43,7 +44,8 @@ private: double yradius; }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_MORPHOLOGY_H__ */ /* diff --git a/src/display/nr-filter-offset.cpp b/src/display/nr-filter-offset.cpp index ecfa40fa2..fd4f55053 100644 --- a/src/display/nr-filter-offset.cpp +++ b/src/display/nr-filter-offset.cpp @@ -16,7 +16,11 @@ #include "libnr/nr-pixblock.h" #include "libnr/nr-rect-l.h" -namespace NR { +namespace Inkscape { +namespace Filters { + +using Geom::X; +using Geom::Y; FilterOffset::FilterOffset() : dx(0), dy(0) @@ -39,8 +43,8 @@ int FilterOffset::render(FilterSlot &slot, FilterUnits const &units) { NRPixBlock *out = new NRPixBlock; - Matrix trans = units.get_matrix_primitiveunits2pb(); - Point offset(dx, dy); + Geom::Matrix trans = units.get_matrix_primitiveunits2pb(); + Geom::Point offset(dx, dy); offset *= trans; offset[X] -= trans[4]; offset[Y] -= trans[5]; @@ -72,7 +76,7 @@ void FilterOffset::set_dy(double amount) { void FilterOffset::area_enlarge(NRRectL &area, Geom::Matrix const &trans) { - Point offset(dx, dy); + Geom::Point offset(dx, dy); offset *= trans; offset[X] -= trans[4]; offset[Y] -= trans[5]; @@ -90,7 +94,8 @@ void FilterOffset::area_enlarge(NRRectL &area, Geom::Matrix const &trans) } } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-offset.h b/src/display/nr-filter-offset.h index 166fba247..b00ad25fe 100644 --- a/src/display/nr-filter-offset.h +++ b/src/display/nr-filter-offset.h @@ -17,7 +17,8 @@ #include "display/nr-filter-units.h" #include "libnr/nr-rect-l.h" -namespace NR { +namespace Inkscape { +namespace Filters { class FilterOffset : public FilterPrimitive { public: @@ -35,7 +36,8 @@ private: double dx, dy; }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_OFFSET_H__ */ /* diff --git a/src/display/nr-filter-pixops.h b/src/display/nr-filter-pixops.h index 8d7c31662..b2db7067a 100644 --- a/src/display/nr-filter-pixops.h +++ b/src/display/nr-filter-pixops.h @@ -16,7 +16,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -namespace NR { +namespace Inkscape { +namespace Filters { /** * Mixes the two input images using the function given as template. @@ -135,7 +136,8 @@ void pixops_mix(NRPixBlock &out, NRPixBlock &in1, NRPixBlock &in2) { } } -} // namespace NR +} /* namespace Filters */ +} /* namespace Inkscape */ #endif // __NR_FILTER_PIXOPS_H_ /* diff --git a/src/display/nr-filter-primitive.cpp b/src/display/nr-filter-primitive.cpp index eb4583b6e..b70ae57fe 100644 --- a/src/display/nr-filter-primitive.cpp +++ b/src/display/nr-filter-primitive.cpp @@ -16,7 +16,8 @@ #include "libnr/nr-pixblock.h" #include "svg/svg-length.h" -namespace NR { +namespace Inkscape { +namespace Filters { FilterPrimitive::FilterPrimitive() { @@ -57,7 +58,8 @@ FilterTraits FilterPrimitive::get_input_traits() { return TRAIT_ANYTHING; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-primitive.h b/src/display/nr-filter-primitive.h index 6d0f5433b..74b41211b 100644 --- a/src/display/nr-filter-primitive.h +++ b/src/display/nr-filter-primitive.h @@ -17,7 +17,8 @@ #include "libnr/nr-rect-l.h" #include "svg/svg-length.h" -namespace NR { +namespace Inkscape { +namespace Filters { /* * Different filter effects need different types of inputs. This is what @@ -118,7 +119,8 @@ protected: }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ diff --git a/src/display/nr-filter-skeleton.cpp b/src/display/nr-filter-skeleton.cpp index 384baa2c5..bdb993ed9 100644 --- a/src/display/nr-filter-skeleton.cpp +++ b/src/display/nr-filter-skeleton.cpp @@ -26,7 +26,8 @@ #include "display/nr-filter-units.h" #include "libnr/nr-pixblock.h" -namespace NR { +namespace Inkscape { +namespace Filters { FilterSkeleton::FilterSkeleton() {} @@ -51,7 +52,8 @@ int FilterSkeleton::render(FilterSlot &slot, return 0; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-skeleton.h b/src/display/nr-filter-skeleton.h index c2e595f9c..dc69c95ed 100644 --- a/src/display/nr-filter-skeleton.h +++ b/src/display/nr-filter-skeleton.h @@ -28,7 +28,8 @@ #include "display/nr-filter-slot.h" #include "display/nr-filter-units.h" -namespace NR { +namespace Inkscape { +namespace Filters { class FilterSkeleton : public FilterPrimitive { public: @@ -42,7 +43,8 @@ private: }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_SKELETON_H__ */ /* diff --git a/src/display/nr-filter-slot.cpp b/src/display/nr-filter-slot.cpp index 5d470df15..dc4de5bd3 100644 --- a/src/display/nr-filter-slot.cpp +++ b/src/display/nr-filter-slot.cpp @@ -60,7 +60,8 @@ inline static int _min2(const double a, const double b) { return (int)round(a); } -namespace NR { +namespace Inkscape { +namespace Filters { FilterSlot::FilterSlot(int slots, NRArenaItem const *item) : _last_out(-1), @@ -152,7 +153,7 @@ NRPixBlock *FilterSlot::get(int slot_nr) void FilterSlot::get_final(int slot_nr, NRPixBlock *result) { NRPixBlock *final_usr = get(slot_nr); - Matrix trans = units.get_matrix_pb2display(); + Geom::Matrix trans = units.get_matrix_pb2display(); int size = (result->area.x1 - result->area.x0) * (result->area.y1 - result->area.y0) @@ -161,12 +162,12 @@ void FilterSlot::get_final(int slot_nr, NRPixBlock *result) { if (fabs(trans[1]) > 1e-6 || fabs(trans[2]) > 1e-6) { if (filterquality == FILTER_QUALITY_BEST) { - transform_bicubic(result, final_usr, trans); + NR::transform_bicubic(result, final_usr, trans); } else { - transform_nearest(result, final_usr, trans); + NR::transform_nearest(result, final_usr, trans); } } else if (fabs(trans[0] - 1) > 1e-6 || fabs(trans[3] - 1) > 1e-6) { - scale_bicubic(result, final_usr); + NR::scale_bicubic(result, final_usr); } else { nr_blit_pixblock_pixblock(result, final_usr); } @@ -184,12 +185,12 @@ void FilterSlot::set(int slot_nr, NRPixBlock *pb) ? _get_index(slot_nr) : _get_index(NR_FILTER_UNNAMED_SLOT)); assert(index >= 0); - // Unnamed slot is only for NR::FilterSlot internal use. + // Unnamed slot is only for Inkscape::Filters::FilterSlot internal use. assert(slot_nr != NR_FILTER_UNNAMED_SLOT); assert(slot_nr == NR_FILTER_SLOT_NOT_SET ||_slot_number[index] == slot_nr); if (slot_nr == NR_FILTER_SOURCEGRAPHIC || slot_nr == NR_FILTER_BACKGROUNDIMAGE) { - Matrix trans = units.get_matrix_display2pb(); + Geom::Matrix trans = units.get_matrix_display2pb(); if (fabs(trans[1]) > 1e-6 || fabs(trans[2]) > 1e-6) { NRPixBlock *trans_pb = new NRPixBlock; int x0 = pb->area.x0; @@ -221,13 +222,13 @@ void FilterSlot::set(int slot_nr, NRPixBlock *pb) * images are exported in horizontal stripes. One stripe * is not too high, but can get thousands of pixels wide. * Rotate this 45 degrees -> _huge_ image */ - g_warning("Memory allocation failed in NR::FilterSlot::set (transform)"); + g_warning("Memory allocation failed in Inkscape::Filters::FilterSlot::set (transform)"); return; } if (filterquality == FILTER_QUALITY_BEST) { - transform_bicubic(trans_pb, pb, trans); + NR::transform_bicubic(trans_pb, pb, trans); } else { - transform_nearest(trans_pb, pb, trans); + NR::transform_nearest(trans_pb, pb, trans); } nr_pixblock_release(pb); delete pb; @@ -251,10 +252,10 @@ void FilterSlot::set(int slot_nr, NRPixBlock *pb) nr_pixblock_setup_fast(trans_pb, pb->mode, min_x, min_y, max_x, max_y, true); if (trans_pb->size != NR_PIXBLOCK_SIZE_TINY && trans_pb->data.px == NULL) { - g_warning("Memory allocation failed in NR::FilterSlot::set (scaling)"); + g_warning("Memory allocation failed in Inkscape::Filters::FilterSlot::set (scaling)"); return; } - scale_bicubic(trans_pb, pb); + NR::scale_bicubic(trans_pb, pb); nr_pixblock_release(pb); delete pb; pb = trans_pb; @@ -347,7 +348,8 @@ void FilterSlot::set_quality(FilterQuality const q) { filterquality = q; } -} +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-slot.h b/src/display/nr-filter-slot.h index b566be10e..bddb42dc3 100644 --- a/src/display/nr-filter-slot.h +++ b/src/display/nr-filter-slot.h @@ -20,7 +20,8 @@ struct NRArenaItem; -namespace NR { +namespace Inkscape { +namespace Filters { class FilterSlot { public: @@ -95,7 +96,8 @@ private: int _get_index(int slot); }; -} +} /* namespace Filters */ +} /* namespace Inkscape */ #endif // __NR_FILTER_SLOT_H__ /* diff --git a/src/display/nr-filter-specularlighting.cpp b/src/display/nr-filter-specularlighting.cpp index c6c81700c..526f49ec8 100644 --- a/src/display/nr-filter-specularlighting.cpp +++ b/src/display/nr-filter-specularlighting.cpp @@ -26,7 +26,8 @@ #include "libnr/nr-rect-l.h" #include "color.h" -namespace NR { +namespace Inkscape { +namespace Filters { FilterSpecularLighting::FilterSpecularLighting() { @@ -51,7 +52,7 @@ FilterSpecularLighting::~FilterSpecularLighting() //to get the expected formula #define COMPUTE_INTER(inter, H, N, ks, speculaExponent) \ do {\ - gdouble scal = scalar_product((N), (H)); \ + gdouble scal = NR::scalar_product((N), (H)); \ if (scal <= 0)\ (inter) = 0;\ else\ @@ -79,10 +80,10 @@ int FilterSpecularLighting::render(FilterSlot &slot, FilterUnits const &units) { int dx = 1; //TODO setup int dy = 1; //TODO setup //surface scale - Matrix trans = units.get_matrix_primitiveunits2pb(); + Geom::Matrix trans = units.get_matrix_primitiveunits2pb(); gdouble ss = surfaceScale * trans[0]; gdouble ks = specularConstant; //diffuse lighting constant - Fvector L, N, LC, H; + NR::Fvector L, N, LC, H; gdouble inter; nr_pixblock_setup_fast(out, NR_PIXBLOCK_MODE_R8G8B8A8N, @@ -98,10 +99,10 @@ int FilterSpecularLighting::render(FilterSlot &slot, FilterUnits const &units) { DistantLight *dl = new DistantLight(light.distant, lighting_color); dl->light_vector(L); dl->light_components(LC); - normalized_sum(H, L, EYE_VECTOR); + NR::normalized_sum(H, L, NR::EYE_VECTOR); //finish the work for (i = 0, j = 0; i < w*h; i++) { - compute_surface_normal(N, ss, in, i / w, i % w, dx, dy); + NR::compute_surface_normal(N, ss, in, i / w, i % w, dx, dy); COMPUTE_INTER(inter, N, H, ks, specularExponent); data_o[j++] = CLAMP_D_TO_U8(inter * LC[LIGHT_RED]); @@ -124,12 +125,12 @@ int FilterSpecularLighting::render(FilterSlot &slot, FilterUnits const &units) { // pixblock coordinates //finish the work for (i = 0, j = 0; i < w*h; i++) { - compute_surface_normal(N, ss, in, i / w, i % w, dx, dy); + NR::compute_surface_normal(N, ss, in, i / w, i % w, dx, dy); pl->light_vector(L, i % w + x0, i / w + y0, ss * (double) data_i[4*i+3]/ 255); - normalized_sum(H, L, EYE_VECTOR); + NR::normalized_sum(H, L, NR::EYE_VECTOR); COMPUTE_INTER(inter, N, H, ks, specularExponent); data_o[j++] = CLAMP_D_TO_U8(inter * LC[LIGHT_RED]); @@ -151,13 +152,13 @@ int FilterSpecularLighting::render(FilterSlot &slot, FilterUnits const &units) { // pixblock coordinates //finish the work for (i = 0, j = 0; i < w*h; i++) { - compute_surface_normal(N, ss, in, i / w, i % w, dx, dy); + NR::compute_surface_normal(N, ss, in, i / w, i % w, dx, dy); sl->light_vector(L, i % w + x0, i / w + y0, ss * (double) data_i[4*i+3]/ 255); sl->light_components(LC, L); - normalized_sum(H, L, EYE_VECTOR); + NR::normalized_sum(H, L, NR::EYE_VECTOR); COMPUTE_INTER(inter, N, H, ks, specularExponent); data_o[j++] = CLAMP_D_TO_U8(inter * LC[LIGHT_RED]); @@ -191,7 +192,8 @@ FilterTraits FilterSpecularLighting::get_input_traits() { return TRAIT_PARALLER; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-specularlighting.h b/src/display/nr-filter-specularlighting.h index 38f2dfc22..e141f8f1f 100644 --- a/src/display/nr-filter-specularlighting.h +++ b/src/display/nr-filter-specularlighting.h @@ -23,7 +23,8 @@ #include "filters/spotlight.h" #include "color.h" -namespace NR { +namespace Inkscape { +namespace Filters { class FilterSpecularLighting : public FilterPrimitive { public: @@ -47,7 +48,8 @@ public: private: }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_SPECULARLIGHTING_H__ */ /* diff --git a/src/display/nr-filter-tile.cpp b/src/display/nr-filter-tile.cpp index 7fa8ac06c..53399eba2 100644 --- a/src/display/nr-filter-tile.cpp +++ b/src/display/nr-filter-tile.cpp @@ -12,7 +12,8 @@ #include "display/nr-filter-tile.h" #include "display/nr-filter-units.h" -namespace NR { +namespace Inkscape { +namespace Filters { FilterTile::FilterTile() { @@ -60,7 +61,8 @@ FilterTraits FilterTile::get_input_traits() { return TRAIT_PARALLER; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-tile.h b/src/display/nr-filter-tile.h index ecdae91f4..ea826dfd7 100644 --- a/src/display/nr-filter-tile.h +++ b/src/display/nr-filter-tile.h @@ -17,7 +17,8 @@ #include "display/nr-filter-units.h" #include "libnr/nr-rect-l.h" -namespace NR { +namespace Inkscape { +namespace Filters { class FilterTile : public FilterPrimitive { public: @@ -30,7 +31,8 @@ public: virtual FilterTraits get_input_traits(); }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_TILE_H__ */ /* diff --git a/src/display/nr-filter-turbulence.cpp b/src/display/nr-filter-turbulence.cpp index 1a3a8d1f1..1336e5f79 100644 --- a/src/display/nr-filter-turbulence.cpp +++ b/src/display/nr-filter-turbulence.cpp @@ -26,7 +26,8 @@ #include "libnr/nr-blit.h" #include -namespace NR { +namespace Inkscape { +namespace Filters{ FilterTurbulence::FilterTurbulence() : XbaseFrequency(0), @@ -34,7 +35,7 @@ FilterTurbulence::FilterTurbulence() numOctaves(1), seed(0), updated(false), - updated_area(IPoint(), IPoint()), + updated_area(NR::IPoint(), NR::IPoint()), pix(NULL), fTileWidth(10), //guessed fTileHeight(10), //guessed @@ -80,13 +81,13 @@ void FilterTurbulence::set_updated(bool u){ updated=u; } -void FilterTurbulence::render_area(NRPixBlock *pix, IRect &full_area, FilterUnits const &units) { - const int bbox_x0 = full_area.min()[X]; - const int bbox_y0 = full_area.min()[Y]; - const int bbox_x1 = full_area.max()[X]; - const int bbox_y1 = full_area.max()[Y]; +void FilterTurbulence::render_area(NRPixBlock *pix, NR::IRect &full_area, FilterUnits const &units) { + const int bbox_x0 = full_area.min()[NR::X]; + const int bbox_y0 = full_area.min()[NR::Y]; + const int bbox_x1 = full_area.max()[NR::X]; + const int bbox_y1 = full_area.max()[NR::Y]; - Matrix unit_trans = units.get_matrix_primitiveunits2pb().inverse(); + Geom::Matrix unit_trans = units.get_matrix_primitiveunits2pb().inverse(); double point[2]; @@ -123,11 +124,11 @@ void FilterTurbulence::render_area(NRPixBlock *pix, IRect &full_area, FilterUnit pix->empty = FALSE; } -void FilterTurbulence::update_pixbuffer(IRect &area, FilterUnits const &units) { - int bbox_x0 = area.min()[X]; - int bbox_y0 = area.min()[Y]; - int bbox_x1 = area.max()[X]; - int bbox_y1 = area.max()[Y]; +void FilterTurbulence::update_pixbuffer(NR::IRect &area, FilterUnits const &units) { + int bbox_x0 = area.min()[NR::X]; + int bbox_y0 = area.min()[NR::Y]; + int bbox_x1 = area.max()[NR::X]; + int bbox_y1 = area.max()[NR::Y]; TurbulenceInit((long)seed); @@ -162,7 +163,7 @@ void FilterTurbulence::update_pixbuffer(IRect &area, FilterUnits const &units) { } int FilterTurbulence::render(FilterSlot &slot, FilterUnits const &units) { - IRect area = units.get_pixblock_filterarea_paraller(); + NR::IRect area = units.get_pixblock_filterarea_paraller(); // TODO: could be faster - updated_area only has to be same size as area if (!updated || updated_area != area) update_pixbuffer(area, units); @@ -350,7 +351,8 @@ FilterTraits FilterTurbulence::get_input_traits() { return TRAIT_PARALLER; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-turbulence.h b/src/display/nr-filter-turbulence.h index d0f345360..b12e6395a 100644 --- a/src/display/nr-filter-turbulence.h +++ b/src/display/nr-filter-turbulence.h @@ -26,7 +26,8 @@ #include "display/nr-filter-units.h" #include "libnr/nr-rect-l.h" -namespace NR { +namespace Inkscape { +namespace Filters { enum FilterTurbulenceType { TURBULENCE_FRACTALNOISE, @@ -68,8 +69,8 @@ public: virtual ~FilterTurbulence(); virtual int render(FilterSlot &slot, FilterUnits const &units); - void update_pixbuffer(IRect &area, FilterUnits const &units); - void render_area(NRPixBlock *pix, IRect &full_area, FilterUnits const &units); + void update_pixbuffer(NR::IRect &area, FilterUnits const &units); + void render_area(NRPixBlock *pix, NR::IRect &full_area, FilterUnits const &units); void set_baseFrequency(int axis, double freq); void set_numOctaves(int num); @@ -92,7 +93,7 @@ private: bool stitchTiles; FilterTurbulenceType type; bool updated; - IRect updated_area; + NR::IRect updated_area; NRPixBlock *pix; unsigned char *pix_data; @@ -106,7 +107,8 @@ private: double fTileY; }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_TURBULENCE_H__ */ /* diff --git a/src/display/nr-filter-types.h b/src/display/nr-filter-types.h index a54bfa670..595606d49 100644 --- a/src/display/nr-filter-types.h +++ b/src/display/nr-filter-types.h @@ -1,7 +1,8 @@ #ifndef __NR_FILTER_TYPES_H__ #define __NR_FILTER_TYPES_H__ -namespace NR { +namespace Inkscape { +namespace Filters { enum FilterPrimitiveType { NR_FILTER_BLEND, @@ -34,8 +35,8 @@ enum FilterSlotType { NR_FILTER_STROKEPAINT = -7, NR_FILTER_UNNAMED_SLOT = -8 }; -/* Unnamed slot is for NR::FilterSlot internal use. Passing it as - * parameter to NR::FilterSlot accessors may have unforeseen consequences. */ +/* Unnamed slot is for Inkscape::Filters::FilterSlot internal use. Passing it as + * parameter to Inkscape::Filters::FilterSlot accessors may have unforeseen consequences. */ enum FilterQuality { FILTER_QUALITY_BEST = 2, @@ -45,7 +46,8 @@ enum FilterQuality { FILTER_QUALITY_WORST = -2 }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif // __NR_FILTER_TYPES_H__ /* diff --git a/src/display/nr-filter-units.cpp b/src/display/nr-filter-units.cpp index eafe1423f..6a7de1fed 100644 --- a/src/display/nr-filter-units.cpp +++ b/src/display/nr-filter-units.cpp @@ -16,7 +16,11 @@ #include "sp-filter-units.h" #include <2geom/transforms.h> -namespace NR { +using Geom::X; +using Geom::Y; + +namespace Inkscape { +namespace Filters { FilterUnits::FilterUnits() : filterUnits(SP_FILTER_UNITS_OBJECTBOUNDINGBOX), @@ -101,7 +105,7 @@ Geom::Matrix FilterUnits::get_matrix_units2pb(SPFilterUnits units) const { } else if (units == SP_FILTER_UNITS_USERSPACEONUSE) { return get_matrix_user2pb(); } else { - g_warning("Error in NR::FilterUnits::get_matrix_units2pb: unrecognized unit type (%d)", units); + g_warning("Error in Inkscape::Filters::FilterUnits::get_matrix_units2pb: unrecognized unit type (%d)", units); return Geom::Matrix(); } } @@ -130,8 +134,8 @@ Geom::Matrix FilterUnits::get_matrix_user2units(SPFilterUnits units) const { if (item_bbox && units == SP_FILTER_UNITS_OBJECTBOUNDINGBOX) { /* No need to worry about rotations: bounding box coordinates * always have base vectors paraller with userspace coordinates */ - Point min(item_bbox->min()); - Point max(item_bbox->max()); + Geom::Point min(item_bbox->min()); + Geom::Point max(item_bbox->max()); double scale_x = 1.0 / (max[X] - min[X]); double scale_y = 1.0 / (max[Y] - min[Y]); //return Geom::Translate(min) * Geom::Scale(scale_x,scale_y); ? @@ -141,7 +145,7 @@ Geom::Matrix FilterUnits::get_matrix_user2units(SPFilterUnits units) const { } else if (units == SP_FILTER_UNITS_USERSPACEONUSE) { return Geom::identity(); } else { - g_warning("Error in NR::FilterUnits::get_matrix_user2units: unrecognized unit type (%d)", units); + g_warning("Error in Inkscape::Filters::FilterUnits::get_matrix_user2units: unrecognized unit type (%d)", units); return Geom::Matrix(); } } @@ -154,7 +158,7 @@ Geom::Matrix FilterUnits::get_matrix_user2primitiveunits() const { return get_matrix_user2units(primitiveUnits); } -IRect FilterUnits::get_pixblock_filterarea_paraller() const { +NR::IRect FilterUnits::get_pixblock_filterarea_paraller() const { g_assert(filter_area); int min_x = INT_MAX, min_y = INT_MAX, max_x = INT_MIN, max_y = INT_MIN; @@ -168,7 +172,7 @@ IRect FilterUnits::get_pixblock_filterarea_paraller() const { if (p[Y] < min_y) min_y = (int)std::floor(p[Y]); if (p[Y] > max_y) max_y = (int)std::ceil(p[Y]); } - IRect ret(IPoint(min_x, min_y), IPoint(max_x, max_y)); + NR::IRect ret(NR::IPoint(min_x, min_y), NR::IPoint(max_x, max_y)); return ret; } @@ -185,7 +189,8 @@ FilterUnits& FilterUnits::operator=(FilterUnits const &other) { return *this; } -} // namespace NR +} /* namespace Filters */ +} /* namespace Inkscape */ /* diff --git a/src/display/nr-filter-units.h b/src/display/nr-filter-units.h index d11df621f..d8489b42e 100644 --- a/src/display/nr-filter-units.h +++ b/src/display/nr-filter-units.h @@ -19,7 +19,8 @@ #include <2geom/matrix.h> #include <2geom/rect.h> -namespace NR { +namespace Inkscape { +namespace Filters { class FilterUnits { public: @@ -102,7 +103,7 @@ public: * NOTE: use only in filters, that define TRAIT_PARALLER in * get_input_traits. The filter effects area may not be representable * by simple rectangle otherwise. */ - IRect get_pixblock_filterarea_paraller() const; + NR::IRect get_pixblock_filterarea_paraller() const; FilterUnits& operator=(FilterUnits const &other); @@ -121,7 +122,8 @@ private: }; -} // namespace NR +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_UNITS_H__ */ diff --git a/src/display/nr-filter-utils.cpp b/src/display/nr-filter-utils.cpp index ddd41298c..e9e422094 100644 --- a/src/display/nr-filter-utils.cpp +++ b/src/display/nr-filter-utils.cpp @@ -1,6 +1,7 @@ #include "nr-filter-utils.h" -namespace NR { +namespace Inkscape { +namespace Filters { int clamp(int const val) { if (val < 0) return 0; @@ -20,7 +21,8 @@ int clamp_alpha(int const val, int const alpha) { return val; } -} //namespace NR +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter-utils.h b/src/display/nr-filter-utils.h index 91c295e94..ccdaec1a8 100644 --- a/src/display/nr-filter-utils.h +++ b/src/display/nr-filter-utils.h @@ -15,7 +15,8 @@ #include "round.h" /* Shouldn't these be inlined? */ -namespace NR { +namespace Inkscape { +namespace Filters { /** * Clamps an integer value to a value between 0 and 255. Needed by filters where @@ -49,7 +50,8 @@ int clamp3(int const val); */ int clamp_alpha(int const val, int const alpha); -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_UTILS_H__ */ /* diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp index a6c5df036..30f8ae7e9 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -53,7 +53,11 @@ using Inkscape::round; #endif -namespace NR { +namespace Inkscape { +namespace Filters { + +using Geom::X; +using Geom::Y; static Geom::OptRect get_item_bbox(NRArenaItem const *item) { Geom::Rect item_bbox; @@ -184,7 +188,7 @@ int Filter::render(NRArenaItem const *item, NRPixBlock *pb) nr_pixblock_setup_fast(in, pb->mode, pb->area.x0, pb->area.y0, pb->area.x1, pb->area.y1, true); if (in->size != NR_PIXBLOCK_SIZE_TINY && in->data.px == NULL) { - g_warning("NR::Filter::render: failed to reserve temporary buffer"); + g_warning("Inkscape::Filters::Filter::render: failed to reserve temporary buffer"); return 0; } nr_blit_pixblock_pixblock(in, pb); @@ -195,7 +199,7 @@ int Filter::render(NRArenaItem const *item, NRPixBlock *pb) in = slot.get(NR_FILTER_SOURCEGRAPHIC); if (in->area.x1 - in->area.x0 <= 0 || in->area.y1 - in->area.y0 <= 0) { if (in->area.x1 - in->area.x0 < 0 || in->area.y1 - in->area.y0 < 0) { - g_warning("NR::Filter::render: negative area! (%d, %d) (%d, %d)", + g_warning("Inkscape::Filters::Filter::render: negative area! (%d, %d) (%d, %d)", in->area.x0, in->area.y0, in->area.x1, in->area.y1); } return 0; @@ -265,10 +269,10 @@ void Filter::bbox_enlarge(NRRectL &bbox) { Geom::Rect enlarged = filter_effect_area(tmp_bbox); - bbox.x0 = (ICoord)enlarged.min()[X]; - bbox.y0 = (ICoord)enlarged.min()[Y]; - bbox.x1 = (ICoord)enlarged.max()[X]; - bbox.y1 = (ICoord)enlarged.max()[Y]; + bbox.x0 = (NR::ICoord)enlarged.min()[X]; + bbox.y0 = (NR::ICoord)enlarged.min()[Y]; + bbox.x1 = (NR::ICoord)enlarged.max()[X]; + bbox.y1 = (NR::ICoord)enlarged.max()[Y]; } Geom::Rect Filter::filter_effect_area(Geom::Rect const &bbox) @@ -310,7 +314,7 @@ Geom::Rect Filter::filter_effect_area(Geom::Rect const &bbox) minp[Y] = _region_y.computed; maxp[Y] = minp[Y] + _region_height.computed; } else { - g_warning("Error in NR::Filter::bbox_enlarge: unrecognized value of _filter_units"); + g_warning("Error in Inkscape::Filters::Filter::bbox_enlarge: unrecognized value of _filter_units"); } Geom::Rect area(minp, maxp); return area; @@ -319,7 +323,7 @@ Geom::Rect Filter::filter_effect_area(Geom::Rect const &bbox) /* Constructor table holds pointers to static methods returning filter * primitives. This table is indexed with FilterPrimitiveType, so that * for example method in _constructor[NR_FILTER_GAUSSIANBLUR] - * returns a filter object of type NR::FilterGaussian. + * returns a filter object of type Inkscape::Filters::FilterGaussian. */ typedef FilterPrimitive*(*FilterConstructor)(); static FilterConstructor _constructor[NR_FILTER_ENDPRIMITIVETYPE]; @@ -531,7 +535,8 @@ std::pair Filter::_filter_resolution( return resolution; } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-filter.h b/src/display/nr-filter.h index b00cbf7d7..318e1030f 100644 --- a/src/display/nr-filter.h +++ b/src/display/nr-filter.h @@ -24,7 +24,8 @@ struct NRArenaItem; -namespace NR { +namespace Inkscape { +namespace Filters { class Filter : public Inkscape::GC::Managed<> { public: @@ -205,9 +206,8 @@ private: }; -} /* namespace NR */ - - +} /* namespace Filters */ +} /* namespace Inkscape */ #endif /* __NR_FILTER_H__ */ diff --git a/src/display/nr-light-types.h b/src/display/nr-light-types.h index 87865467c..79b4a3a5e 100644 --- a/src/display/nr-light-types.h +++ b/src/display/nr-light-types.h @@ -1,7 +1,8 @@ #ifndef __NR_LIGHT_TYPES_H__ #define __NR_LIGHT_TYPES_H__ -namespace NR { +namespace Inkscape { +namespace Filters { enum LightType{ NO_LIGHT = 0, @@ -10,7 +11,8 @@ enum LightType{ SPOT_LIGHT }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif // __NR_LIGHT_TYPES_H__ /* diff --git a/src/display/nr-light.cpp b/src/display/nr-light.cpp index 72ed684b0..a3373aadb 100644 --- a/src/display/nr-light.cpp +++ b/src/display/nr-light.cpp @@ -20,7 +20,8 @@ #include "filters/pointlight.h" #include "filters/spotlight.h" -namespace NR { +namespace Inkscape { +namespace Filters { DistantLight::DistantLight(SPFeDistantLight *light, guint32 lighting_color) { color = lighting_color; @@ -30,42 +31,42 @@ DistantLight::DistantLight(SPFeDistantLight *light, guint32 lighting_color) { DistantLight::~DistantLight() {} -void DistantLight::light_vector(Fvector &v) { +void DistantLight::light_vector(NR::Fvector &v) { v[X_3D] = std::cos(azimuth)*std::cos(elevation); v[Y_3D] = std::sin(azimuth)*std::cos(elevation); v[Z_3D] = std::sin(elevation); } -void DistantLight::light_components(Fvector &lc) { +void DistantLight::light_components(NR::Fvector &lc) { lc[LIGHT_RED] = NR_RGBA32_R(color); lc[LIGHT_GREEN] = NR_RGBA32_G(color); lc[LIGHT_BLUE] = NR_RGBA32_B(color); } -PointLight::PointLight(SPFePointLight *light, guint32 lighting_color, const Matrix &trans) { +PointLight::PointLight(SPFePointLight *light, guint32 lighting_color, const Geom::Matrix &trans) { color = lighting_color; l_x = light->x; l_y = light->y; l_z = light->z; - convert_coord(l_x, l_y, l_z, trans); + NR::convert_coord(l_x, l_y, l_z, trans); } PointLight::~PointLight() {} -void PointLight::light_vector(Fvector &v, gdouble x, gdouble y, gdouble z) { +void PointLight::light_vector(NR::Fvector &v, gdouble x, gdouble y, gdouble z) { v[X_3D] = l_x - x; v[Y_3D] = l_y - y; v[Z_3D] = l_z - z; - normalize_vector(v); + NR::normalize_vector(v); } -void PointLight::light_components(Fvector &lc) { +void PointLight::light_components(NR::Fvector &lc) { lc[LIGHT_RED] = NR_RGBA32_R(color); lc[LIGHT_GREEN] = NR_RGBA32_G(color); lc[LIGHT_BLUE] = NR_RGBA32_B(color); } -SpotLight::SpotLight(SPFeSpotLight *light, guint32 lighting_color, const Matrix &trans) { +SpotLight::SpotLight(SPFeSpotLight *light, guint32 lighting_color, const Geom::Matrix &trans) { gdouble p_x, p_y, p_z; color = lighting_color; l_x = light->x; @@ -76,26 +77,26 @@ SpotLight::SpotLight(SPFeSpotLight *light, guint32 lighting_color, const Matrix p_z = light->pointsAtZ; cos_lca = std::cos(M_PI / 180 * light->limitingConeAngle); speExp = light->specularExponent; - convert_coord(l_x, l_y, l_z, trans); - convert_coord(p_x, p_y, p_z, trans); + NR::convert_coord(l_x, l_y, l_z, trans); + NR::convert_coord(p_x, p_y, p_z, trans); S[X_3D] = p_x - l_x; S[Y_3D] = p_y - l_y; S[Z_3D] = p_z - l_z; - normalize_vector(S); + NR::normalize_vector(S); } SpotLight::~SpotLight() {} -void SpotLight::light_vector(Fvector &v, gdouble x, gdouble y, gdouble z) { +void SpotLight::light_vector(NR::Fvector &v, gdouble x, gdouble y, gdouble z) { v[X_3D] = l_x - x; v[Y_3D] = l_y - y; v[Z_3D] = l_z - z; - normalize_vector(v); + NR::normalize_vector(v); } -void SpotLight::light_components(Fvector &lc, const Fvector &L) { - gdouble spmod = (-1) * scalar_product(L, S); +void SpotLight::light_components(NR::Fvector &lc, const NR::Fvector &L) { + gdouble spmod = (-1) * NR::scalar_product(L, S); if (spmod <= cos_lca) spmod = 0; else @@ -105,7 +106,8 @@ void SpotLight::light_components(Fvector &lc, const Fvector &L) { lc[LIGHT_BLUE] = spmod * NR_RGBA32_B(color); } -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ /* Local Variables: diff --git a/src/display/nr-light.h b/src/display/nr-light.h index 6c73a0a68..e1870f176 100644 --- a/src/display/nr-light.h +++ b/src/display/nr-light.h @@ -11,14 +11,14 @@ #include #include "display/nr-3dutils.h" #include "display/nr-light-types.h" +#include <2geom/forward.h> struct SPFeDistantLight; struct SPFePointLight; struct SPFeSpotLight; -namespace NR { - -struct Matrix; +namespace Inkscape { +namespace Filters { enum LightComponent { LIGHT_RED = 0, @@ -42,14 +42,14 @@ class DistantLight { * * \param v a Fvector referece where we store the result */ - void light_vector(Fvector &v); + void light_vector(NR::Fvector &v); /** * Computes the light components of the distant light * * \param lc a Fvector referece where we store the result, X=R, Y=G, Z=B */ - void light_components(Fvector &lc); + void light_components(NR::Fvector &lc); private: guint32 color; @@ -68,7 +68,7 @@ class PointLight { * employed in the sp light object) and current coordinate (those * employed in the rendering) */ - PointLight(SPFePointLight *light, guint32 lighting_color, const Matrix &trans); + PointLight(SPFePointLight *light, guint32 lighting_color, const Geom::Matrix &trans); virtual ~PointLight(); /** * Computes the light vector of the distant light at point (x,y,z). @@ -80,14 +80,14 @@ class PointLight { * \param y y coordinate of the current point * \param z z coordinate of the current point */ - void light_vector(Fvector &v, gdouble x, gdouble y, gdouble z); + void light_vector(NR::Fvector &v, gdouble x, gdouble y, gdouble z); /** * Computes the light components of the distant light * * \param lc a Fvector referece where we store the result, X=R, Y=G, Z=B */ - void light_components(Fvector &lc); + void light_components(NR::Fvector &lc); private: guint32 color; @@ -108,7 +108,7 @@ class SpotLight { * employed in the sp light object) and current coordinate (those * employed in the rendering) */ - SpotLight(SPFeSpotLight *light, guint32 lighting_color, const Matrix &trans); + SpotLight(SPFeSpotLight *light, guint32 lighting_color, const Geom::Matrix &trans); virtual ~SpotLight(); /** @@ -121,7 +121,7 @@ class SpotLight { * \param y y coordinate of the current point * \param z z coordinate of the current point */ - void light_vector(Fvector &v, gdouble x, gdouble y, gdouble z); + void light_vector(NR::Fvector &v, gdouble x, gdouble y, gdouble z); /** * Computes the light components of the distant light at the current @@ -130,7 +130,7 @@ class SpotLight { * \param lc a Fvector referece where we store the result, X=R, Y=G, Z=B * \param L the light vector of the current point */ - void light_components(Fvector &lc, const Fvector &L); + void light_components(NR::Fvector &lc, const NR::Fvector &L); private: guint32 color; @@ -140,12 +140,13 @@ class SpotLight { gdouble l_z; gdouble cos_lca; //cos of the limiting cone angle gdouble speExp; //specular exponent; - Fvector S; //unit vector from light position in the direction + NR::Fvector S; //unit vector from light position in the direction //the spot point at }; -} /* namespace NR */ +} /* namespace Filters */ +} /* namespace Inkscape */ #endif // __NR_LIGHT_H__ /* diff --git a/src/display/pixblock-scaler.cpp b/src/display/pixblock-scaler.cpp index 39c82daf6..511104c43 100644 --- a/src/display/pixblock-scaler.cpp +++ b/src/display/pixblock-scaler.cpp @@ -181,6 +181,8 @@ static void scale_bicubic_rgba(NRPixBlock *to, NRPixBlock *from) _check_index(to, to_y * to->rs + to_x * 4, __LINE__); + using Inkscape::Filters::clamp; + using Inkscape::Filters::clamp_alpha; if (to->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) { /* Clamp the colour channels to range from 0 to result.a to * make sure, we don't exceed 100% per colour channel with @@ -268,7 +270,7 @@ void scale_bicubic_alpha(NRPixBlock *to, NRPixBlock *from) _check_index(to, to_y * to->rs + to_x, __LINE__); - NR_PIXBLOCK_PX(to)[to_y * to->rs + to_x] = clamp(result); + NR_PIXBLOCK_PX(to)[to_y * to->rs + to_x] = Inkscape::Filters::clamp(result); } } } diff --git a/src/display/pixblock-transform.cpp b/src/display/pixblock-transform.cpp index daf27582a..d0ba89806 100644 --- a/src/display/pixblock-transform.cpp +++ b/src/display/pixblock-transform.cpp @@ -249,6 +249,8 @@ void transform_bicubic(NRPixBlock *to, NRPixBlock *from, Geom::Matrix const &tra result.a = samplex(line[0].a, line[1].a, line[2].a, line[3].a, from_x); + using Inkscape::Filters::clamp; + using Inkscape::Filters::clamp_alpha; _check_index(to, to_y * to->rs + to_x * 4, __LINE__); if (to->mode == NR_PIXBLOCK_MODE_R8G8B8A8P) { /* Make sure, none of the RGB channels exceeds 100% intensity diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 5a3015aef..78ddbb6bd 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -214,12 +214,13 @@ Inkscape::XML::Node *SvgBuilder::getContainer() { } static gchar *svgConvertRGBToText(double r, double g, double b) { + using Inkscape::Filters::clamp; static gchar tmp[1023] = {0}; snprintf(tmp, 1023, "#%02x%02x%02x", - NR::clamp(SP_COLOR_F_TO_U(r)), - NR::clamp(SP_COLOR_F_TO_U(g)), - NR::clamp(SP_COLOR_F_TO_U(b))); + clamp(SP_COLOR_F_TO_U(r)), + clamp(SP_COLOR_F_TO_U(g)), + clamp(SP_COLOR_F_TO_U(b))); return (gchar *)&tmp; } diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index f6dc8d01b..363663ac3 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -115,7 +115,7 @@ SPFilter *new_filter(SPDocument *document) } SPFilterPrimitive * -filter_add_primitive(SPFilter *filter, const NR::FilterPrimitiveType type) +filter_add_primitive(SPFilter *filter, const Inkscape::Filters::FilterPrimitiveType type) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(filter->document); @@ -125,43 +125,43 @@ filter_add_primitive(SPFilter *filter, const NR::FilterPrimitiveType type) // set default values switch(type) { - case NR::NR_FILTER_BLEND: + case Inkscape::Filters::NR_FILTER_BLEND: repr->setAttribute("blend", "normal"); break; - case NR::NR_FILTER_COLORMATRIX: + case Inkscape::Filters::NR_FILTER_COLORMATRIX: break; - case NR::NR_FILTER_COMPONENTTRANSFER: + case Inkscape::Filters::NR_FILTER_COMPONENTTRANSFER: break; - case NR::NR_FILTER_COMPOSITE: + case Inkscape::Filters::NR_FILTER_COMPOSITE: break; - case NR::NR_FILTER_CONVOLVEMATRIX: + case Inkscape::Filters::NR_FILTER_CONVOLVEMATRIX: repr->setAttribute("order", "3 3"); repr->setAttribute("kernelMatrix", "0 0 0 0 0 0 0 0 0"); break; - case NR::NR_FILTER_DIFFUSELIGHTING: + case Inkscape::Filters::NR_FILTER_DIFFUSELIGHTING: break; - case NR::NR_FILTER_DISPLACEMENTMAP: + case Inkscape::Filters::NR_FILTER_DISPLACEMENTMAP: break; - case NR::NR_FILTER_FLOOD: + case Inkscape::Filters::NR_FILTER_FLOOD: break; - case NR::NR_FILTER_GAUSSIANBLUR: + case Inkscape::Filters::NR_FILTER_GAUSSIANBLUR: repr->setAttribute("stdDeviation", "1"); break; - case NR::NR_FILTER_IMAGE: + case Inkscape::Filters::NR_FILTER_IMAGE: break; - case NR::NR_FILTER_MERGE: + case Inkscape::Filters::NR_FILTER_MERGE: break; - case NR::NR_FILTER_MORPHOLOGY: + case Inkscape::Filters::NR_FILTER_MORPHOLOGY: break; - case NR::NR_FILTER_OFFSET: + case Inkscape::Filters::NR_FILTER_OFFSET: repr->setAttribute("dx", "0"); repr->setAttribute("dy", "0"); break; - case NR::NR_FILTER_SPECULARLIGHTING: + case Inkscape::Filters::NR_FILTER_SPECULARLIGHTING: break; - case NR::NR_FILTER_TILE: + case Inkscape::Filters::NR_FILTER_TILE: break; - case NR::NR_FILTER_TURBULENCE: + case Inkscape::Filters::NR_FILTER_TURBULENCE: break; default: break; diff --git a/src/filter-chemistry.h b/src/filter-chemistry.h index 219f79c8c..1b18ec11a 100644 --- a/src/filter-chemistry.h +++ b/src/filter-chemistry.h @@ -17,7 +17,7 @@ #include "forward.h" #include "sp-filter.h" -SPFilterPrimitive *filter_add_primitive(SPFilter *filter, NR::FilterPrimitiveType); +SPFilterPrimitive *filter_add_primitive(SPFilter *filter, Inkscape::Filters::FilterPrimitiveType); SPFilter *new_filter (SPDocument *document); SPFilter *new_filter_gaussian_blur (SPDocument *document, gdouble stdDeviation, double expansion, double expansionX, double expansionY, double width, double height); SPFilter *new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mode, gdouble stdDeviation); diff --git a/src/filter-enums.cpp b/src/filter-enums.cpp index 45a1c4c72..0e41405c6 100644 --- a/src/filter-enums.cpp +++ b/src/filter-enums.cpp @@ -16,25 +16,25 @@ using Inkscape::Util::EnumData; using Inkscape::Util::EnumDataConverter; -const EnumData FPData[NR::NR_FILTER_ENDPRIMITIVETYPE] = { - {NR::NR_FILTER_BLEND, _("Blend"), "svg:feBlend"}, - {NR::NR_FILTER_COLORMATRIX, _("Color Matrix"), "svg:feColorMatrix"}, - {NR::NR_FILTER_COMPONENTTRANSFER, _("Component Transfer"), "svg:feComponentTransfer"}, - {NR::NR_FILTER_COMPOSITE, _("Composite"), "svg:feComposite"}, - {NR::NR_FILTER_CONVOLVEMATRIX, _("Convolve Matrix"), "svg:feConvolveMatrix"}, - {NR::NR_FILTER_DIFFUSELIGHTING, _("Diffuse Lighting"), "svg:feDiffuseLighting"}, - {NR::NR_FILTER_DISPLACEMENTMAP, _("Displacement Map"), "svg:feDisplacementMap"}, - {NR::NR_FILTER_FLOOD, _("Flood"), "svg:feFlood"}, - {NR::NR_FILTER_GAUSSIANBLUR, _("Gaussian Blur"), "svg:feGaussianBlur"}, - {NR::NR_FILTER_IMAGE, _("Image"), "svg:feImage"}, - {NR::NR_FILTER_MERGE, _("Merge"), "svg:feMerge"}, - {NR::NR_FILTER_MORPHOLOGY, _("Morphology"), "svg:feMorphology"}, - {NR::NR_FILTER_OFFSET, _("Offset"), "svg:feOffset"}, - {NR::NR_FILTER_SPECULARLIGHTING, _("Specular Lighting"), "svg:feSpecularLighting"}, - {NR::NR_FILTER_TILE, _("Tile"), "svg:feTile"}, - {NR::NR_FILTER_TURBULENCE, _("Turbulence"), "svg:feTurbulence"} +const EnumData FPData[Inkscape::Filters::NR_FILTER_ENDPRIMITIVETYPE] = { + {Inkscape::Filters::NR_FILTER_BLEND, _("Blend"), "svg:feBlend"}, + {Inkscape::Filters::NR_FILTER_COLORMATRIX, _("Color Matrix"), "svg:feColorMatrix"}, + {Inkscape::Filters::NR_FILTER_COMPONENTTRANSFER, _("Component Transfer"), "svg:feComponentTransfer"}, + {Inkscape::Filters::NR_FILTER_COMPOSITE, _("Composite"), "svg:feComposite"}, + {Inkscape::Filters::NR_FILTER_CONVOLVEMATRIX, _("Convolve Matrix"), "svg:feConvolveMatrix"}, + {Inkscape::Filters::NR_FILTER_DIFFUSELIGHTING, _("Diffuse Lighting"), "svg:feDiffuseLighting"}, + {Inkscape::Filters::NR_FILTER_DISPLACEMENTMAP, _("Displacement Map"), "svg:feDisplacementMap"}, + {Inkscape::Filters::NR_FILTER_FLOOD, _("Flood"), "svg:feFlood"}, + {Inkscape::Filters::NR_FILTER_GAUSSIANBLUR, _("Gaussian Blur"), "svg:feGaussianBlur"}, + {Inkscape::Filters::NR_FILTER_IMAGE, _("Image"), "svg:feImage"}, + {Inkscape::Filters::NR_FILTER_MERGE, _("Merge"), "svg:feMerge"}, + {Inkscape::Filters::NR_FILTER_MORPHOLOGY, _("Morphology"), "svg:feMorphology"}, + {Inkscape::Filters::NR_FILTER_OFFSET, _("Offset"), "svg:feOffset"}, + {Inkscape::Filters::NR_FILTER_SPECULARLIGHTING, _("Specular Lighting"), "svg:feSpecularLighting"}, + {Inkscape::Filters::NR_FILTER_TILE, _("Tile"), "svg:feTile"}, + {Inkscape::Filters::NR_FILTER_TURBULENCE, _("Turbulence"), "svg:feTurbulence"} }; -const EnumDataConverter FPConverter(FPData, NR::NR_FILTER_ENDPRIMITIVETYPE); +const EnumDataConverter FPConverter(FPData, Inkscape::Filters::NR_FILTER_ENDPRIMITIVETYPE); const EnumData FPInputData[FPINPUT_END] = { {FPINPUT_SOURCEGRAPHIC, _("Source Graphic"), "SourceGraphic"}, @@ -47,24 +47,24 @@ const EnumData FPInputData[FPINPUT_END] = { const EnumDataConverter FPInputConverter(FPInputData, FPINPUT_END); // feBlend -const EnumData BlendModeData[NR::BLEND_ENDMODE] = { +const EnumData BlendModeData[Inkscape::Filters::BLEND_ENDMODE] = { //TRANSLATORS: This is a context string, only put the word "Normal" in your translation - {NR::BLEND_NORMAL, Q_("filterBlendMode|Normal"), "normal"}, - {NR::BLEND_MULTIPLY, _("Multiply"), "multiply"}, - {NR::BLEND_SCREEN, _("Screen"), "screen"}, - {NR::BLEND_DARKEN, _("Darken"), "darken"}, - {NR::BLEND_LIGHTEN, _("Lighten"), "lighten"} + {Inkscape::Filters::BLEND_NORMAL, Q_("filterBlendMode|Normal"), "normal"}, + {Inkscape::Filters::BLEND_MULTIPLY, _("Multiply"), "multiply"}, + {Inkscape::Filters::BLEND_SCREEN, _("Screen"), "screen"}, + {Inkscape::Filters::BLEND_DARKEN, _("Darken"), "darken"}, + {Inkscape::Filters::BLEND_LIGHTEN, _("Lighten"), "lighten"} }; -const EnumDataConverter BlendModeConverter(BlendModeData, NR::BLEND_ENDMODE); +const EnumDataConverter BlendModeConverter(BlendModeData, Inkscape::Filters::BLEND_ENDMODE); -const EnumData ColorMatrixTypeData[NR::COLORMATRIX_ENDTYPE] = { - {NR::COLORMATRIX_MATRIX, _("Matrix"), "matrix"}, - {NR::COLORMATRIX_SATURATE, _("Saturate"), "saturate"}, - {NR::COLORMATRIX_HUEROTATE, _("Hue Rotate"), "hueRotate"}, - {NR::COLORMATRIX_LUMINANCETOALPHA, _("Luminance to Alpha"), "luminanceToAlpha"} +const EnumData ColorMatrixTypeData[Inkscape::Filters::COLORMATRIX_ENDTYPE] = { + {Inkscape::Filters::COLORMATRIX_MATRIX, _("Matrix"), "matrix"}, + {Inkscape::Filters::COLORMATRIX_SATURATE, _("Saturate"), "saturate"}, + {Inkscape::Filters::COLORMATRIX_HUEROTATE, _("Hue Rotate"), "hueRotate"}, + {Inkscape::Filters::COLORMATRIX_LUMINANCETOALPHA, _("Luminance to Alpha"), "luminanceToAlpha"} }; -const EnumDataConverter ColorMatrixTypeConverter(ColorMatrixTypeData, NR::COLORMATRIX_ENDTYPE); +const EnumDataConverter ColorMatrixTypeConverter(ColorMatrixTypeData, Inkscape::Filters::COLORMATRIX_ENDTYPE); // feComposite const EnumData CompositeOperatorData[COMPOSITE_ENDOPERATOR] = { @@ -79,22 +79,22 @@ const EnumData CompositeOperatorData[COMPOSITE_ENDOPERATOR] const EnumDataConverter CompositeOperatorConverter(CompositeOperatorData, COMPOSITE_ENDOPERATOR); // feComponentTransfer -const EnumData ComponentTransferTypeData[NR::COMPONENTTRANSFER_TYPE_ERROR] = { - {NR::COMPONENTTRANSFER_TYPE_IDENTITY, _("Identity"), "identity"}, - {NR::COMPONENTTRANSFER_TYPE_TABLE, _("Table"), "table"}, - {NR::COMPONENTTRANSFER_TYPE_DISCRETE, _("Discrete"), "discrete"}, - {NR::COMPONENTTRANSFER_TYPE_LINEAR, _("Linear"), "linear"}, - {NR::COMPONENTTRANSFER_TYPE_GAMMA, _("Gamma"), "gamma"}, +const EnumData ComponentTransferTypeData[Inkscape::Filters::COMPONENTTRANSFER_TYPE_ERROR] = { + {Inkscape::Filters::COMPONENTTRANSFER_TYPE_IDENTITY, _("Identity"), "identity"}, + {Inkscape::Filters::COMPONENTTRANSFER_TYPE_TABLE, _("Table"), "table"}, + {Inkscape::Filters::COMPONENTTRANSFER_TYPE_DISCRETE, _("Discrete"), "discrete"}, + {Inkscape::Filters::COMPONENTTRANSFER_TYPE_LINEAR, _("Linear"), "linear"}, + {Inkscape::Filters::COMPONENTTRANSFER_TYPE_GAMMA, _("Gamma"), "gamma"}, }; -const EnumDataConverter ComponentTransferTypeConverter(ComponentTransferTypeData, NR::COMPONENTTRANSFER_TYPE_ERROR); +const EnumDataConverter ComponentTransferTypeConverter(ComponentTransferTypeData, Inkscape::Filters::COMPONENTTRANSFER_TYPE_ERROR); // feConvolveMatrix -const EnumData ConvolveMatrixEdgeModeData[NR::CONVOLVEMATRIX_EDGEMODE_ENDTYPE] = { - {NR::CONVOLVEMATRIX_EDGEMODE_DUPLICATE, _("Duplicate"), "duplicate"}, - {NR::CONVOLVEMATRIX_EDGEMODE_WRAP, _("Wrap"), "wrap"}, - {NR::CONVOLVEMATRIX_EDGEMODE_NONE, _("None"), "none"} +const EnumData ConvolveMatrixEdgeModeData[Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_ENDTYPE] = { + {Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_DUPLICATE, _("Duplicate"), "duplicate"}, + {Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_WRAP, _("Wrap"), "wrap"}, + {Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_NONE, _("None"), "none"} }; -const EnumDataConverter ConvolveMatrixEdgeModeConverter(ConvolveMatrixEdgeModeData, NR::CONVOLVEMATRIX_EDGEMODE_ENDTYPE); +const EnumDataConverter ConvolveMatrixEdgeModeConverter(ConvolveMatrixEdgeModeData, Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_ENDTYPE); // feDisplacementMap const EnumData DisplacementMapChannelData[DISPLACEMENTMAP_CHANNEL_ENDTYPE] = { @@ -106,18 +106,18 @@ const EnumData DisplacementMapChannelData[ const EnumDataConverter DisplacementMapChannelConverter(DisplacementMapChannelData, DISPLACEMENTMAP_CHANNEL_ENDTYPE); // feMorphology -const EnumData MorphologyOperatorData[NR::MORPHOLOGY_OPERATOR_END] = { - {NR::MORPHOLOGY_OPERATOR_ERODE, _("Erode"), "erode"}, - {NR::MORPHOLOGY_OPERATOR_DILATE, _("Dilate"), "dilate"} +const EnumData MorphologyOperatorData[Inkscape::Filters::MORPHOLOGY_OPERATOR_END] = { + {Inkscape::Filters::MORPHOLOGY_OPERATOR_ERODE, _("Erode"), "erode"}, + {Inkscape::Filters::MORPHOLOGY_OPERATOR_DILATE, _("Dilate"), "dilate"} }; -const EnumDataConverter MorphologyOperatorConverter(MorphologyOperatorData, NR::MORPHOLOGY_OPERATOR_END); +const EnumDataConverter MorphologyOperatorConverter(MorphologyOperatorData, Inkscape::Filters::MORPHOLOGY_OPERATOR_END); // feTurbulence -const EnumData TurbulenceTypeData[NR::TURBULENCE_ENDTYPE] = { - {NR::TURBULENCE_FRACTALNOISE, _("Fractal Noise"), "fractalNoise"}, - {NR::TURBULENCE_TURBULENCE, _("Turbulence"), "turbulence"} +const EnumData TurbulenceTypeData[Inkscape::Filters::TURBULENCE_ENDTYPE] = { + {Inkscape::Filters::TURBULENCE_FRACTALNOISE, _("Fractal Noise"), "fractalNoise"}, + {Inkscape::Filters::TURBULENCE_TURBULENCE, _("Turbulence"), "turbulence"} }; -const EnumDataConverter TurbulenceTypeConverter(TurbulenceTypeData, NR::TURBULENCE_ENDTYPE); +const EnumDataConverter TurbulenceTypeConverter(TurbulenceTypeData, Inkscape::Filters::TURBULENCE_ENDTYPE); // Light source const EnumData LightSourceData[LIGHT_ENDSOURCE] = { diff --git a/src/filter-enums.h b/src/filter-enums.h index 815d439c1..6367a5102 100644 --- a/src/filter-enums.h +++ b/src/filter-enums.h @@ -24,8 +24,8 @@ #include "util/enums.h" // Filter primitives -extern const Inkscape::Util::EnumData FPData[NR::NR_FILTER_ENDPRIMITIVETYPE]; -extern const Inkscape::Util::EnumDataConverter FPConverter; +extern const Inkscape::Util::EnumData FPData[Inkscape::Filters::NR_FILTER_ENDPRIMITIVETYPE]; +extern const Inkscape::Util::EnumDataConverter FPConverter; enum FilterPrimitiveInput { FPINPUT_SOURCEGRAPHIC, @@ -41,29 +41,29 @@ extern const Inkscape::Util::EnumData FPInputData[FPINPUT_ extern const Inkscape::Util::EnumDataConverter FPInputConverter; // Blend mode -extern const Inkscape::Util::EnumData BlendModeData[NR::BLEND_ENDMODE]; -extern const Inkscape::Util::EnumDataConverter BlendModeConverter; +extern const Inkscape::Util::EnumData BlendModeData[Inkscape::Filters::BLEND_ENDMODE]; +extern const Inkscape::Util::EnumDataConverter BlendModeConverter; // ColorMatrix type -extern const Inkscape::Util::EnumData ColorMatrixTypeData[NR::COLORMATRIX_ENDTYPE]; -extern const Inkscape::Util::EnumDataConverter ColorMatrixTypeConverter; +extern const Inkscape::Util::EnumData ColorMatrixTypeData[Inkscape::Filters::COLORMATRIX_ENDTYPE]; +extern const Inkscape::Util::EnumDataConverter ColorMatrixTypeConverter; // ComponentTransfer type -extern const Inkscape::Util::EnumData ComponentTransferTypeData[NR::COMPONENTTRANSFER_TYPE_ERROR]; -extern const Inkscape::Util::EnumDataConverter ComponentTransferTypeConverter; +extern const Inkscape::Util::EnumData ComponentTransferTypeData[Inkscape::Filters::COMPONENTTRANSFER_TYPE_ERROR]; +extern const Inkscape::Util::EnumDataConverter ComponentTransferTypeConverter; // Composite operator extern const Inkscape::Util::EnumData CompositeOperatorData[COMPOSITE_ENDOPERATOR]; extern const Inkscape::Util::EnumDataConverter CompositeOperatorConverter; // ConvolveMatrix edgeMode -extern const Inkscape::Util::EnumData ConvolveMatrixEdgeModeData[NR::CONVOLVEMATRIX_EDGEMODE_ENDTYPE]; -extern const Inkscape::Util::EnumDataConverter ConvolveMatrixEdgeModeConverter; +extern const Inkscape::Util::EnumData ConvolveMatrixEdgeModeData[Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_ENDTYPE]; +extern const Inkscape::Util::EnumDataConverter ConvolveMatrixEdgeModeConverter; // DisplacementMap channel extern const Inkscape::Util::EnumData DisplacementMapChannelData[4]; extern const Inkscape::Util::EnumDataConverter DisplacementMapChannelConverter; // Morphology operator -extern const Inkscape::Util::EnumData MorphologyOperatorData[NR::MORPHOLOGY_OPERATOR_END]; -extern const Inkscape::Util::EnumDataConverter MorphologyOperatorConverter; +extern const Inkscape::Util::EnumData MorphologyOperatorData[Inkscape::Filters::MORPHOLOGY_OPERATOR_END]; +extern const Inkscape::Util::EnumDataConverter MorphologyOperatorConverter; // Turbulence type -extern const Inkscape::Util::EnumData TurbulenceTypeData[NR::TURBULENCE_ENDTYPE]; -extern const Inkscape::Util::EnumDataConverter TurbulenceTypeConverter; +extern const Inkscape::Util::EnumData TurbulenceTypeData[Inkscape::Filters::TURBULENCE_ENDTYPE]; +extern const Inkscape::Util::EnumDataConverter TurbulenceTypeConverter; // Lighting enum LightSource { LIGHT_DISTANT, diff --git a/src/filters/blend.cpp b/src/filters/blend.cpp index 8c2d7978e..709130ada 100644 --- a/src/filters/blend.cpp +++ b/src/filters/blend.cpp @@ -40,7 +40,7 @@ static void sp_feBlend_release(SPObject *object); static void sp_feBlend_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feBlend_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feBlend_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feBlend_build_renderer(SPFilterPrimitive *sp_prim, NR::Filter *filter); +static void sp_feBlend_build_renderer(SPFilterPrimitive *sp_prim, Inkscape::Filters::Filter *filter); static SPFilterPrimitiveClass *feBlend_parent_class; @@ -85,7 +85,7 @@ sp_feBlend_class_init(SPFeBlendClass *klass) static void sp_feBlend_init(SPFeBlend *feBlend) { - feBlend->in2 = NR::NR_FILTER_SLOT_NOT_SET; + feBlend->in2 = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET; } /** @@ -115,35 +115,35 @@ sp_feBlend_release(SPObject *object) ((SPObjectClass *) feBlend_parent_class)->release(object); } -static NR::FilterBlendMode sp_feBlend_readmode(gchar const *value) +static Inkscape::Filters::FilterBlendMode sp_feBlend_readmode(gchar const *value) { - if (!value) return NR::BLEND_NORMAL; + if (!value) return Inkscape::Filters::BLEND_NORMAL; switch (value[0]) { case 'n': if (strncmp(value, "normal", 6) == 0) - return NR::BLEND_NORMAL; + return Inkscape::Filters::BLEND_NORMAL; break; case 'm': if (strncmp(value, "multiply", 8) == 0) - return NR::BLEND_MULTIPLY; + return Inkscape::Filters::BLEND_MULTIPLY; break; case 's': if (strncmp(value, "screen", 6) == 0) - return NR::BLEND_SCREEN; + return Inkscape::Filters::BLEND_SCREEN; break; case 'd': if (strncmp(value, "darken", 6) == 0) - return NR::BLEND_DARKEN; + return Inkscape::Filters::BLEND_DARKEN; break; case 'l': if (strncmp(value, "lighten", 7) == 0) - return NR::BLEND_LIGHTEN; + return Inkscape::Filters::BLEND_LIGHTEN; break; default: // do nothing by default break; } - return NR::BLEND_NORMAL; + return Inkscape::Filters::BLEND_NORMAL; } /** @@ -155,7 +155,7 @@ sp_feBlend_set(SPObject *object, unsigned int key, gchar const *value) SPFeBlend *feBlend = SP_FEBLEND(object); (void)feBlend; - NR::FilterBlendMode mode; + Inkscape::Filters::FilterBlendMode mode; int input; switch(key) { /*DEAL WITH SETTING ATTRIBUTES HERE*/ @@ -220,15 +220,15 @@ sp_feBlend_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML:: return repr; } -static void sp_feBlend_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feBlend_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeBlend *sp_blend = SP_FEBLEND(primitive); - int primitive_n = filter->add_primitive(NR::NR_FILTER_BLEND); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterBlend *nr_blend = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_BLEND); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterBlend *nr_blend = dynamic_cast(nr_primitive); g_assert(nr_blend != NULL); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/filters/blend.h b/src/filters/blend.h index bcb95c3c2..9f3cab475 100644 --- a/src/filters/blend.h +++ b/src/filters/blend.h @@ -24,7 +24,7 @@ class SPFeBlendClass; struct SPFeBlend : public SPFilterPrimitive { /** BLEND ATTRIBUTES HERE */ - NR::FilterBlendMode blend_mode; + Inkscape::Filters::FilterBlendMode blend_mode; int in2; }; diff --git a/src/filters/colormatrix.cpp b/src/filters/colormatrix.cpp index 29c2458e8..a6096bdb6 100644 --- a/src/filters/colormatrix.cpp +++ b/src/filters/colormatrix.cpp @@ -39,7 +39,7 @@ static void sp_feColorMatrix_release(SPObject *object); static void sp_feColorMatrix_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feColorMatrix_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feColorMatrix_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feColorMatrix_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feColorMatrix_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static SPFilterPrimitiveClass *feColorMatrix_parent_class; @@ -112,23 +112,23 @@ sp_feColorMatrix_release(SPObject *object) ((SPObjectClass *) feColorMatrix_parent_class)->release(object); } -static NR::FilterColorMatrixType sp_feColorMatrix_read_type(gchar const *value){ - if (!value) return NR::COLORMATRIX_MATRIX; //matrix is default +static Inkscape::Filters::FilterColorMatrixType sp_feColorMatrix_read_type(gchar const *value){ + if (!value) return Inkscape::Filters::COLORMATRIX_MATRIX; //matrix is default switch(value[0]){ case 'm': - if (strcmp(value, "matrix") == 0) return NR::COLORMATRIX_MATRIX; + if (strcmp(value, "matrix") == 0) return Inkscape::Filters::COLORMATRIX_MATRIX; break; case 's': - if (strcmp(value, "saturate") == 0) return NR::COLORMATRIX_SATURATE; + if (strcmp(value, "saturate") == 0) return Inkscape::Filters::COLORMATRIX_SATURATE; break; case 'h': - if (strcmp(value, "hueRotate") == 0) return NR::COLORMATRIX_HUEROTATE; + if (strcmp(value, "hueRotate") == 0) return Inkscape::Filters::COLORMATRIX_HUEROTATE; break; case 'l': - if (strcmp(value, "luminanceToAlpha") == 0) return NR::COLORMATRIX_LUMINANCETOALPHA; + if (strcmp(value, "luminanceToAlpha") == 0) return Inkscape::Filters::COLORMATRIX_LUMINANCETOALPHA; break; } - return NR::COLORMATRIX_MATRIX; //matrix is default + return Inkscape::Filters::COLORMATRIX_MATRIX; //matrix is default } /** @@ -140,7 +140,7 @@ sp_feColorMatrix_set(SPObject *object, unsigned int key, gchar const *str) SPFeColorMatrix *feColorMatrix = SP_FECOLORMATRIX(object); (void)feColorMatrix; - NR::FilterColorMatrixType read_type; + Inkscape::Filters::FilterColorMatrixType read_type; /*DEAL WITH SETTING ATTRIBUTES HERE*/ switch(key) { case SP_ATTR_TYPE: @@ -205,15 +205,15 @@ sp_feColorMatrix_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape: return repr; } -static void sp_feColorMatrix_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feColorMatrix_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeColorMatrix *sp_colormatrix = SP_FECOLORMATRIX(primitive); - int primitive_n = filter->add_primitive(NR::NR_FILTER_COLORMATRIX); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterColorMatrix *nr_colormatrix = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_COLORMATRIX); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterColorMatrix *nr_colormatrix = dynamic_cast(nr_primitive); g_assert(nr_colormatrix != NULL); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/filters/colormatrix.h b/src/filters/colormatrix.h index 4b9eda1a7..69be96928 100644 --- a/src/filters/colormatrix.h +++ b/src/filters/colormatrix.h @@ -23,7 +23,7 @@ class SPFeColorMatrixClass; struct SPFeColorMatrix : public SPFilterPrimitive { /** COLORMATRIX ATTRIBUTES HERE */ - NR::FilterColorMatrixType type; + Inkscape::Filters::FilterColorMatrixType type; gdouble value; std::vector values; }; diff --git a/src/filters/componenttransfer-funcnode.cpp b/src/filters/componenttransfer-funcnode.cpp index 72a4e8744..a83dda1bb 100644 --- a/src/filters/componenttransfer-funcnode.cpp +++ b/src/filters/componenttransfer-funcnode.cpp @@ -146,7 +146,7 @@ sp_fefuncnode_class_init(SPFeFuncNodeClass *klass) static void sp_fefuncnode_init(SPFeFuncNode *fefuncnode) { - fefuncnode->type = NR::COMPONENTTRANSFER_TYPE_IDENTITY; + fefuncnode->type = Inkscape::Filters::COMPONENTTRANSFER_TYPE_IDENTITY; //fefuncnode->tableValues = NULL; fefuncnode->slope = 1; fefuncnode->intercept = 0; @@ -197,26 +197,26 @@ sp_fefuncnode_release(SPObject *object) //TODO: release resources here } -static NR::FilterComponentTransferType sp_feComponenttransfer_read_type(gchar const *value){ - if (!value) return NR::COMPONENTTRANSFER_TYPE_ERROR; //type attribute is REQUIRED. +static Inkscape::Filters::FilterComponentTransferType sp_feComponenttransfer_read_type(gchar const *value){ + if (!value) return Inkscape::Filters::COMPONENTTRANSFER_TYPE_ERROR; //type attribute is REQUIRED. switch(value[0]){ case 'i': - if (strncmp(value, "identity", 8) == 0) return NR::COMPONENTTRANSFER_TYPE_IDENTITY; + if (strncmp(value, "identity", 8) == 0) return Inkscape::Filters::COMPONENTTRANSFER_TYPE_IDENTITY; break; case 't': - if (strncmp(value, "table", 5) == 0) return NR::COMPONENTTRANSFER_TYPE_TABLE; + if (strncmp(value, "table", 5) == 0) return Inkscape::Filters::COMPONENTTRANSFER_TYPE_TABLE; break; case 'd': - if (strncmp(value, "discrete", 8) == 0) return NR::COMPONENTTRANSFER_TYPE_DISCRETE; + if (strncmp(value, "discrete", 8) == 0) return Inkscape::Filters::COMPONENTTRANSFER_TYPE_DISCRETE; break; case 'l': - if (strncmp(value, "linear", 6) == 0) return NR::COMPONENTTRANSFER_TYPE_LINEAR; + if (strncmp(value, "linear", 6) == 0) return Inkscape::Filters::COMPONENTTRANSFER_TYPE_LINEAR; break; case 'g': - if (strncmp(value, "gamma", 5) == 0) return NR::COMPONENTTRANSFER_TYPE_GAMMA; + if (strncmp(value, "gamma", 5) == 0) return Inkscape::Filters::COMPONENTTRANSFER_TYPE_GAMMA; break; } - return NR::COMPONENTTRANSFER_TYPE_ERROR; //type attribute is REQUIRED. + return Inkscape::Filters::COMPONENTTRANSFER_TYPE_ERROR; //type attribute is REQUIRED. } /** @@ -226,7 +226,7 @@ static void sp_fefuncnode_set(SPObject *object, unsigned int key, gchar const *value) { SPFeFuncNode *feFuncNode = SP_FEFUNCNODE(object); - NR::FilterComponentTransferType type; + Inkscape::Filters::FilterComponentTransferType type; double read_num; switch(key) { case SP_ATTR_TYPE: diff --git a/src/filters/componenttransfer-funcnode.h b/src/filters/componenttransfer-funcnode.h index 2f0b2fc28..4db6ab785 100644 --- a/src/filters/componenttransfer-funcnode.h +++ b/src/filters/componenttransfer-funcnode.h @@ -40,7 +40,7 @@ class SPFeFuncNode; class SPFeFuncNodeClass; struct SPFeFuncNode : public SPObject { - NR::FilterComponentTransferType type; + Inkscape::Filters::FilterComponentTransferType type; std::vector tableValues; double slope; double intercept; diff --git a/src/filters/componenttransfer.cpp b/src/filters/componenttransfer.cpp index 603e1f4e5..162b67703 100644 --- a/src/filters/componenttransfer.cpp +++ b/src/filters/componenttransfer.cpp @@ -36,7 +36,7 @@ static void sp_feComponentTransfer_build(SPObject *object, SPDocument *document, static void sp_feComponentTransfer_release(SPObject *object); static void sp_feComponentTransfer_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feComponentTransfer_update(SPObject *object, SPCtx *ctx, guint flags); -static void sp_feComponentTransfer_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feComponentTransfer_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static void sp_feComponentTransfer_remove_child(SPObject *object, Inkscape::XML::Node *child); static void sp_feComponentTransfer_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); static Inkscape::XML::Node *sp_feComponentTransfer_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -130,7 +130,7 @@ static void sp_feComponentTransfer_children_modified(SPFeComponentTransfer *sp_c // Set any types not explicitly set to the identity transform for(int i=0;i<4;i++) { if (!set[i]) { - sp_componenttransfer->renderer->type[i] = NR::COMPONENTTRANSFER_TYPE_IDENTITY; + sp_componenttransfer->renderer->type[i] = Inkscape::Filters::COMPONENTTRANSFER_TYPE_IDENTITY; } } } @@ -238,15 +238,15 @@ sp_feComponentTransfer_write(SPObject *object, Inkscape::XML::Document *doc, Ink return repr; } -static void sp_feComponentTransfer_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feComponentTransfer_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeComponentTransfer *sp_componenttransfer = SP_FECOMPONENTTRANSFER(primitive); - int primitive_n = filter->add_primitive(NR::NR_FILTER_COMPONENTTRANSFER); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterComponentTransfer *nr_componenttransfer = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_COMPONENTTRANSFER); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterComponentTransfer *nr_componenttransfer = dynamic_cast(nr_primitive); g_assert(nr_componenttransfer != NULL); sp_componenttransfer->renderer = nr_componenttransfer; diff --git a/src/filters/componenttransfer.h b/src/filters/componenttransfer.h index 515825d65..8281d9aea 100644 --- a/src/filters/componenttransfer.h +++ b/src/filters/componenttransfer.h @@ -24,7 +24,7 @@ class SPFeComponentTransferClass; struct SPFeComponentTransfer : public SPFilterPrimitive { /** COMPONENTTRANSFER ATTRIBUTES HERE */ - NR::FilterComponentTransfer *renderer; + Inkscape::Filters::FilterComponentTransfer *renderer; }; struct SPFeComponentTransferClass { diff --git a/src/filters/composite.cpp b/src/filters/composite.cpp index 61658ba9e..707c74854 100644 --- a/src/filters/composite.cpp +++ b/src/filters/composite.cpp @@ -34,7 +34,7 @@ static void sp_feComposite_release(SPObject *object); static void sp_feComposite_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feComposite_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feComposite_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feComposite_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feComposite_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static SPFilterPrimitiveClass *feComposite_parent_class; @@ -84,7 +84,7 @@ sp_feComposite_init(SPFeComposite *feComposite) feComposite->k2 = 0; feComposite->k3 = 0; feComposite->k4 = 0; - feComposite->in2 = NR::NR_FILTER_SLOT_NOT_SET; + feComposite->in2 = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET; } /** @@ -249,15 +249,15 @@ sp_feComposite_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::X return repr; } -static void sp_feComposite_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feComposite_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeComposite *sp_composite = SP_FECOMPOSITE(primitive); - int primitive_n = filter->add_primitive(NR::NR_FILTER_COMPOSITE); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterComposite *nr_composite = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_COMPOSITE); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterComposite *nr_composite = dynamic_cast(nr_primitive); g_assert(nr_composite != NULL); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/filters/convolvematrix.cpp b/src/filters/convolvematrix.cpp index a930bc4e7..41028fb20 100644 --- a/src/filters/convolvematrix.cpp +++ b/src/filters/convolvematrix.cpp @@ -39,7 +39,7 @@ static void sp_feConvolveMatrix_release(SPObject *object); static void sp_feConvolveMatrix_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feConvolveMatrix_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feConvolveMatrix_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feConvolveMatrix_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feConvolveMatrix_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static SPFilterPrimitiveClass *feConvolveMatrix_parent_class; @@ -88,7 +88,7 @@ sp_feConvolveMatrix_init(SPFeConvolveMatrix *feConvolveMatrix) feConvolveMatrix->order.set("3 3"); feConvolveMatrix->targetX = 1; feConvolveMatrix->targetY = 1; - feConvolveMatrix->edgeMode = NR::CONVOLVEMATRIX_EDGEMODE_DUPLICATE; + feConvolveMatrix->edgeMode = Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_DUPLICATE; feConvolveMatrix->preserveAlpha = false; //some helper variables: @@ -131,20 +131,20 @@ sp_feConvolveMatrix_release(SPObject *object) ((SPObjectClass *) feConvolveMatrix_parent_class)->release(object); } -static NR::FilterConvolveMatrixEdgeMode sp_feConvolveMatrix_read_edgeMode(gchar const *value){ - if (!value) return NR::CONVOLVEMATRIX_EDGEMODE_DUPLICATE; //duplicate is default +static Inkscape::Filters::FilterConvolveMatrixEdgeMode sp_feConvolveMatrix_read_edgeMode(gchar const *value){ + if (!value) return Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_DUPLICATE; //duplicate is default switch(value[0]){ case 'd': - if (strncmp(value, "duplicate", 9) == 0) return NR::CONVOLVEMATRIX_EDGEMODE_DUPLICATE; + if (strncmp(value, "duplicate", 9) == 0) return Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_DUPLICATE; break; case 'w': - if (strncmp(value, "wrap", 4) == 0) return NR::CONVOLVEMATRIX_EDGEMODE_WRAP; + if (strncmp(value, "wrap", 4) == 0) return Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_WRAP; break; case 'n': - if (strncmp(value, "none", 4) == 0) return NR::CONVOLVEMATRIX_EDGEMODE_NONE; + if (strncmp(value, "none", 4) == 0) return Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_NONE; break; } - return NR::CONVOLVEMATRIX_EDGEMODE_DUPLICATE; //duplicate is default + return Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_DUPLICATE; //duplicate is default } /** @@ -158,7 +158,7 @@ sp_feConvolveMatrix_set(SPObject *object, unsigned int key, gchar const *value) double read_num; int read_int; bool read_bool; - NR::FilterConvolveMatrixEdgeMode read_mode; + Inkscape::Filters::FilterConvolveMatrixEdgeMode read_mode; switch(key) { /*DEAL WITH SETTING ATTRIBUTES HERE*/ @@ -303,15 +303,15 @@ sp_feConvolveMatrix_write(SPObject *object, Inkscape::XML::Document *doc, Inksca return repr; } -static void sp_feConvolveMatrix_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feConvolveMatrix_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeConvolveMatrix *sp_convolve = SP_FECONVOLVEMATRIX(primitive); - int primitive_n = filter->add_primitive(NR::NR_FILTER_CONVOLVEMATRIX); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterConvolveMatrix *nr_convolve = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_CONVOLVEMATRIX); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterConvolveMatrix *nr_convolve = dynamic_cast(nr_primitive); g_assert(nr_convolve != NULL); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/filters/convolvematrix.h b/src/filters/convolvematrix.h index 991f63988..beb5fad75 100644 --- a/src/filters/convolvematrix.h +++ b/src/filters/convolvematrix.h @@ -29,7 +29,7 @@ struct SPFeConvolveMatrix : public SPFilterPrimitive { std::vector kernelMatrix; double divisor, bias; int targetX, targetY; - NR::FilterConvolveMatrixEdgeMode edgeMode; + Inkscape::Filters::FilterConvolveMatrixEdgeMode edgeMode; NumberOptNumber kernelUnitLength; bool preserveAlpha; //some helper variables: diff --git a/src/filters/diffuselighting.cpp b/src/filters/diffuselighting.cpp index a4935bf72..9c68006ed 100644 --- a/src/filters/diffuselighting.cpp +++ b/src/filters/diffuselighting.cpp @@ -46,7 +46,7 @@ static void sp_feDiffuseLighting_child_added(SPObject *object, static void sp_feDiffuseLighting_remove_child(SPObject *object, Inkscape::XML::Node *child); static void sp_feDiffuseLighting_order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref); static Inkscape::XML::Node *sp_feDiffuseLighting_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feDiffuseLighting_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feDiffuseLighting_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static void sp_feDiffuseLighting_children_modified(SPFeDiffuseLighting *sp_diffuselighting); static SPFilterPrimitiveClass *feDiffuseLighting_parent_class; @@ -321,31 +321,31 @@ sp_feDiffuseLighting_order_changed (SPObject *object, Inkscape::XML::Node *child static void sp_feDiffuseLighting_children_modified(SPFeDiffuseLighting *sp_diffuselighting) { if (sp_diffuselighting->renderer) { - sp_diffuselighting->renderer->light_type = NR::NO_LIGHT; + sp_diffuselighting->renderer->light_type = Inkscape::Filters::NO_LIGHT; if (SP_IS_FEDISTANTLIGHT(sp_diffuselighting->children)) { - sp_diffuselighting->renderer->light_type = NR::DISTANT_LIGHT; + sp_diffuselighting->renderer->light_type = Inkscape::Filters::DISTANT_LIGHT; sp_diffuselighting->renderer->light.distant = SP_FEDISTANTLIGHT(sp_diffuselighting->children); } if (SP_IS_FEPOINTLIGHT(sp_diffuselighting->children)) { - sp_diffuselighting->renderer->light_type = NR::POINT_LIGHT; + sp_diffuselighting->renderer->light_type = Inkscape::Filters::POINT_LIGHT; sp_diffuselighting->renderer->light.point = SP_FEPOINTLIGHT(sp_diffuselighting->children); } if (SP_IS_FESPOTLIGHT(sp_diffuselighting->children)) { - sp_diffuselighting->renderer->light_type = NR::SPOT_LIGHT; + sp_diffuselighting->renderer->light_type = Inkscape::Filters::SPOT_LIGHT; sp_diffuselighting->renderer->light.spot = SP_FESPOTLIGHT(sp_diffuselighting->children); } } } -static void sp_feDiffuseLighting_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feDiffuseLighting_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeDiffuseLighting *sp_diffuselighting = SP_FEDIFFUSELIGHTING(primitive); - int primitive_n = filter->add_primitive(NR::NR_FILTER_DIFFUSELIGHTING); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterDiffuseLighting *nr_diffuselighting = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_DIFFUSELIGHTING); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterDiffuseLighting *nr_diffuselighting = dynamic_cast(nr_primitive); g_assert(nr_diffuselighting != NULL); sp_diffuselighting->renderer = nr_diffuselighting; @@ -355,17 +355,17 @@ static void sp_feDiffuseLighting_build_renderer(SPFilterPrimitive *primitive, NR nr_diffuselighting->surfaceScale = sp_diffuselighting->surfaceScale; nr_diffuselighting->lighting_color = sp_diffuselighting->lighting_color; //We assume there is at most one child - nr_diffuselighting->light_type = NR::NO_LIGHT; + nr_diffuselighting->light_type = Inkscape::Filters::NO_LIGHT; if (SP_IS_FEDISTANTLIGHT(primitive->children)) { - nr_diffuselighting->light_type = NR::DISTANT_LIGHT; + nr_diffuselighting->light_type = Inkscape::Filters::DISTANT_LIGHT; nr_diffuselighting->light.distant = SP_FEDISTANTLIGHT(primitive->children); } if (SP_IS_FEPOINTLIGHT(primitive->children)) { - nr_diffuselighting->light_type = NR::POINT_LIGHT; + nr_diffuselighting->light_type = Inkscape::Filters::POINT_LIGHT; nr_diffuselighting->light.point = SP_FEPOINTLIGHT(primitive->children); } if (SP_IS_FESPOTLIGHT(primitive->children)) { - nr_diffuselighting->light_type = NR::SPOT_LIGHT; + nr_diffuselighting->light_type = Inkscape::Filters::SPOT_LIGHT; nr_diffuselighting->light.spot = SP_FESPOTLIGHT(primitive->children); } diff --git a/src/filters/diffuselighting.h b/src/filters/diffuselighting.h index 8e909f9ae..3c6c0ae73 100644 --- a/src/filters/diffuselighting.h +++ b/src/filters/diffuselighting.h @@ -18,9 +18,11 @@ #include "sp-filter.h" #include "diffuselighting-fns.h" -namespace NR { +namespace Inkscape { +namespace Filters { class FilterDiffuseLighting; } +} /* FeDiffuseLighting base class */ class SPFeDiffuseLightingClass; @@ -39,7 +41,7 @@ struct SPFeDiffuseLighting : public SPFilterPrimitive { guint32 lighting_color; guint lighting_color_set : 1; /** pointer to the associated renderer */ - NR::FilterDiffuseLighting *renderer; + Inkscape::Filters::FilterDiffuseLighting *renderer; }; struct SPFeDiffuseLightingClass { diff --git a/src/filters/displacementmap.cpp b/src/filters/displacementmap.cpp index 405922b46..7d4100b0e 100644 --- a/src/filters/displacementmap.cpp +++ b/src/filters/displacementmap.cpp @@ -33,7 +33,7 @@ static void sp_feDisplacementMap_build(SPObject *object, SPDocument *document, I static void sp_feDisplacementMap_release(SPObject *object); static void sp_feDisplacementMap_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feDisplacementMap_update(SPObject *object, SPCtx *ctx, guint flags); -static void sp_feDisplacementMap_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feDisplacementMap_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static Inkscape::XML::Node *sp_feDisplacementMap_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPFilterPrimitiveClass *feDisplacementMap_parent_class; @@ -81,7 +81,7 @@ sp_feDisplacementMap_init(SPFeDisplacementMap *feDisplacementMap) feDisplacementMap->scale=0; feDisplacementMap->xChannelSelector = DISPLACEMENTMAP_CHANNEL_ALPHA; feDisplacementMap->yChannelSelector = DISPLACEMENTMAP_CHANNEL_ALPHA; - feDisplacementMap->in2 = NR::NR_FILTER_SLOT_NOT_SET; + feDisplacementMap->in2 = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET; } /** @@ -227,15 +227,15 @@ sp_feDisplacementMap_write(SPObject *object, Inkscape::XML::Document *doc, Inksc return repr; } -static void sp_feDisplacementMap_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feDisplacementMap_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeDisplacementMap *sp_displacement_map = SP_FEDISPLACEMENTMAP(primitive); - int primitive_n = filter->add_primitive(NR::NR_FILTER_DISPLACEMENTMAP); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterDisplacementMap *nr_displacement_map = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_DISPLACEMENTMAP); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterDisplacementMap *nr_displacement_map = dynamic_cast(nr_primitive); g_assert(nr_displacement_map != NULL); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/filters/flood.cpp b/src/filters/flood.cpp index 31aa9559a..003d174c1 100644 --- a/src/filters/flood.cpp +++ b/src/filters/flood.cpp @@ -34,7 +34,7 @@ static void sp_feFlood_release(SPObject *object); static void sp_feFlood_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feFlood_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feFlood_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feFlood_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feFlood_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static SPFilterPrimitiveClass *feFlood_parent_class; @@ -196,16 +196,16 @@ sp_feFlood_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML:: return repr; } -static void sp_feFlood_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feFlood_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeFlood *sp_flood = SP_FEFLOOD(primitive); (void)sp_flood; - int primitive_n = filter->add_primitive(NR::NR_FILTER_FLOOD); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterFlood *nr_flood = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_FLOOD); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterFlood *nr_flood = dynamic_cast(nr_primitive); g_assert(nr_flood != NULL); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/filters/image.cpp b/src/filters/image.cpp index d132d361c..f4764577a 100644 --- a/src/filters/image.cpp +++ b/src/filters/image.cpp @@ -39,7 +39,7 @@ static void sp_feImage_release(SPObject *object); static void sp_feImage_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feImage_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feImage_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feImage_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feImage_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static SPFilterPrimitiveClass *feImage_parent_class; @@ -232,15 +232,15 @@ sp_feImage_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML:: return repr; } -static void sp_feImage_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feImage_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeImage *sp_image = SP_FEIMAGE(primitive); - int primitive_n = filter->add_primitive(NR::NR_FILTER_IMAGE); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterImage *nr_image = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_IMAGE); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterImage *nr_image = dynamic_cast(nr_primitive); g_assert(nr_image != NULL); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/filters/merge.cpp b/src/filters/merge.cpp index 079d1b19c..a1f17889d 100644 --- a/src/filters/merge.cpp +++ b/src/filters/merge.cpp @@ -35,7 +35,7 @@ static void sp_feMerge_release(SPObject *object); static void sp_feMerge_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feMerge_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feMerge_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feMerge_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feMerge_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static SPFilterPrimitiveClass *feMerge_parent_class; @@ -164,16 +164,16 @@ sp_feMerge_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML:: return repr; } -static void sp_feMerge_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feMerge_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeMerge *sp_merge = SP_FEMERGE(primitive); (void)sp_merge; - int primitive_n = filter->add_primitive(NR::NR_FILTER_MERGE); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterMerge *nr_merge = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_MERGE); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterMerge *nr_merge = dynamic_cast(nr_primitive); g_assert(nr_merge != NULL); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/filters/mergenode.cpp b/src/filters/mergenode.cpp index 1f056a25f..8a4e0dd0a 100644 --- a/src/filters/mergenode.cpp +++ b/src/filters/mergenode.cpp @@ -73,7 +73,7 @@ sp_feMergeNode_class_init(SPFeMergeNodeClass *klass) static void sp_feMergeNode_init(SPFeMergeNode *feMergeNode) { - feMergeNode->input = NR::NR_FILTER_SLOT_NOT_SET; + feMergeNode->input = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET; } /** diff --git a/src/filters/morphology.cpp b/src/filters/morphology.cpp index 927616091..679221626 100644 --- a/src/filters/morphology.cpp +++ b/src/filters/morphology.cpp @@ -36,7 +36,7 @@ static void sp_feMorphology_release(SPObject *object); static void sp_feMorphology_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feMorphology_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feMorphology_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feMorphology_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feMorphology_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static SPFilterPrimitiveClass *feMorphology_parent_class; @@ -111,17 +111,17 @@ sp_feMorphology_release(SPObject *object) ((SPObjectClass *) feMorphology_parent_class)->release(object); } -static NR::FilterMorphologyOperator sp_feMorphology_read_operator(gchar const *value){ - if (!value) return NR::MORPHOLOGY_OPERATOR_ERODE; //erode is default +static Inkscape::Filters::FilterMorphologyOperator sp_feMorphology_read_operator(gchar const *value){ + if (!value) return Inkscape::Filters::MORPHOLOGY_OPERATOR_ERODE; //erode is default switch(value[0]){ case 'e': - if (strncmp(value, "erode", 5) == 0) return NR::MORPHOLOGY_OPERATOR_ERODE; + if (strncmp(value, "erode", 5) == 0) return Inkscape::Filters::MORPHOLOGY_OPERATOR_ERODE; break; case 'd': - if (strncmp(value, "dilate", 6) == 0) return NR::MORPHOLOGY_OPERATOR_DILATE; + if (strncmp(value, "dilate", 6) == 0) return Inkscape::Filters::MORPHOLOGY_OPERATOR_DILATE; break; } - return NR::MORPHOLOGY_OPERATOR_ERODE; //erode is default + return Inkscape::Filters::MORPHOLOGY_OPERATOR_ERODE; //erode is default } /** @@ -133,7 +133,7 @@ sp_feMorphology_set(SPObject *object, unsigned int key, gchar const *value) SPFeMorphology *feMorphology = SP_FEMORPHOLOGY(object); (void)feMorphology; - NR::FilterMorphologyOperator read_operator; + Inkscape::Filters::FilterMorphologyOperator read_operator; switch(key) { /*DEAL WITH SETTING ATTRIBUTES HERE*/ case SP_ATTR_OPERATOR: @@ -199,15 +199,15 @@ sp_feMorphology_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape:: return repr; } -static void sp_feMorphology_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feMorphology_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeMorphology *sp_morphology = SP_FEMORPHOLOGY(primitive); - int primitive_n = filter->add_primitive(NR::NR_FILTER_MORPHOLOGY); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterMorphology *nr_morphology = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_MORPHOLOGY); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterMorphology *nr_morphology = dynamic_cast(nr_primitive); g_assert(nr_morphology != NULL); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/filters/morphology.h b/src/filters/morphology.h index 8e807d73a..20abf8a8d 100644 --- a/src/filters/morphology.h +++ b/src/filters/morphology.h @@ -25,7 +25,7 @@ class SPFeMorphologyClass; struct SPFeMorphology : public SPFilterPrimitive { /** MORPHOLOGY ATTRIBUTES HERE */ - NR::FilterMorphologyOperator Operator; + Inkscape::Filters::FilterMorphologyOperator Operator; NumberOptNumber radius; }; diff --git a/src/filters/offset.cpp b/src/filters/offset.cpp index 084863612..2c01549d3 100644 --- a/src/filters/offset.cpp +++ b/src/filters/offset.cpp @@ -35,7 +35,7 @@ static void sp_feOffset_release(SPObject *object); static void sp_feOffset_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feOffset_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feOffset_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feOffset_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feOffset_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static SPFilterPrimitiveClass *feOffset_parent_class; @@ -184,15 +184,15 @@ sp_feOffset_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML: return repr; } -static void sp_feOffset_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feOffset_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeOffset *sp_offset = SP_FEOFFSET(primitive); - int primitive_n = filter->add_primitive(NR::NR_FILTER_OFFSET); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterOffset *nr_offset = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_OFFSET); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterOffset *nr_offset = dynamic_cast(nr_primitive); g_assert(nr_offset != NULL); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/filters/specularlighting.cpp b/src/filters/specularlighting.cpp index baf9bb7c2..4c73033e6 100644 --- a/src/filters/specularlighting.cpp +++ b/src/filters/specularlighting.cpp @@ -46,7 +46,7 @@ static void sp_feSpecularLighting_child_added(SPObject *object, static void sp_feSpecularLighting_remove_child(SPObject *object, Inkscape::XML::Node *child); static void sp_feSpecularLighting_order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref); static Inkscape::XML::Node *sp_feSpecularLighting_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feSpecularLighting_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feSpecularLighting_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static void sp_feSpecularLighting_children_modified(SPFeSpecularLighting *sp_specularlighting); static SPFilterPrimitiveClass *feSpecularLighting_parent_class; @@ -343,31 +343,31 @@ sp_feSpecularLighting_order_changed (SPObject *object, Inkscape::XML::Node *chil static void sp_feSpecularLighting_children_modified(SPFeSpecularLighting *sp_specularlighting) { if (sp_specularlighting->renderer) { - sp_specularlighting->renderer->light_type = NR::NO_LIGHT; + sp_specularlighting->renderer->light_type = Inkscape::Filters::NO_LIGHT; if (SP_IS_FEDISTANTLIGHT(sp_specularlighting->children)) { - sp_specularlighting->renderer->light_type = NR::DISTANT_LIGHT; + sp_specularlighting->renderer->light_type = Inkscape::Filters::DISTANT_LIGHT; sp_specularlighting->renderer->light.distant = SP_FEDISTANTLIGHT(sp_specularlighting->children); } if (SP_IS_FEPOINTLIGHT(sp_specularlighting->children)) { - sp_specularlighting->renderer->light_type = NR::POINT_LIGHT; + sp_specularlighting->renderer->light_type = Inkscape::Filters::POINT_LIGHT; sp_specularlighting->renderer->light.point = SP_FEPOINTLIGHT(sp_specularlighting->children); } if (SP_IS_FESPOTLIGHT(sp_specularlighting->children)) { - sp_specularlighting->renderer->light_type = NR::SPOT_LIGHT; + sp_specularlighting->renderer->light_type = Inkscape::Filters::SPOT_LIGHT; sp_specularlighting->renderer->light.spot = SP_FESPOTLIGHT(sp_specularlighting->children); } } } -static void sp_feSpecularLighting_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feSpecularLighting_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeSpecularLighting *sp_specularlighting = SP_FESPECULARLIGHTING(primitive); - int primitive_n = filter->add_primitive(NR::NR_FILTER_SPECULARLIGHTING); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterSpecularLighting *nr_specularlighting = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_SPECULARLIGHTING); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterSpecularLighting *nr_specularlighting = dynamic_cast(nr_primitive); g_assert(nr_specularlighting != NULL); sp_specularlighting->renderer = nr_specularlighting; @@ -378,17 +378,17 @@ static void sp_feSpecularLighting_build_renderer(SPFilterPrimitive *primitive, N nr_specularlighting->surfaceScale = sp_specularlighting->surfaceScale; nr_specularlighting->lighting_color = sp_specularlighting->lighting_color; //We assume there is at most one child - nr_specularlighting->light_type = NR::NO_LIGHT; + nr_specularlighting->light_type = Inkscape::Filters::NO_LIGHT; if (SP_IS_FEDISTANTLIGHT(primitive->children)) { - nr_specularlighting->light_type = NR::DISTANT_LIGHT; + nr_specularlighting->light_type = Inkscape::Filters::DISTANT_LIGHT; nr_specularlighting->light.distant = SP_FEDISTANTLIGHT(primitive->children); } if (SP_IS_FEPOINTLIGHT(primitive->children)) { - nr_specularlighting->light_type = NR::POINT_LIGHT; + nr_specularlighting->light_type = Inkscape::Filters::POINT_LIGHT; nr_specularlighting->light.point = SP_FEPOINTLIGHT(primitive->children); } if (SP_IS_FESPOTLIGHT(primitive->children)) { - nr_specularlighting->light_type = NR::SPOT_LIGHT; + nr_specularlighting->light_type = Inkscape::Filters::SPOT_LIGHT; nr_specularlighting->light.spot = SP_FESPOTLIGHT(primitive->children); } diff --git a/src/filters/specularlighting.h b/src/filters/specularlighting.h index c2a55df51..cdca5f99f 100644 --- a/src/filters/specularlighting.h +++ b/src/filters/specularlighting.h @@ -18,9 +18,11 @@ #include "sp-filter.h" #include "specularlighting-fns.h" -namespace NR { +namespace Inkscape { +namespace Filters { class FilterSpecularLighting; } +} /* FeSpecularLighting base class */ class SPFeSpecularLightingClass; @@ -42,7 +44,7 @@ struct SPFeSpecularLighting : public SPFilterPrimitive { guint32 lighting_color; guint lighting_color_set : 1; - NR::FilterSpecularLighting *renderer; + Inkscape::Filters::FilterSpecularLighting *renderer; }; struct SPFeSpecularLightingClass { diff --git a/src/filters/tile.cpp b/src/filters/tile.cpp index ab4f9a27a..cf72cb052 100644 --- a/src/filters/tile.cpp +++ b/src/filters/tile.cpp @@ -33,7 +33,7 @@ static void sp_feTile_release(SPObject *object); static void sp_feTile_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feTile_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feTile_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feTile_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feTile_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static SPFilterPrimitiveClass *feTile_parent_class; @@ -164,16 +164,16 @@ sp_feTile_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::N return repr; } -static void sp_feTile_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feTile_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeTile *sp_tile = SP_FETILE(primitive); (void)sp_tile; - int primitive_n = filter->add_primitive(NR::NR_FILTER_TILE); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterTile *nr_tile = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_TILE); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterTile *nr_tile = dynamic_cast(nr_primitive); g_assert(nr_tile != NULL); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/filters/turbulence.cpp b/src/filters/turbulence.cpp index 1d7a1c840..7c185f2af 100644 --- a/src/filters/turbulence.cpp +++ b/src/filters/turbulence.cpp @@ -39,7 +39,7 @@ static void sp_feTurbulence_release(SPObject *object); static void sp_feTurbulence_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feTurbulence_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_feTurbulence_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_feTurbulence_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_feTurbulence_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static SPFilterPrimitiveClass *feTurbulence_parent_class; @@ -130,17 +130,17 @@ static bool sp_feTurbulence_read_stitchTiles(gchar const *value){ return false; // 'noStitch' is default } -static NR::FilterTurbulenceType sp_feTurbulence_read_type(gchar const *value){ - if (!value) return NR::TURBULENCE_TURBULENCE; // 'turbulence' is default +static Inkscape::Filters::FilterTurbulenceType sp_feTurbulence_read_type(gchar const *value){ + if (!value) return Inkscape::Filters::TURBULENCE_TURBULENCE; // 'turbulence' is default switch(value[0]){ case 'f': - if (strncmp(value, "fractalNoise", 12) == 0) return NR::TURBULENCE_FRACTALNOISE; + if (strncmp(value, "fractalNoise", 12) == 0) return Inkscape::Filters::TURBULENCE_FRACTALNOISE; break; case 't': - if (strncmp(value, "turbulence", 10) == 0) return NR::TURBULENCE_TURBULENCE; + if (strncmp(value, "turbulence", 10) == 0) return Inkscape::Filters::TURBULENCE_TURBULENCE; break; } - return NR::TURBULENCE_TURBULENCE; // 'turbulence' is default + return Inkscape::Filters::TURBULENCE_TURBULENCE; // 'turbulence' is default } /** @@ -155,7 +155,7 @@ sp_feTurbulence_set(SPObject *object, unsigned int key, gchar const *value) int read_int; double read_num; bool read_bool; - NR::FilterTurbulenceType read_type; + Inkscape::Filters::FilterTurbulenceType read_type; switch(key) { /*DEAL WITH SETTING ATTRIBUTES HERE*/ @@ -249,15 +249,15 @@ sp_feTurbulence_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape:: return repr; } -static void sp_feTurbulence_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_feTurbulence_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { g_assert(primitive != NULL); g_assert(filter != NULL); SPFeTurbulence *sp_turbulence = SP_FETURBULENCE(primitive); - int primitive_n = filter->add_primitive(NR::NR_FILTER_TURBULENCE); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); - NR::FilterTurbulence *nr_turbulence = dynamic_cast(nr_primitive); + int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_TURBULENCE); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n); + Inkscape::Filters::FilterTurbulence *nr_turbulence = dynamic_cast(nr_primitive); g_assert(nr_turbulence != NULL); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/filters/turbulence.h b/src/filters/turbulence.h index 3601a7cdc..5edf678a7 100644 --- a/src/filters/turbulence.h +++ b/src/filters/turbulence.h @@ -28,7 +28,7 @@ struct SPFeTurbulence : public SPFilterPrimitive { int numOctaves; double seed; bool stitchTiles; - NR::FilterTurbulenceType type; + Inkscape::Filters::FilterTurbulenceType type; SVGLength x, y, height, width; bool updated; }; diff --git a/src/sp-filter-primitive.cpp b/src/sp-filter-primitive.cpp index ccde93889..9bfaff4aa 100644 --- a/src/sp-filter-primitive.cpp +++ b/src/sp-filter-primitive.cpp @@ -83,8 +83,8 @@ sp_filter_primitive_class_init(SPFilterPrimitiveClass *klass) static void sp_filter_primitive_init(SPFilterPrimitive *filter_primitive) { - filter_primitive->image_in = NR::NR_FILTER_SLOT_NOT_SET; - filter_primitive->image_out = NR::NR_FILTER_SLOT_NOT_SET; + filter_primitive->image_in = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET; + filter_primitive->image_out = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET; } /** @@ -129,7 +129,7 @@ sp_filter_primitive_set(SPObject *object, unsigned int key, gchar const *value) if (value) { image_nr = sp_filter_primitive_read_in(filter_primitive, value); } else { - image_nr = NR::NR_FILTER_SLOT_NOT_SET; + image_nr = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET; } if (image_nr != filter_primitive->image_in) { filter_primitive->image_in = image_nr; @@ -140,7 +140,7 @@ sp_filter_primitive_set(SPObject *object, unsigned int key, gchar const *value) if (value) { image_nr = sp_filter_primitive_read_result(filter_primitive, value); } else { - image_nr = NR::NR_FILTER_SLOT_NOT_SET; + image_nr = Inkscape::Filters::NR_FILTER_SLOT_NOT_SET; } if (image_nr != filter_primitive->image_out) { filter_primitive->image_out = image_nr; @@ -200,26 +200,26 @@ sp_filter_primitive_write(SPObject *object, Inkscape::XML::Document *doc, Inksca int sp_filter_primitive_read_in(SPFilterPrimitive *prim, gchar const *name) { - if (!name) return NR::NR_FILTER_SLOT_NOT_SET; + if (!name) return Inkscape::Filters::NR_FILTER_SLOT_NOT_SET; // TODO: are these case sensitive or not? (assumed yes) switch (name[0]) { case 'S': if (strcmp(name, "SourceGraphic") == 0) - return NR::NR_FILTER_SOURCEGRAPHIC; + return Inkscape::Filters::NR_FILTER_SOURCEGRAPHIC; if (strcmp(name, "SourceAlpha") == 0) - return NR::NR_FILTER_SOURCEALPHA; + return Inkscape::Filters::NR_FILTER_SOURCEALPHA; if (strcmp(name, "StrokePaint") == 0) - return NR::NR_FILTER_STROKEPAINT; + return Inkscape::Filters::NR_FILTER_STROKEPAINT; break; case 'B': if (strcmp(name, "BackgroundImage") == 0) - return NR::NR_FILTER_BACKGROUNDIMAGE; + return Inkscape::Filters::NR_FILTER_BACKGROUNDIMAGE; if (strcmp(name, "BackgroundAlpha") == 0) - return NR::NR_FILTER_BACKGROUNDALPHA; + return Inkscape::Filters::NR_FILTER_BACKGROUNDALPHA; break; case 'F': if (strcmp(name, "FillPaint") == 0) - return NR::NR_FILTER_FILLPAINT; + return Inkscape::Filters::NR_FILTER_FILLPAINT; break; } @@ -227,7 +227,7 @@ int sp_filter_primitive_read_in(SPFilterPrimitive *prim, gchar const *name) int ret = sp_filter_get_image_name(parent, name); if (ret >= 0) return ret; - return NR::NR_FILTER_SLOT_NOT_SET; + return Inkscape::Filters::NR_FILTER_SLOT_NOT_SET; } int sp_filter_primitive_read_result(SPFilterPrimitive *prim, gchar const *name) @@ -239,11 +239,11 @@ int sp_filter_primitive_read_result(SPFilterPrimitive *prim, gchar const *name) ret = sp_filter_set_image_name(parent, name); if (ret >= 0) return ret; - return NR::NR_FILTER_SLOT_NOT_SET; + return Inkscape::Filters::NR_FILTER_SLOT_NOT_SET; } /* Common initialization for filter primitives */ -void sp_filter_primitive_renderer_common(SPFilterPrimitive *sp_prim, NR::FilterPrimitive *nr_prim) +void sp_filter_primitive_renderer_common(SPFilterPrimitive *sp_prim, Inkscape::Filters::FilterPrimitive *nr_prim) { g_assert(sp_prim != NULL); g_assert(nr_prim != NULL); diff --git a/src/sp-filter-primitive.h b/src/sp-filter-primitive.h index 6f6558c5c..889c40e40 100644 --- a/src/sp-filter-primitive.h +++ b/src/sp-filter-primitive.h @@ -34,13 +34,13 @@ struct SPFilterPrimitive : public SPObject { struct SPFilterPrimitiveClass { SPObjectClass sp_object_class; - void (* build_renderer)(SPFilterPrimitive*, NR::Filter*); + void (* build_renderer)(SPFilterPrimitive*, Inkscape::Filters::Filter*); }; GType sp_filter_primitive_get_type (void); /* Common initialization for filter primitives */ -void sp_filter_primitive_renderer_common(SPFilterPrimitive *sp_prim, NR::FilterPrimitive *nr_prim); +void sp_filter_primitive_renderer_common(SPFilterPrimitive *sp_prim, Inkscape::Filters::FilterPrimitive *nr_prim); int sp_filter_primitive_read_in(SPFilterPrimitive *prim, gchar const *name); int sp_filter_primitive_read_result(SPFilterPrimitive *prim, gchar const *name); diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index e075087d3..2a971ccc6 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -410,7 +410,7 @@ sp_filter_remove_child(SPObject *object, Inkscape::XML::Node *child) object->requestModified(SP_OBJECT_MODIFIED_FLAG); } -void sp_filter_build_renderer(SPFilter *sp_filter, NR::Filter *nr_filter) +void sp_filter_build_renderer(SPFilter *sp_filter, Inkscape::Filters::Filter *nr_filter) { g_assert(sp_filter != NULL); g_assert(nr_filter != NULL); diff --git a/src/sp-filter.h b/src/sp-filter.h index d0a449c47..c1af5f768 100644 --- a/src/sp-filter.h +++ b/src/sp-filter.h @@ -60,7 +60,7 @@ struct SPFilter : public SPObject { SPFilterReference *href; sigc::connection modified_connection; - NR::Filter *_renderer; + Inkscape::Filters::Filter *_renderer; std::map* _image_name; int _image_number_next; @@ -71,10 +71,10 @@ struct SPFilterClass { }; /* - * Initializes the given NR::Filter object as a renderer for this + * Initializes the given Inkscape::Filters::Filter object as a renderer for this * SPFilter object. */ -void sp_filter_build_renderer(SPFilter *sp_filter, NR::Filter *nr_filter); +void sp_filter_build_renderer(SPFilter *sp_filter, Inkscape::Filters::Filter *nr_filter); /* * Returns the number of filter primitives in this SPFilter object. diff --git a/src/sp-gaussian-blur.cpp b/src/sp-gaussian-blur.cpp index 94efc5727..77efe9c01 100644 --- a/src/sp-gaussian-blur.cpp +++ b/src/sp-gaussian-blur.cpp @@ -41,7 +41,7 @@ static void sp_gaussianBlur_release(SPObject *object); static void sp_gaussianBlur_set(SPObject *object, unsigned int key, gchar const *value); static void sp_gaussianBlur_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_gaussianBlur_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_gaussianBlur_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); +static void sp_gaussianBlur_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter); static SPFilterPrimitiveClass *gaussianBlur_parent_class; @@ -186,12 +186,12 @@ void sp_gaussianBlur_setDeviation(SPGaussianBlur *blur, float num, float optnum blur->stdDeviation.setOptNumber(optnum); } -static void sp_gaussianBlur_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter) { +static void sp_gaussianBlur_build_renderer(SPFilterPrimitive *primitive, Inkscape::Filters::Filter *filter) { SPGaussianBlur *sp_blur = SP_GAUSSIANBLUR(primitive); - int handle = filter->add_primitive(NR::NR_FILTER_GAUSSIANBLUR); - NR::FilterPrimitive *nr_primitive = filter->get_primitive(handle); - NR::FilterGaussian *nr_blur = dynamic_cast(nr_primitive); + int handle = filter->add_primitive(Inkscape::Filters::NR_FILTER_GAUSSIANBLUR); + Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(handle); + Inkscape::Filters::FilterGaussian *nr_blur = dynamic_cast(nr_primitive); sp_filter_primitive_renderer_common(primitive, nr_primitive); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 7f92f5f01..7a4684d83 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -68,7 +68,7 @@ #include "io/sys.h" #include -using namespace NR; +using namespace Inkscape::Filters; namespace Inkscape { namespace UI { @@ -2272,67 +2272,67 @@ void FilterEffectsDialog::update_primitive_infobox() _infobox_desc.hide(); } switch(_add_primitive_type.get_active_data()->id){ - case(NR::NR_FILTER_BLEND): + case(NR_FILTER_BLEND): _infobox_icon.set(g_strdup_printf("%s/feBlend-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feBlend filter primitive provides 4 image blending modes: screen, multiply, darken and lighten.")); break; - case(NR::NR_FILTER_COLORMATRIX): + case(NR_FILTER_COLORMATRIX): _infobox_icon.set(g_strdup_printf("%s/feColorMatrix-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feColorMatrix filter primitive applies a matrix transformation to colour of each rendered pixel. This allows for effects like turning object to grayscale, modifying colour saturation and changing colour hue.")); break; - case(NR::NR_FILTER_COMPONENTTRANSFER): + case(NR_FILTER_COMPONENTTRANSFER): _infobox_icon.set(g_strdup_printf("%s/feComponentTransfer-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feComponentTransfer filter primitive manipulates the input's color components (red, green, blue, and alpha) according to particular transfer functions, allowing operations like brightness and contrast adjustment, color balance, and thresholding.")); break; - case(NR::NR_FILTER_COMPOSITE): + case(NR_FILTER_COMPOSITE): _infobox_icon.set(g_strdup_printf("%s/feComposite-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feComposite filter primitive composites two images using one of the Porter-Duff blending modes or the aritmetic mode described in SVG standard. Porter-Duff blending modes are essentially logical operations between the corresponding pixel values of the images.")); break; - case(NR::NR_FILTER_CONVOLVEMATRIX): + case(NR_FILTER_CONVOLVEMATRIX): _infobox_icon.set(g_strdup_printf("%s/feConvolveMatrix-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feConvolveMatrix lets you specify a Convolution to be applied on the image. Common effects created using convolution matrices are blur, sharpening, embossing and edge detection. Note that while gaussian blur can be created using this filter primitive, the special gaussian blur primitive is faster and resolution-independent.")); break; - case(NR::NR_FILTER_DIFFUSELIGHTING): + case(NR_FILTER_DIFFUSELIGHTING): _infobox_icon.set(g_strdup_printf("%s/feDiffuseLighting-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feDiffuseLighting and feSpecularLighting filter primitives create \"embossed\" shadings. The input's alpha channel is used to provide depth information: higher opacity areas are raised toward the viewer and lower opacity areas recede away from the viewer.")); break; - case(NR::NR_FILTER_DISPLACEMENTMAP): + case(NR_FILTER_DISPLACEMENTMAP): _infobox_icon.set(g_strdup_printf("%s/feDisplacementMap-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feDisplacementMap filter primitive displaces the pixels in the first input using the second input as a displacement map, that shows from how far the pixel should come from. Classical examples are whirl and pinch effects.")); break; - case(NR::NR_FILTER_FLOOD): + case(NR_FILTER_FLOOD): _infobox_icon.set(g_strdup_printf("%s/feFlood-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feFlood filter primitive fills the region with a given color and opacity. It is usually used as an input to other filters to apply color to a graphic.")); break; - case(NR::NR_FILTER_GAUSSIANBLUR): + case(NR_FILTER_GAUSSIANBLUR): _infobox_icon.set(g_strdup_printf("%s/feGaussianBlur-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feGaussianBlur filter primitive uniformly blurs its input. It is commonly used together with feOffset to create a drop shadow effect.")); break; - case(NR::NR_FILTER_IMAGE): + case(NR_FILTER_IMAGE): _infobox_icon.set(g_strdup_printf("%s/feImage-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feImage filter primitive fills the region with an external image or another part of the document.")); break; - case(NR::NR_FILTER_MERGE): + case(NR_FILTER_MERGE): _infobox_icon.set(g_strdup_printf("%s/feMerge-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feMerge filter primitive composites several temporary images inside the filter primitive to a single image. It uses normal alpha compositing for this. This is equivalent to using several feBlend primitives in 'normal' mode or several feComposite primitives in 'over' mode.")); break; - case(NR::NR_FILTER_MORPHOLOGY): + case(NR_FILTER_MORPHOLOGY): _infobox_icon.set(g_strdup_printf("%s/feMorphology-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feMorphology filter primitive provides erode and dilate effects. For single-colour objects erode makes the object thinner and dilate makes it thicker.")); break; - case(NR::NR_FILTER_OFFSET): + case(NR_FILTER_OFFSET): _infobox_icon.set(g_strdup_printf("%s/feOffset-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feOffset filter primitive offsets the image by an user-defined amount. For example, this is useful for drop shadows, where the shadow is in a slightly different position than the actual object.")); break; - case(NR::NR_FILTER_SPECULARLIGHTING): + case(NR_FILTER_SPECULARLIGHTING): _infobox_icon.set(g_strdup_printf("%s/feSpecularLighting-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feDiffuseLighting and feSpecularLighting filter primitives create \"embossed\" shadings. The input's alpha channel is used to provide depth information: higher opacity areas are raised toward the viewer and lower opacity areas recede away from the viewer.")); break; - case(NR::NR_FILTER_TILE): + case(NR_FILTER_TILE): _infobox_icon.set(g_strdup_printf("%s/feTile-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feTile filter primitive tiles a region with its input graphic")); break; - case(NR::NR_FILTER_TURBULENCE): + case(NR_FILTER_TURBULENCE): _infobox_icon.set(g_strdup_printf("%s/feTurbulence-icon.png", INKSCAPE_PIXMAPDIR)); _infobox_desc.set_markup(_("The feTurbulence filter primitive renders Perlin noise. This kind of noise is useful in simulating several nature phenomena like clouds, fire and smoke and in generating complex textures like marble or granite.")); break; diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 99b411441..3fb9a46fb 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -134,7 +134,7 @@ private: } Gtk::TreeModelColumn primitive; - Gtk::TreeModelColumn type_id; + Gtk::TreeModelColumn type_id; Gtk::TreeModelColumn type; Gtk::TreeModelColumn id; }; @@ -230,7 +230,7 @@ private: // View/add primitives Gtk::VBox _primitive_box; - UI::Widget::ComboBoxEnum _add_primitive_type; + UI::Widget::ComboBoxEnum _add_primitive_type; Gtk::Button _add_primitive; // Bottom pane (filter effect primitive settings) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index f2611c377..b086dd3e6 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -687,15 +687,15 @@ void InkscapePreferences::initPageFilters() /* filter quality */ _filter_quality_best.init ( _("Best quality (slowest)"), "/options/filterquality/value", - NR::FILTER_QUALITY_BEST, false, 0); + Inkscape::Filters::FILTER_QUALITY_BEST, false, 0); _filter_quality_better.init ( _("Better quality (slower)"), "/options/filterquality/value", - NR::FILTER_QUALITY_BETTER, false, &_filter_quality_best); + Inkscape::Filters::FILTER_QUALITY_BETTER, false, &_filter_quality_best); _filter_quality_normal.init ( _("Average quality"), "/options/filterquality/value", - NR::FILTER_QUALITY_NORMAL, true, &_filter_quality_best); + Inkscape::Filters::FILTER_QUALITY_NORMAL, true, &_filter_quality_best); _filter_quality_worse.init ( _("Lower quality (faster)"), "/options/filterquality/value", - NR::FILTER_QUALITY_WORSE, false, &_filter_quality_best); + Inkscape::Filters::FILTER_QUALITY_WORSE, false, &_filter_quality_best); _filter_quality_worst.init ( _("Lowest quality (fastest)"), "/options/filterquality/value", - NR::FILTER_QUALITY_WORST, false, &_filter_quality_best); + Inkscape::Filters::FILTER_QUALITY_WORST, false, &_filter_quality_best); _page_filters.add_group_header( _("Filter effects quality for display:")); _page_filters.add_line( true, "", _filter_quality_best, "", diff --git a/src/ui/widget/filter-effect-chooser.cpp b/src/ui/widget/filter-effect-chooser.cpp index 80418abd8..5b5b70118 100644 --- a/src/ui/widget/filter-effect-chooser.cpp +++ b/src/ui/widget/filter-effect-chooser.cpp @@ -59,7 +59,7 @@ const Glib::ustring SimpleFilterModifier::get_blend_mode() if (_blend.get_active_row_number() == 5) { return "filter"; } else { - const Util::EnumData *d = _blend.get_active_data(); + const Util::EnumData *d = _blend.get_active_data(); if (d) return _blend.get_active_data()->key; else diff --git a/src/ui/widget/filter-effect-chooser.h b/src/ui/widget/filter-effect-chooser.h index 141ec6bc0..e4e6796f4 100644 --- a/src/ui/widget/filter-effect-chooser.h +++ b/src/ui/widget/filter-effect-chooser.h @@ -54,7 +54,7 @@ private: Gtk::HBox _hb_blend; Gtk::VBox _vb_blur; Gtk::Label _lb_blend, _lb_blur; - ComboBoxEnum _blend; + ComboBoxEnum _blend; SpinSlider _blur; sigc::signal _signal_blend_blur_changed;