From: Enblend <enb...@li...> - 2012-08-07 14:59:51
|
branch: details: http://enblend.hg.sourceforge.net/hgweb/enblend/enblend/hgroot/enblend/enblend/rev/57a56d454739 changeset: 796:57a56d454739 user: Chris <cs...@us...> date: Tue Aug 07 16:57:18 2012 +0200 description: Remove static Vigra binding. Bug #685877 (sf-2853074). The current version builds against Vigra revision c3a600900f31fd8112cf8f90bd510015feb76fbb. The ability to read multi-layered images (e.g. TIFF) was successfully ported forward and is already fully working. Further cleanup: * Remove unused header files from "vigra_ext" directory. * Consistently place all of our Vigra extensions in namespace "vigra_ext". * Remove most "using" declarations; use fully qualified names instead. Broken after change: * Images are written without alpha mask. The relevant code is protected with symbol EXPORT_WITH_ALPHA_CHANNEL. diffstat: Makefile.am | 2 +- NEWS | 4 + README | 5 - VERSION | 2 +- VIGRA_LICENSE | 25 - configure.in | 16 +- doc/enblend.info | 0 doc/enfuse.info | 0 doc/versenblend.texi | 4 +- doc/versenfuse.texi | 4 +- include/Makefile.am | 2 +- include/vigra/CMakeLists.txt | 97 - include/vigra/Makefile.am | 86 - include/vigra/accessor.hxx | 1035 --------- include/vigra/affinegeometry.hxx | 196 - include/vigra/array_vector.hxx | 534 ---- include/vigra/basicgeometry.hxx | 707 ------ include/vigra/basicimage.hxx | 1315 ----------- include/vigra/basicimageview.hxx | 566 ---- include/vigra/bordertreatment.hxx | 87 - include/vigra/boundarytensor.hxx | 759 ------ include/vigra/cachedfileimage.hxx | 2290 -------------------- include/vigra/codec.hxx | 270 -- include/vigra/colorconversions.hxx | 2967 -------------------------- include/vigra/combineimages.hxx | 661 ----- include/vigra/config.hxx | 199 - include/vigra/contourcirculator.hxx | 240 -- include/vigra/convolution.hxx | 1144 ---------- include/vigra/copyimage.hxx | 285 -- include/vigra/cornerdetection.hxx | 734 ------ include/vigra/diff2d.hxx | 1408 ------------ include/vigra/distancetransform.hxx | 423 --- include/vigra/edgedetection.hxx | 2065 ------------------ include/vigra/eigensystem.hxx | 1167 ---------- include/vigra/error.hxx | 326 -- include/vigra/fftw.hxx | 1210 ---------- include/vigra/fftw3.hxx | 1886 ---------------- include/vigra/fixedpoint.hxx | 809 ------- include/vigra/flatmorphology.hxx | 1178 ---------- include/vigra/float_cast.h | 143 - include/vigra/functorexpression.hxx | 2005 ----------------- include/vigra/functortraits.hxx | 233 -- include/vigra/gaborfilter.hxx | 430 --- include/vigra/gaussians.hxx | 235 -- include/vigra/gradient_energy_tensor.hxx | 191 - include/vigra/imagecontainer.hxx | 446 --- include/vigra/imageinfo.hxx | 463 ---- include/vigra/imageiterator.hxx | 1661 -------------- include/vigra/imageiteratoradapter.hxx | 676 ----- include/vigra/impex.hxx | 963 -------- include/vigra/initimage.hxx | 493 ---- include/vigra/inspectimage.hxx | 1536 ------------- include/vigra/interpolating_accessor.hxx | 171 - include/vigra/iteratoradapter.hxx | 303 -- include/vigra/iteratortags.hxx | 53 - include/vigra/iteratortraits.hxx | 642 ----- include/vigra/labelimage.hxx | 1015 -------- include/vigra/linear_algebra.hxx | 45 - include/vigra/linear_solve.hxx | 293 -- include/vigra/localminmax.hxx | 909 ------- include/vigra/mathutil.hxx | 579 ----- include/vigra/matrix.hxx | 1480 ------------ include/vigra/memory.hxx | 99 - include/vigra/metaprogramming.hxx | 292 -- include/vigra/multi_array.hxx | 1547 ------------- include/vigra/multi_convolution.hxx | 678 ----- include/vigra/multi_impex.hxx | 171 - include/vigra/multi_iterator.hxx | 1904 ---------------- include/vigra/multi_pointoperators.hxx | 1586 ------------- include/vigra/navigator.hxx | 239 -- include/vigra/nonlineardiffusion.hxx | 716 ------ include/vigra/numerictraits.hxx | 2383 -------------------- include/vigra/orientedtensorfilters.hxx | 576 ----- include/vigra/pixelneighborhood.hxx | 1451 ------------ include/vigra/polynomial.hxx | 1114 --------- include/vigra/rational.hxx | 1313 ----------- include/vigra/recursiveconvolution.hxx | 1499 ------------- include/vigra/resampling_convolution.hxx | 580 ----- include/vigra/resizeimage.hxx | 1400 ------------ include/vigra/rfftw.hxx | 249 -- include/vigra/rgbvalue.hxx | 1434 ------------ include/vigra/seededregiongrowing.hxx | 583 ----- include/vigra/separableconvolution.hxx | 1718 --------------- include/vigra/sized_int.hxx | 164 - include/vigra/splineimageview.hxx | 1822 --------------- include/vigra/splines.hxx | 1033 --------- include/vigra/static_assert.hxx | 134 - include/vigra/stdcachedfileimage.hxx | 195 - include/vigra/stdconvolution.hxx | 1645 -------------- include/vigra/stdimage.hxx | 334 -- include/vigra/stdimagefunctions.hxx | 95 - include/vigra/symmetry.hxx | 264 -- include/vigra/tensorutilities.hxx | 472 ---- include/vigra/tiff.hxx | 1812 --------------- include/vigra/tinyvector.hxx | 1333 ----------- include/vigra/transformimage.hxx | 1258 ----------- include/vigra/tuple.hxx | 182 - include/vigra/utilities.hxx | 79 - include/vigra/watersheds.hxx | 470 ---- include/vigra/windows.h | 54 - include/vigra_ext/Correlation.h | 862 ------- include/vigra_ext/FitPolynom.h | 137 - include/vigra_ext/FunctorAccessor.h | 622 ----- include/vigra_ext/ImageTransforms.h | 742 ------ include/vigra_ext/Interpolators.h | 887 ------- include/vigra_ext/Makefile.am | 26 +- include/vigra_ext/MultiLayerImage.h | 152 - include/vigra_ext/MultiThreadOperations.h | 142 - include/vigra_ext/NearestFeatureTransform.h | 551 ---- include/vigra_ext/Pyramid.h | 72 - include/vigra_ext/ROI.h | 236 -- include/vigra_ext/ROIImage.h | 461 ---- include/vigra_ext/RansacParameterEstimator.h | 58 - include/vigra_ext/VigQuotientEstimator.h | 443 --- include/vigra_ext/VignettingCorrection.h | 596 ----- include/vigra_ext/XMIWrapper.h | 6 +- include/vigra_ext/blend.h | 243 -- include/vigra_ext/cachedfileimage.hxx | 2291 ++++++++++++++++++++ include/vigra_ext/functoraccessor.hxx | 621 +++++ include/vigra_ext/impexalpha.hxx | 390 +- include/vigra_ext/ransac.h | 428 --- include/vigra_ext/rect2d.hxx | 30 + include/vigra_ext/stdcachedfileimage.hxx | 197 + include/vigra_ext/tiffUtils.h | 552 ---- include/vigra_ext/utils.h | 255 -- src/Makefile.am | 6 +- src/anneal.h | 172 +- src/assemble.h | 237 +- src/blend.h | 236 +- src/bounds.h | 40 +- src/common.h | 90 +- src/enblend.cc | 917 +++---- src/enblend.h | 372 +- src/enfuse.cc | 804 +++--- src/enfuse.h | 529 ++-- src/filespec.cc | 2 +- src/fixmath.h | 95 +- src/global.h | 2 +- src/gpu.cc | 62 +- src/graphcut.h | 372 +- src/layer_selection/layer_selection.h | 23 +- src/mask.h | 410 +- src/maskcommon.h | 114 +- src/mga.h | 87 +- src/nearest.h | 50 +- src/numerictraits.h | 82 +- src/openmp.h | 14 +- src/path.h | 58 +- src/postoptimizer.h | 96 +- src/pyramid.h | 268 +- src/vigra_impex/CMakeLists.txt | 17 - src/vigra_impex/Makefile.am | 21 - src/vigra_impex/auto_file.hxx | 85 - src/vigra_impex/bmp.cxx | 1120 --------- src/vigra_impex/bmp.hxx | 108 - src/vigra_impex/byteorder.cxx | 88 - src/vigra_impex/byteorder.hxx | 182 - src/vigra_impex/codecmanager.cxx | 379 --- src/vigra_impex/codecmanager.hxx | 109 - src/vigra_impex/error.hxx | 45 - src/vigra_impex/exr.cxx | 443 --- src/vigra_impex/exr.hxx | 121 - src/vigra_impex/gif.cxx | 1083 --------- src/vigra_impex/gif.hxx | 109 - src/vigra_impex/hdr.cxx | 393 --- src/vigra_impex/hdr.hxx | 118 - src/vigra_impex/iccjpeg.c | 259 -- src/vigra_impex/iccjpeg.h | 82 - src/vigra_impex/imageinfo.cxx | 601 ----- src/vigra_impex/jpeg.cxx | 527 ---- src/vigra_impex/jpeg.hxx | 114 - src/vigra_impex/png.cxx | 796 ------ src/vigra_impex/png.hxx | 133 - src/vigra_impex/pnm.cxx | 835 ------- src/vigra_impex/pnm.hxx | 111 - src/vigra_impex/rgbe.c | 520 ---- src/vigra_impex/rgbe.h | 78 - src/vigra_impex/sun.cxx | 522 ---- src/vigra_impex/sun.hxx | 109 - src/vigra_impex/tiff.cxx | 996 -------- src/vigra_impex/tiff.hxx | 136 - src/vigra_impex/viff.cxx | 1094 --------- src/vigra_impex/viff.hxx | 109 - src/vigra_impex/void_vector.cxx | 47 - src/vigra_impex/void_vector.hxx | 267 -- 185 files changed, 5765 insertions(+), 94681 deletions(-) diffs (truncated from 106823 to 500 lines): diff -r cb7d1cf15223 -r 57a56d454739 Makefile.am --- a/Makefile.am Sun Jul 29 11:09:51 2012 +0200 +++ b/Makefile.am Tue Aug 07 16:57:18 2012 +0200 @@ -1,4 +1,4 @@ -EXTRA_DIST = VIGRA_LICENSE README.txt VERSION +EXTRA_DIST = README.txt VERSION if BUILD_DOC MAYBE_DOC = doc diff -r cb7d1cf15223 -r 57a56d454739 NEWS --- a/NEWS Sun Jul 29 11:09:51 2012 +0200 +++ b/NEWS Tue Aug 07 16:57:18 2012 +0200 @@ -100,6 +100,10 @@ - Enblend and Enfuse now use LittleCMS version 2.x. +- Enblend and Enfuse no longer rely on their own versions of the Vigra + imaging library. Vigra version 1.8 or later is now required to + build. + - XHTML validation does not rely on network access anymore. This means all necessary DTDs must be available locally and all catalogs must be set up correctly to build the XHTML documentation. diff -r cb7d1cf15223 -r 57a56d454739 README --- a/README Sun Jul 29 11:09:51 2012 +0200 +++ b/README Tue Aug 07 16:57:18 2012 +0200 @@ -666,11 +666,6 @@ along with Enblend; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -Enblend uses the VIGRA computer vision library. -VIGRA is Copyright 1998-2002 by Ullrich Koethe -Cognitive Systems Group, University of Hamburg, Germany -Please see the file VIGRA_LICENSE for details. - Local Variables: diff -r cb7d1cf15223 -r 57a56d454739 VERSION --- a/VERSION Sun Jul 29 11:09:51 2012 +0200 +++ b/VERSION Tue Aug 07 16:57:18 2012 +0200 @@ -1,1 +1,1 @@ -4.1-bbc433c36aed +4.1-cb7d1cf15223 diff -r cb7d1cf15223 -r 57a56d454739 VIGRA_LICENSE --- a/VIGRA_LICENSE Sun Jul 29 11:09:51 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -The VIGRA License -================= -(identical to the MIT X11 License) - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff -r cb7d1cf15223 -r 57a56d454739 configure.in --- a/configure.in Sun Jul 29 11:09:51 2012 +0200 +++ b/configure.in Tue Aug 07 16:57:18 2012 +0200 @@ -43,6 +43,14 @@ [], AC_MSG_ERROR([libxmi is required to compile Enblend.]), []) +AC_MSG_CHECKING([for Vigra import/export-library]) +LIBS="-lvigraimpex $LIBS" +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <vigra/imageinfo.hxx>]], + [[vigra::impexListFormats()]])], + AC_MSG_RESULT(yes), + [AC_MSG_RESULT(no) + AC_MSG_ERROR([libvigraimpex is required to compile Enblend.])]) + AC_MSG_CHECKING([if OpenEXR is wanted]) AC_ARG_WITH([openexr], [AS_HELP_STRING([--with-openexr], @@ -178,6 +186,8 @@ AC_LANG_SAVE AC_LANG_CPLUSPLUS +AC_CHECK_HEADER(vigra/basicimage.hxx, [], + AC_MSG_ERROR([Vigra "basicimage.hxx" header file is required to compile Enblend.])) AC_CHECK_HEADER(boost/algorithm/string/case_conv.hpp, [], AC_MSG_ERROR([Boost "case_conv" header file is required to compile Enblend.])) AC_CHECK_HEADER(boost/algorithm/string/trim.hpp, [], @@ -450,9 +460,6 @@ AC_SUBST(AM_MAKEINFOFLAGS) AC_SUBST(AM_MAKEINFOHTMLFLAGS) -# use a static vigra impex library -CXXFLAGS="-DVIGRA_STATIC_LIB ${CXXFLAGS}" - AC_MSG_CHECKING(whether to enable debugging) debug_default="no" AC_ARG_ENABLE(debug, @@ -522,11 +529,9 @@ AC_CONFIG_FILES([Makefile include/Makefile - include/vigra/Makefile include/vigra_ext/Makefile src/Makefile src/layer_selection/Makefile - src/vigra_impex/Makefile src/win32helpers/Makefile doc/Makefile]) AC_OUTPUT @@ -545,6 +550,7 @@ CFLAGS: ${CFLAGS:-<none required>} OPENGL_CFLAGS: ${OPENGL_CFLAGS:-<none required>} CXXFLAGS: ${CXXFLAGS:-<none required>} + LDFLAGS: ${LDFLAGS:-<none required>} LIBS: ${LIBS:-<none required>} OPENGL_LIBS: ${OPENGL_LIBS:-<none required>} EXTRA_LIBS (optional): ${EXTRA_LIBS:-<none selected>} diff -r cb7d1cf15223 -r 57a56d454739 doc/enblend.info Binary file doc/enblend.info has changed diff -r cb7d1cf15223 -r 57a56d454739 doc/enfuse.info Binary file doc/enfuse.info has changed diff -r cb7d1cf15223 -r 57a56d454739 doc/versenblend.texi --- a/doc/versenblend.texi Sun Jul 29 11:09:51 2012 +0200 +++ b/doc/versenblend.texi Tue Aug 07 16:57:18 2012 +0200 @@ -1,4 +1,4 @@ @set UPDATED 3 May 2012 @set UPDATED-MONTH May 2012 -@set EDITION 4.1-e378b04ea3b7 -@set VERSION 4.1-e378b04ea3b7 +@set EDITION 4.1-cb7d1cf15223 +@set VERSION 4.1-cb7d1cf15223 diff -r cb7d1cf15223 -r 57a56d454739 doc/versenfuse.texi --- a/doc/versenfuse.texi Sun Jul 29 11:09:51 2012 +0200 +++ b/doc/versenfuse.texi Tue Aug 07 16:57:18 2012 +0200 @@ -1,4 +1,4 @@ @set UPDATED 19 February 2012 @set UPDATED-MONTH February 2012 -@set EDITION 4.1-e378b04ea3b7 -@set VERSION 4.1-e378b04ea3b7 +@set EDITION 4.1-cb7d1cf15223 +@set VERSION 4.1-cb7d1cf15223 diff -r cb7d1cf15223 -r 57a56d454739 include/Makefile.am --- a/include/Makefile.am Sun Jul 29 11:09:51 2012 +0200 +++ b/include/Makefile.am Tue Aug 07 16:57:18 2012 +0200 @@ -1,1 +1,1 @@ -SUBDIRS = vigra vigra_ext +SUBDIRS = vigra_ext diff -r cb7d1cf15223 -r 57a56d454739 include/vigra/CMakeLists.txt --- a/include/vigra/CMakeLists.txt Sun Jul 29 11:09:51 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ - -include_directories(${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ) - - -########### install files ############### - - - - -#original Makefile.am contents follow: - -#EXTRA_DIST = accessor.hxx \ -# affinegeometry.hxx \ -# array_vector.hxx \ -# basicgeometry.hxx \ -# basicimage.hxx \ -# basicimageview.hxx \ -# bordertreatment.hxx \ -# boundarytensor.hxx \ -# cachedfileimage.hxx \ -# codec.hxx \ -# colorconversions.hxx \ -# combineimages.hxx \ -# config.hxx \ -# contourcirculator.hxx \ -# convolution.hxx \ -# copyimage.hxx \ -# cornerdetection.hxx \ -# diff2d.hxx \ -# distancetransform.hxx \ -# edgedetection.hxx \ -# eigensystem.hxx \ -# error.hxx \ -# fftw.hxx \ -# fftw3.hxx \ -# fixedpoint.hxx \ -# flatmorphology.hxx \ -# functorexpression.hxx \ -# functortraits.hxx \ -# gaborfilter.hxx \ -# gaussians.hxx \ -# gradient_energy_tensor.hxx \ -# imagecontainer.hxx \ -# imageinfo.hxx \ -# imageiteratoradapter.hxx \ -# imageiterator.hxx \ -# impex.hxx \ -# initimage.hxx \ -# inspectimage.hxx \ -# interpolating_accessor.hxx \ -# iteratoradapter.hxx \ -# iteratortags.hxx \ -# iteratortraits.hxx \ -# labelimage.hxx \ -# linear_algebra.hxx \ -# linear_solve.hxx \ -# localminmax.hxx \ -# mathutil.hxx \ -# matrix.hxx \ -# memory.hxx \ -# metaprogramming.hxx \ -# multi_array.hxx \ -# multi_convolution.hxx \ -# multi_impex.hxx \ -# multi_iterator.hxx \ -# multi_pointoperators.hxx \ -# navigator.hxx \ -# nonlineardiffusion.hxx \ -# numerictraits.hxx \ -# orientedtensorfilters.hxx \ -# pixelneighborhood.hxx \ -# polynomial.hxx \ -# rational.hxx \ -# recursiveconvolution.hxx \ -# resampling_convolution.hxx \ -# resizeimage.hxx \ -# rfftw.hxx \ -# rgbvalue.hxx \ -# seededregiongrowing.hxx \ -# separableconvolution.hxx \ -# sized_int.hxx \ -# splineimageview.hxx \ -# splines.hxx \ -# static_assert.hxx \ -# stdcachedfileimage.hxx \ -# stdconvolution.hxx \ -# stdimagefunctions.hxx \ -# stdimage.hxx \ -# symmetry.hxx \ -# tensorutilities.hxx \ -# tiff.hxx \ -# tinyvector.hxx \ -# transformimage.hxx \ -# tuple.hxx \ -# utilities.hxx \ -# watersheds.hxx \ -# windows.h diff -r cb7d1cf15223 -r 57a56d454739 include/vigra/Makefile.am --- a/include/vigra/Makefile.am Sun Jul 29 11:09:51 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -EXTRA_DIST = accessor.hxx \ - affinegeometry.hxx \ - array_vector.hxx \ - basicgeometry.hxx \ - basicimage.hxx \ - basicimageview.hxx \ - bordertreatment.hxx \ - boundarytensor.hxx \ - cachedfileimage.hxx \ - codec.hxx \ - colorconversions.hxx \ - combineimages.hxx \ - config.hxx \ - contourcirculator.hxx \ - convolution.hxx \ - copyimage.hxx \ - cornerdetection.hxx \ - diff2d.hxx \ - distancetransform.hxx \ - edgedetection.hxx \ - eigensystem.hxx \ - error.hxx \ - fftw.hxx \ - fftw3.hxx \ - fixedpoint.hxx \ - flatmorphology.hxx \ - functorexpression.hxx \ - functortraits.hxx \ - gaborfilter.hxx \ - gaussians.hxx \ - gradient_energy_tensor.hxx \ - imagecontainer.hxx \ - imageinfo.hxx \ - imageiteratoradapter.hxx \ - imageiterator.hxx \ - impex.hxx \ - initimage.hxx \ - inspectimage.hxx \ - interpolating_accessor.hxx \ - iteratoradapter.hxx \ - iteratortags.hxx \ - iteratortraits.hxx \ - labelimage.hxx \ - linear_algebra.hxx \ - linear_solve.hxx \ - localminmax.hxx \ - mathutil.hxx \ - matrix.hxx \ - memory.hxx \ - metaprogramming.hxx \ - multi_array.hxx \ - multi_convolution.hxx \ - multi_impex.hxx \ - multi_iterator.hxx \ - multi_pointoperators.hxx \ - navigator.hxx \ - nonlineardiffusion.hxx \ - numerictraits.hxx \ - orientedtensorfilters.hxx \ - pixelneighborhood.hxx \ - polynomial.hxx \ - rational.hxx \ - recursiveconvolution.hxx \ - resampling_convolution.hxx \ - resizeimage.hxx \ - rfftw.hxx \ - rgbvalue.hxx \ - seededregiongrowing.hxx \ - separableconvolution.hxx \ - sized_int.hxx \ - splineimageview.hxx \ - splines.hxx \ - static_assert.hxx \ - stdcachedfileimage.hxx \ - stdconvolution.hxx \ - stdimagefunctions.hxx \ - stdimage.hxx \ - symmetry.hxx \ - tensorutilities.hxx \ - tiff.hxx \ - tinyvector.hxx \ - transformimage.hxx \ - tuple.hxx \ - utilities.hxx \ - watersheds.hxx \ - windows.h diff -r cb7d1cf15223 -r 57a56d454739 include/vigra/accessor.hxx --- a/include/vigra/accessor.hxx Sun Jul 29 11:09:51 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1035 +0,0 @@ -/************************************************************************/ -/* */ -/* Copyright 1998-2002 by Ullrich Koethe */ -/* Cognitive Systems Group, University of Hamburg, Germany */ -/* */ -/* This file is part of the VIGRA computer vision library. */ -/* The VIGRA Website is */ -/* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ -/* Please direct questions, bug reports, and contributions to */ -/* ko...@in... or */ -/* vi...@ko... */ -/* */ -/* Permission is hereby granted, free of charge, to any person */ -/* obtaining a copy of this software and associated documentation */ -/* files (the "Software"), to deal in the Software without */ -/* restriction, including without limitation the rights to use, */ -/* copy, modify, merge, publish, distribute, sublicense, and/or */ -/* sell copies of the Software, and to permit persons to whom the */ -/* Software is furnished to do so, subject to the following */ -/* conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the */ -/* Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */ -/* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */ -/* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */ -/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ -/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ -/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ -/* OTHER DEALINGS IN THE SOFTWARE. */ -/* */ -/************************************************************************/ - -#ifndef VIGRA_ACCESSOR_HXX -#define VIGRA_ACCESSOR_HXX - -#include "vigra/metaprogramming.hxx" -#include "vigra/numerictraits.hxx" -#include "vigra/tuple.hxx" - -namespace vigra { - -/** \addtogroup DataAccessors Data Accessors - - Basic templates to encapsulate access to the data of an iterator. - - Data accessors are used to allow for flexible access to the data - an interator points to. When we access the data directly, we - are bound to what <TT>operator*()</TT> returns, if this method exists at - all. Encapsulating access in an accessor enables a better - decoupling of data structures and algorithms. - <a href="documents/DataAccessors.ps">This paper</a> contains - a detailed description of the concept. Here is a brief list of the basic - accessor requirements: -<p> -<table border=2 cellspacing=0 cellpadding=2 width="100%"> -<tr><td> - \htmlonly - <th> - \endhtmlonly - Operation - \htmlonly - </th><th> - \endhtmlonly - Result - \htmlonly - </th><th> - \endhtmlonly - Semantics - \htmlonly - </th> - \endhtmlonly -</td></tr> -<tr> - <td><tt>accessor(iter)</tt></td><td>convertible to <br><tt>Iterator::value_type const &</tt></td> - <td>read data at the current position of the iterator</td> -</tr> -<tr> - <td><tt>accessor(iter, index)</tt></td><td>convertible to <br><tt>Accessor::value_type const &</tt></td> - <td>read data at offset <tt>index</tt> relative to iterator's current position - (random-access iterator only)</td> -</tr> -<tr> - <td><tt>accessor.set(value, iter)</tt></td><td><tt>void</tt></td> - <td>write data <tt>value</tt> at the current position of the iterator (mutable iterator only)</td> -</tr> -<tr> - <td><tt>accessor.set(value, iter, index)</tt></td><td><tt>void</tt></td> - <td>write data <tt>value</tt> at offset <tt>index</tt> relative to iterator's current position - (mutable random-access iterator only)</td> -</tr> -<tr> - <td> - \htmlonly - <td colspan=2> - \endhtmlonly - <tt>Accessor::value_type</tt></td> - <td>type of the data field the accessor refers to</td> -</tr> -<tr> - <td> - \htmlonly - <td colspan=3> - \endhtmlonly - <tt>iter</tt> is an iterator<br> - <tt>index</tt> has the iterator's index type (<tt>Iterator::difference_type</tt>)<br> - <tt>value</tt> is convertible to <tt>Accessor::value_type const &</tt> - </td> -</tr> -</table> -</p> - - The template <tt>AccessorTraits<T></tt> can be used to find the default accessor - associated with the type <tt>T</tt>, e.g. - - \code - typedef typename AccessorTraits<typename Image::value_type>::default_accessor Accessor; - typedef typename AccessorTraits<typename Image::value_type>::default_const_accessor ConstAccessor; - \endcode -*/ -//@{ - -/********************************************************/ -/* */ -/* StandardAccessor */ -/* */ -/********************************************************/ - -/** \brief Encapsulate access to the values an iterator points to. - - StandardAccessor is a trivial accessor that simply encapsulates - the iterator's operator*() and operator[]() in its - read and write functions. It passes its arguments <em>by reference</em>. - If you want to return items by value, you - must use StandardValueAccessor instead of StandardAccessor. - Both accessors have different optimization properties -- - StandardAccessor is usually faster for compound pixel types, - while StandardValueAccessor is faster for the built-in types. - - When a floating point number is assigned by means of an accessor - with integral value_type, the value is rounded and clipped as approriate. - |