diff --git a/README.md b/README.md
index cd0a0bb1..f7289912 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ Please note some media files may require significant CPU usage to be transcoded.
## Dependencies
### Debian or Ubuntu packages
```sh
-$ apt-get install g++ autoconf automake libboost-dev libboost-locale-dev libboost-iostreams-dev libboost-log-dev libavcodec-dev libwtdbosqlite-dev libwthttp-dev libwtdbo-dev libwt-dev libconfig++-dev libjpeg8-dev libavcodec-dev libavformat-dev libavutil-dvegi
+$ apt-get install g++ autoconf automake libboost-dev libboost-locale-dev libboost-iostreams-dev libboost-log-dev libavcodec-dev libwtdbosqlite-dev libwthttp-dev libwtdbo-dev libwt-dev libmagick++-dev libavcodec-dev libavformat-dev libavutil
```
If you want to enable the LMS API, you need these additional packages:
diff --git a/TODO b/TODO
index c5e44bc0..e21c5e2a 100644
--- a/TODO
+++ b/TODO
@@ -3,8 +3,6 @@
- Make the feature
[Cover]
-- Scaling: find something more "reliable" than GIL and its custom extensions (adobe work, io_new)?
-- Handle several file formats (not only jpg), use libmagic?
- Handle preferred cover file names
- Implement a cache and a grabber from some web service (mandatory for artists)
diff --git a/configure.ac b/configure.ac
index 603d8617..db8630ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,21 +46,18 @@ AC_ARG_ENABLE([video], AS_HELP_STRING([--enable-video],
AM_CONDITIONAL([VIDEO], [test x$enable_video = xyes])
+PKG_CHECK_MODULES(IMAGEMAGICKXX, "ImageMagick++", [ HAVE_IMAGEMAGICKXX=yes ], [ ])
+if test -n "$HAVE_IMAGEMAGICKXX"; then
+ MAGICKXX_CFLAGS="$IMAGEMAGICKXX_CFLAGS"
+ MAGICKXX_LIBS="$IMAGEMAGICKXX_LIBS"
+fi
+AC_SUBST(MAGICKXX_CFLAGS)
+AC_SUBST(MAGICKXX_LIBS)
-AC_CHECK_HEADERS([Wt/WApplication jpeglib.h],
+AC_CHECK_HEADERS([Wt/WApplication],
[],
[AC_MSG_ERROR([Header not found or unusable !])])
-AC_CHECK_LIB([jpeg],
- [jpeg_destroy],
- ,
- [AC_MSG_ERROR([libpthread not found!])])
-
-AC_CHECK_LIB([pthread],
- [pthread_create],
- ,
- [AC_MSG_ERROR([libpthread not found!])])
-
AC_CHECK_LIB([avutil],
[av_free],
,
@@ -76,16 +73,6 @@ AC_CHECK_LIB([avformat],
,
[AC_MSG_ERROR([libavformat not found!])])
-AC_CHECK_LIB([ssl],
- [SSL_CTX_new],
- ,
- [AC_MSG_ERROR([libssl not found!])])
-
-AC_CHECK_LIB([crypto],
- [ASN1_STRING_to_UTF8],
- ,
- [AC_MSG_ERROR([libcrypto not found!])])
-
AC_CHECK_LIB([boost_system],
[main],
,
diff --git a/src/Makefile.am b/src/Makefile.am
index 1b280b43..0aa398e0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -105,5 +105,6 @@ MOSTLYCLEANFILES = \
endif
-lms_CXXFLAGS=-DBOOST_LOG_DYN_LINK -std=c++11 -Wall -I$(top_srcdir)/third-party -I$(srcdir)/ui -I$(srcdir)/lms-api
+lms_CXXFLAGS=-std=c++11 -Wall -I$(top_srcdir)/third-party -I$(srcdir)/ui -I$(srcdir)/lms-api $(MAGICKXX_CFLAGS)
+lms_LDADD=$(MAGICKXX_LIBS)
diff --git a/src/cover/CoverArt.cpp b/src/cover/CoverArt.cpp
index 597c0053..227bca5e 100644
--- a/src/cover/CoverArt.cpp
+++ b/src/cover/CoverArt.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Emeric Poupon
+ * Copyright (C) 2015 Emeric Poupon
*
* This file is part of LMS.
*
@@ -16,65 +16,79 @@
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see .
*/
-
-#include
-#include
-#include
-#include
-#include
-#include
-
#include "logger/Logger.hpp"
#include "CoverArt.hpp"
+
namespace CoverArt {
+static
+std::string format_to_magick(Format format)
+{
+ switch (format)
+ {
+ case Format::JPEG: return "JPEG";
+ }
+
+ return "JPEG";
+}
+
+std::string format_to_mimeType(Format format)
+{
+ switch (format)
+ {
+ case Format::JPEG: return "JPEG";
+ }
+
+ return "application/octet-stream";
+}
+
+void
+CoverArt::init(const char *path)
+{
+ Magick::InitializeMagick(path);
+}
+
+CoverArt::CoverArt(const std::vector& rawData)
+{
+ Magick::Blob blob(&rawData[0], rawData.size());
+ _image.read(blob);
+}
+
+
bool
CoverArt::scale(std::size_t size)
{
- bool res = false;
-
if (!size)
return false;
- try {
+ try
+ {
+ _image.resize( Magick::Geometry(size, size ) );
- boost::gil::rgb8_image_t source;
- boost::gil::rgb8_image_t dest(size, size);
-
- // Read source
- {
- std::istringstream iss( std::string(_data.begin(), _data.end()));
- boost::gil::read_image(iss, source, boost::gil::jpeg_tag());
- }
-
- if (source.width() == static_cast(size)
- && source.height() == static_cast(size))
- return true;
-
- // Resize
- boost::gil::resize_view(boost::gil::const_view(source),
- boost::gil::view(dest),
- boost::gil::bilinear_sampler());
-
- // Output to dest
- {
- std::ostringstream oss;
- boost::gil::write_view(oss, boost::gil::const_view(dest), boost::gil::jpeg_tag());
-
- std::string output = oss.str();
- _data.assign(output.begin(), output.end());
- }
-
- res = true;
+ return true;
}
- catch(std::exception& e)
+ catch (Magick::Exception& e)
{
LMS_LOG(COVER, ERROR) << "Caught exception: " << e.what();
+ return false;
}
+}
- return res;
+void
+CoverArt::getData(std::vector& data, Format format) const
+{
+
+ Magick::Image outputImage(_image);
+
+ outputImage.magick( format_to_magick(format));
+
+ Magick::Blob blob;
+ outputImage.write(&blob);
+
+ unsigned char *charBuf = (unsigned char*)blob.data();
+ data.assign( charBuf, charBuf + blob.length() );
}
} // namespace CoverArt
diff --git a/src/cover/CoverArt.hpp b/src/cover/CoverArt.hpp
index 4594841c..c3e66cc0 100644
--- a/src/cover/CoverArt.hpp
+++ b/src/cover/CoverArt.hpp
@@ -23,30 +23,34 @@
#include
#include
+#include
namespace CoverArt
{
+enum class Format
+{
+ JPEG,
+};
+
+std::string format_to_mimeType(Format format);
+
class CoverArt
{
public:
- typedef std::vector data_type;
+ static void init(const char *path);
CoverArt() {}
- CoverArt(const std::string& mime, const data_type& data) : _mimeType(mime), _data(data) {}
-
- const std::string& getMimeType() const { return _mimeType; }
- const data_type& getData() const { return _data; }
-
- void setMimeType(const std::string& mimeType) { _mimeType = mimeType;}
- void setData(const data_type& data) { _data = data; }
+ CoverArt(const std::vector& rawData);
+ // Operations on cover arts
bool scale(std::size_t size);
- private:
+ // output
+ void getData(std::vector& data, Format format) const;
- std::string _mimeType;
- data_type _data;
+ private:
+ Magick::Image _image;
};
diff --git a/src/cover/CoverArtGrabber.cpp b/src/cover/CoverArtGrabber.cpp
index eaa9db3c..d5530e6f 100644
--- a/src/cover/CoverArtGrabber.cpp
+++ b/src/cover/CoverArtGrabber.cpp
@@ -61,7 +61,7 @@ getFromAvMediaFile(const Av::MediaFile& input, std::size_t nbMaxCovers)
std::vector res;
for (Av::Picture& picture : input.getAttachedPictures(nbMaxCovers))
- res.push_back( CoverArt(picture.mimeType, picture.data) );
+ res.push_back( CoverArt(picture.data) );
return res;
}
@@ -83,8 +83,7 @@ Grabber::getFromDirectory(const boost::filesystem::path& p, std::size_t nbMaxCov
while (file.get(c))
data.push_back(c);
- // TODO handle other formats
- res.push_back(CoverArt("image/jpeg", data));
+ res.push_back(CoverArt(data));
}
return res;
diff --git a/src/main/main.cpp b/src/main/main.cpp
index 787fd62f..c1d871eb 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -44,6 +44,8 @@ int main(int argc, char* argv[])
try
{
+
+ CoverArt::CoverArt::init(argv[0]);
Wt::WServer server(argv[0]);
server.setServerConfiguration (argc, argv);
diff --git a/src/ui/LmsApplication.cpp b/src/ui/LmsApplication.cpp
index 1e112dbc..c8b8ae62 100644
--- a/src/ui/LmsApplication.cpp
+++ b/src/ui/LmsApplication.cpp
@@ -199,12 +199,9 @@ LmsApplication::handleAuthEvent(void)
audio = new Desktop::Audio();
leftMenu->addItem("Audio", audio);
-
#if defined HAVE_VIDEO
- VideoWidget *videoWidget = new VideoWidget();
- leftMenu->addItem("Video", videoWidget);
+ leftMenu->addItem("Video", new VideoWidget());
#endif
-
leftMenu->addItem("Settings", new Settings::Settings());
// Setup a Right-aligned menu.
diff --git a/src/ui/resource/CoverResource.cpp b/src/ui/resource/CoverResource.cpp
index f0c601e5..bfdf26b5 100644
--- a/src/ui/resource/CoverResource.cpp
+++ b/src/ui/resource/CoverResource.cpp
@@ -49,7 +49,6 @@ CoverResource::getDefaultCover(std::size_t size)
{
// Load default cover art for this size
- CoverArt::CoverArt defaultCover;
std::vector data;
{
@@ -59,8 +58,8 @@ CoverResource::getDefaultCover(std::size_t size)
data.push_back(c);
}
- defaultCover.setData(data);
- defaultCover.setMimeType("image/jpeg");
+ CoverArt::CoverArt defaultCover(data);
+
defaultCover.scale(size);
auto res = _defaultCovers.insert(std::make_pair(size, defaultCover));
@@ -91,9 +90,12 @@ CoverResource::getUnknownTrackUrl(size_t size) const
void
CoverResource::putCover(Wt::Http::Response& response, const CoverArt::CoverArt& cover)
{
- response.setMimeType( cover.getMimeType() );
- BOOST_FOREACH(unsigned char c, cover.getData())
- response.out().put( c );
+ response.setMimeType( format_to_mimeType(CoverArt::Format::JPEG) );
+
+ std::vector data;
+ cover.getData(data, CoverArt::Format::JPEG);
+
+ response.out().write(reinterpret_cast(&data[0]), data.size());
}
void
diff --git a/src/ui/video/VideoDatabaseWidget.cpp b/src/ui/video/VideoDatabaseWidget.cpp
index 54ec0020..5e25e8bc 100644
--- a/src/ui/video/VideoDatabaseWidget.cpp
+++ b/src/ui/video/VideoDatabaseWidget.cpp
@@ -25,8 +25,6 @@
#include
#include
-#include "transcode/Parameters.hpp"
-
#include "LmsApplication.hpp"
#include "VideoDatabaseWidget.hpp"
diff --git a/src/ui/video/VideoParametersDialog.hpp b/src/ui/video/VideoParametersDialog.hpp
index 2739a4de..9f51e3ac 100644
--- a/src/ui/video/VideoParametersDialog.hpp
+++ b/src/ui/video/VideoParametersDialog.hpp
@@ -27,8 +27,6 @@
#include
#include
-#include "transcode/Parameters.hpp"
-
namespace UserInterface {
class VideoParametersDialog : public Wt::WDialog
diff --git a/third-party/boost/gil/extension/io_new/bmp_all.hpp b/third-party/boost/gil/extension/io_new/bmp_all.hpp
deleted file mode 100644
index f6a34f9b..00000000
--- a/third-party/boost/gil/extension/io_new/bmp_all.hpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- Copyright 2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_BMP_ALL_HPP
-#define BOOST_GIL_EXTENSION_IO_BMP_ALL_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include "bmp_read.hpp"
-#include "bmp_write.hpp"
-
-#endif // BOOST_GIL_EXTENSION_IO_BMP_ALL_HPP
diff --git a/third-party/boost/gil/extension/io_new/bmp_io_old.hpp b/third-party/boost/gil/extension/io_new/bmp_io_old.hpp
deleted file mode 100644
index e920be55..00000000
--- a/third-party/boost/gil/extension/io_new/bmp_io_old.hpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- Copyright 2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_BMP_IO_OLD_HPP
-#define BOOST_GIL_EXTENSION_IO_BMP_IO_OLD_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include "bmp_all.hpp"
-
-namespace boost { namespace gil {
-
-/// \ingroup BMP_IO
-/// \brief Returns the width and height of the BMP file at the specified location.
-/// Throws std::ios_base::failure if the location does not correspond to a valid BMP file
-template< typename String >
-inline
-point2< std::ptrdiff_t > bmp_read_dimensions( const String& filename )
-{
- image_read_info< bmp_tag > info = read_image_info( filename
- , bmp_tag()
- );
-
- return point2< std::ptrdiff_t >( info._width
- , info._height
- );
-}
-
-
-/// \ingroup BMP_IO
-/// \brief Loads the image specified by the given bmp image file name into the given view.
-/// Triggers a compile assert if the view color space and channel depth are not supported by the BMP library or by the I/O extension.
-/// Throws std::ios_base::failure if the file is not a valid BMP file, or if its color space or channel depth are not
-/// compatible with the ones specified by View, or if its dimensions don't match the ones of the view.
-template< typename String
- , typename View
- >
-inline
-void bmp_read_view( const String& filename
- , const View& view
- )
-{
- read_view( filename
- , view
- , bmp_tag()
- );
-}
-
-/// \ingroup BMP_IO
-/// \brief Allocates a new image whose dimensions are determined by the given bmp image file, and loads the pixels into it.
-/// Triggers a compile assert if the image color space or channel depth are not supported by the BMP library or by the I/O extension.
-/// Throws std::ios_base::failure if the file is not a valid BMP file, or if its color space or channel depth are not
-/// compatible with the ones specified by Image
-template< typename String
- , typename Image
- >
-inline
-void bmp_read_image( const String& filename
- , Image& img
- )
-{
- read_image( filename
- , img
- , bmp_tag()
- );
-}
-
-/// \ingroup BMP_IO
-/// \brief Loads and color-converts the image specified by the given bmp image file name into the given view.
-/// Throws std::ios_base::failure if the file is not a valid BMP file, or if its dimensions don't match the ones of the view.
-template< typename String
- , typename View
- , typename CC
- >
-inline
-void bmp_read_and_convert_view( const String& filename
- , const View& view
- , CC cc
- )
-{
- read_and_convert_view( filename
- , view
- , cc
- , bmp_tag()
- );
-}
-
-/// \ingroup BMP_IO
-/// \brief Loads and color-converts the image specified by the given bmp image file name into the given view.
-/// Throws std::ios_base::failure if the file is not a valid BMP file, or if its dimensions don't match the ones of the view.
-template< typename String
- , typename View
- >
-inline
-void bmp_read_and_convert_view( const String& filename
- , const View& view
- )
-{
- read_and_convert_view( filename
- , view
- , bmp_tag()
- );
-}
-
-/// \ingroup BMP_IO
-/// \brief Allocates a new image whose dimensions are determined by the given bmp image file, loads and color-converts the pixels into it.
-/// Throws std::ios_base::failure if the file is not a valid BMP file
-template< typename String
- , typename Image
- , typename CC
- >
-inline
-void bmp_read_and_convert_image( const String& filename
- , Image& img
- , CC cc
- )
-{
- read_and_convert_image( filename
- , img
- , cc
- , bmp_tag()
- );
-}
-
-/// \ingroup BMP_IO
-/// \brief Allocates a new image whose dimensions are determined by the given bmp image file, loads and color-converts the pixels into it.
-/// Throws std::ios_base::failure if the file is not a valid BMP file
-template< typename String
- , typename Image
- >
-inline
-void bmp_read_and_convert_image( const String filename
- , Image& img
- )
-{
- read_and_convert_image( filename
- , img
- , bmp_tag()
- );
-}
-
-
-/// \ingroup BMP_IO
-/// \brief Saves the view to a bmp file specified by the given bmp image file name.
-/// Triggers a compile assert if the view color space and channel depth are not supported by the BMP library or by the I/O extension.
-/// Throws std::ios_base::failure if it fails to create the file.
-template< typename String
- , typename View
- >
-inline
-void bmp_write_view( const String& filename
- , const View& view
- )
-{
- write_view( filename
- , view
- , bmp_tag()
- );
-}
-
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_BMP_IO_OLD_HPP
diff --git a/third-party/boost/gil/extension/io_new/bmp_read.hpp b/third-party/boost/gil/extension/io_new/bmp_read.hpp
deleted file mode 100644
index 2aecf86c..00000000
--- a/third-party/boost/gil/extension/io_new/bmp_read.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- Copyright 2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_BMP_READ_HPP
-#define BOOST_GIL_EXTENSION_IO_BMP_READ_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include "bmp_tags.hpp"
-#include "formats/bmp/supported_types.hpp"
-#include "formats/bmp/read.hpp"
-
-#include "detail/read_image.hpp"
-#include "detail/read_view.hpp"
-#include "detail/read_image_info.hpp"
-#include "detail/read_and_convert_image.hpp"
-#include "detail/read_and_convert_view.hpp"
-
-#endif // BOOST_GIL_EXTENSION_IO_BMP_READ_HPP
diff --git a/third-party/boost/gil/extension/io_new/bmp_tags.hpp b/third-party/boost/gil/extension/io_new/bmp_tags.hpp
deleted file mode 100644
index 4c0b4c24..00000000
--- a/third-party/boost/gil/extension/io_new/bmp_tags.hpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- Copyright 2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_BMP_TAGS_HPP
-#define BOOST_GIL_EXTENSION_IO_BMP_TAGS_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include "detail/base.hpp"
-
-namespace boost { namespace gil {
-
-/// Defines bmp tag.
-struct bmp_tag : format_tag {};
-
- /// See http://en.wikipedia.org/wiki/BMP_file_format#BMP_File_Header for reference.
-
-/// Defines type for offset value.
-struct bmp_offset : property_base< uint32_t > {};
-
-/// Defines type for header sizes.
-struct bmp_header_size : property_base< uint32_t >
-{
- static const type _size = 14; /// Constant size for bmp file header size.
- static const type _win32_info_size = 40; /// Constant size for win32 bmp info header size.
- static const type _os2_info_size = 12; /// Constant size for os2 bmp info header size.
-};
-
-/// Defines type for image width property.
-struct bmp_image_width : property_base< int32_t > {};
-
-/// Defines type for image height property.
-struct bmp_image_height : property_base< int32_t > {};
-
-/// Defines type for bits per pixels property.
-struct bmp_bits_per_pixel : property_base< uint16_t > {};
-
-/// Defines type for compression property.
-struct bmp_compression : property_base< uint32_t >
-{
- static const type _rgb = 0; /// RGB without compression
- static const type _rle8 = 1; /// 8 bit index with RLE compression
- static const type _rle4 = 2; /// 4 bit index with RLE compression
- static const type _bitfield = 3; /// 16 or 32 bit fields without compression
-};
-
-/// Defines type for image size property.
-struct bmp_image_size : property_base< uint32_t > {};
-
-/// Defines type for horizontal resolution property.
-struct bmp_horizontal_resolution : property_base< int32_t > {};
-
-/// Defines type for vertical resolution property.
-struct bmp_vertical_resolution : property_base< int32_t > {};
-
-/// Defines type for number of colors property.
-struct bmp_num_colors : property_base< uint32_t > {};
-
-/// Defines type for important number of colors property.
-struct bmp_num_important_colors : property_base< uint32_t > {};
-
-static const uint32_t bmp_signature = 0x4D42; /// Constant signature for bmp file format.
-
-/// Read information for bmp images.
-///
-/// The structure is returned when using read_image_info.
-template<>
-struct image_read_info< bmp_tag >
-{
- /// Default contructor.
- image_read_info< bmp_tag >()
- : _valid( false )
- {}
-
- /// The offset, i.e. starting address, of the byte where the bitmap data can be found.
- bmp_offset::type _offset;
-
- /// The size of this header:
- /// - 40 bytes for Windows V3 header
- /// - 12 bytes for OS/2 V1 header
- bmp_header_size::type _header_size;
-
- /// The bitmap width in pixels ( signed integer ).
- bmp_image_width::type _width;
-
- /// The bitmap height in pixels ( signed integer ).
- bmp_image_height::type _height;
-
- /// The number of bits per pixel, which is the color depth of the image.
- /// Typical values are 1, 4, 8, 16, 24 and 32.
- bmp_bits_per_pixel::type _bits_per_pixel;
-
- /// The compression method being used. See above for a list of possible values.
- bmp_compression::type _compression;
-
- /// The image size. This is the size of the raw bitmap data (see below),
- /// and should not be confused with the file size.
- bmp_image_size::type _image_size;
-
- /// The horizontal resolution of the image. (pixel per meter, signed integer)
- bmp_horizontal_resolution::type _horizontal_resolution;
-
- /// The vertical resolution of the image. (pixel per meter, signed integer)
- bmp_vertical_resolution::type _vertical_resolution;
-
- /// The number of colors in the color palette, or 0 to default to 2^n - 1.
- bmp_num_colors::type _num_colors;
-
- /// The number of important colors used, or 0 when every color is important;
- /// generally ignored.
- bmp_num_important_colors::type _num_important_colors;
-
- /// Used internaly to identify is the header has been read.
- bool _valid;
-};
-
-/// Read settings for bmp images.
-///
-/// The structure can be used for all read_xxx functions, except read_image_info.
-template<>
-struct image_read_settings< bmp_tag > : public image_read_settings_base
-{
- /// Default constructor
- image_read_settings()
- : image_read_settings_base()
- {}
-
- /// Constructor
- /// \param top_left Top left coordinate for reading partial image.
- /// \param dim Dimensions for reading partial image.
- image_read_settings( const point_t& top_left
- , const point_t& dim
- )
- : image_read_settings_base( top_left
- , dim
- )
- {}
-};
-
-/// Write information for bmp images.
-///
-/// The structure can be used for write_view() function.
-template<>
-struct image_write_info< bmp_tag >
-{
-};
-
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_BMP_TAGS_HPP
diff --git a/third-party/boost/gil/extension/io_new/bmp_write.hpp b/third-party/boost/gil/extension/io_new/bmp_write.hpp
deleted file mode 100644
index d874618b..00000000
--- a/third-party/boost/gil/extension/io_new/bmp_write.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- Copyright 2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_BMP_WRITE_HPP
-#define BOOST_GIL_EXTENSION_IO_BMP_WRITE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include "bmp_tags.hpp"
-#include "formats/bmp/supported_types.hpp"
-#include "formats/bmp/write.hpp"
-
-#include "detail/write_view.hpp"
-
-#endif // BOOST_GIL_EXTENSION_IO_BMP_WRITE_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/base.hpp b/third-party/boost/gil/extension/io_new/detail/base.hpp
deleted file mode 100644
index 5170fcc6..00000000
--- a/third-party/boost/gil/extension/io_new/detail/base.hpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_DETAIL_BASE_HPP
-#define BOOST_GIL_EXTENSION_IO_DETAIL_BASE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#include
-
-#include "typedefs.hpp"
-#include "io_error.hpp"
-
-namespace boost { namespace gil {
-
-struct format_tag {};
-
-template< typename Property >
-struct property_base
-{
- typedef Property type;
-};
-
-template struct is_format_tag : is_base_and_derived< format_tag
- , FormatTag
- > {};
-
-struct image_read_settings_base
-{
-protected:
-
- image_read_settings_base()
- : _top_left( 0, 0 )
- , _dim ( 0, 0 )
- {}
-
- image_read_settings_base( const point_t& top_left
- , const point_t& dim
- )
- : _top_left( top_left )
- , _dim ( dim )
- {}
-
-public:
-
- point_t _top_left;
- point_t _dim;
-};
-
-/**
- * Boolean meta function, mpl::true_ if the pixel type \a PixelType is supported
- * by the image format identified with \a FormatTag.
- * \todo the name is_supported is to generic, pick something more IO realted.
- */
-// Depending on image type the parameter Pixel can be a reference type
-// for bit_aligned images or a pixel for byte images.
-template< typename Pixel, typename FormatTag > struct is_read_supported {};
-template< typename Pixel, typename FormatTag > struct is_write_supported {};
-
-
-namespace detail {
-
-template< typename Property >
-struct property_base
-{
- typedef Property type;
-};
-
-struct read_support_true { BOOST_STATIC_CONSTANT( bool, is_supported = true ); };
-struct read_support_false { BOOST_STATIC_CONSTANT( bool, is_supported = false ); };
-struct write_support_true { BOOST_STATIC_CONSTANT( bool, is_supported = true ); };
-struct write_support_false{ BOOST_STATIC_CONSTANT( bool, is_supported = false ); };
-
-class no_log {};
-
-} // namespace detail
-
-template struct image_read_info;
-template struct image_read_settings;
-template struct image_write_info;
-
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_DETAIL_BASE_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/bit_operations.hpp b/third-party/boost/gil/extension/io_new/detail/bit_operations.hpp
deleted file mode 100644
index c8c9401c..00000000
--- a/third-party/boost/gil/extension/io_new/detail/bit_operations.hpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_DETAIL_BIT_OPERATIONS_HPP
-#define BOOST_GIL_EXTENSION_IO_DETAIL_BIT_OPERATIONS_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-
-namespace boost { namespace gil { namespace detail {
-
-// 1110 1100 -> 0011 0111
-template< typename Buffer
- , typename IsBitAligned
- >
-struct mirror_bits
-{
- mirror_bits( bool ) {}
-
- void operator() ( Buffer& ) {}
-};
-
-
-// The functor will generate a lookup table since the
-// mirror operation is quite costly.
-template< typename Buffer >
-struct mirror_bits< Buffer
- , mpl::true_
- >
-{
- mirror_bits( bool apply_operation = true )
- : _apply_operation( apply_operation )
- {
- if( _apply_operation == true )
- {
- byte_t i = 0;
- do
- {
- _lookup[i] = mirror( i );
- }
- while( i++ != 255 );
- }
- }
-
- void operator() ( Buffer& buf )
- {
- if( _apply_operation == true )
- {
- for_each( buf.begin()
- , buf.end()
- , boost::bind( &mirror_bits< Buffer
- , mpl::true_
- >::lookup
- , *this
- , _1
- )
- );
- }
- }
-
-private:
-
- void lookup( byte_t& c )
- {
- c = _lookup[ c ];
- }
-
- static byte_t mirror( byte_t c )
- {
- byte_t result = 0;
- for( int i = 0; i < 8; ++i )
- {
- result = result << 1;
- result |= ( c & 1 );
- c = c >> 1;
- }
-
- return result;
- }
-
-private:
-
- bool _apply_operation;
-
- array< byte_t, 256 > _lookup;
-};
-
-
-// 0011 1111 -> 1100 0000
-template< typename Buffer
- , typename IsBitAligned
- >
-struct negate_bits
-{
- void operator() ( Buffer& ) {}
-};
-
-template< typename Buffer >
-struct negate_bits< Buffer, mpl::true_ >
-{
- void operator() ( Buffer& buf )
- {
- for_each( buf.begin()
- , buf.end()
- , negate_bits< Buffer, mpl::true_ >::negate
- );
- }
-
-private:
-
- static void negate( byte_t& b )
- {
- b = ~b;
- }
-};
-
-
-// 11101100 -> 11001110
-template< typename Buffer
- , typename IsBitAligned
- >
-struct swap_half_bytes
-{
- void operator() ( Buffer& ) {}
-};
-
-template< typename Buffer >
-struct swap_half_bytes< Buffer
- , mpl::true_
- >
-{
- void operator() ( Buffer& buf )
- {
- for_each( buf.begin()
- , buf.end()
- , swap_half_bytes< Buffer, mpl::true_ >::swap
- );
- }
-
-private:
-
- static void swap( byte_t& c )
- {
- c = (( c << 4 ) & 0xF0 ) | (( c >> 4 ) & 0x0F );
- }
-};
-
-template< typename Buffer >
-struct do_nothing
-{
- do_nothing() {}
-
- void operator() ( Buffer& ) {}
-};
-
-/// Count consecutive zeros on the right
-template< typename T >
-inline
-unsigned int trailing_zeros( T x )
-throw()
-{
- unsigned int n = 0;
-
- x = ~x & (x - 1);
-
- while( x )
- {
- n = n + 1;
- x = x >> 1;
- }
-
- return n;
-}
-
-/// Counts ones in a bit-set
-template< typename T >
-inline
-unsigned int count_ones( T x )
-throw()
-{
- unsigned int n = 0;
-
- while( x )
- {
- // clear the least significant bit set
- x &= x - 1;
- ++n;
- }
-
- return n;
-}
-
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_DETAIL_BIT_OPERATIONS_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/conversion_policies.hpp b/third-party/boost/gil/extension/io_new/detail/conversion_policies.hpp
deleted file mode 100644
index 170d8304..00000000
--- a/third-party/boost/gil/extension/io_new/detail/conversion_policies.hpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- Copyright 2007-2008 Andreas Pokorny, Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_DETAIL_CONVERSION_POLICIES_HPP
-#define BOOST_GIL_EXTENSION_IO_DETAIL_CONVERSION_POLICIES_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Andreas Pokorny, Christian Henning \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-#include
-
-namespace boost{namespace gil{ namespace detail {
-
-struct read_and_no_convert
-{
-public:
- typedef void* color_converter_type;
-
- template< typename InIterator
- , typename OutIterator
- >
- void read( const InIterator& /* begin */
- , const InIterator& /* end */
- , OutIterator /* out */
- , typename disable_if< typename pixels_are_compatible< typename std::iterator_traits::value_type
- , typename std::iterator_traits::value_type
- >::type
- >::type* /* ptr */ = 0
- )
- {
- io_error( "Data cannot be copied because the pixels are incompatible." );
- }
-
- template< typename InIterator
- , typename OutIterator
- >
- void read( const InIterator& begin
- , const InIterator& end
- , OutIterator out
- , typename enable_if< typename pixels_are_compatible< typename std::iterator_traits::value_type
- , typename std::iterator_traits::value_type
- >::type
- >::type* /* ptr */ = 0
- )
- {
- std::copy( begin
- , end
- , out
- );
- }
-
-};
-
-template
-struct read_and_convert
-{
-public:
- typedef CC color_converter_type;
- CC _cc;
-
- read_and_convert( color_converter_type const& cc )
- : _cc(cc) {}
-
- template< typename InIterator
- , typename OutIterator
- >
- void read( const InIterator& begin
- , const InIterator& end
- , OutIterator out
- )
- {
- typedef color_convert_deref_fn< typename std::iterator_traits::reference
- , typename std::iterator_traits::value_type //reference?
- , CC
- > deref_t;
-
- std::transform( begin
- , end
- , out
- , deref_t( _cc )
- );
- }
-};
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_DETAIL_CONVERSION_POLICIES_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/dynamic_io_new.hpp b/third-party/boost/gil/extension/io_new/detail/dynamic_io_new.hpp
deleted file mode 100644
index bed2540c..00000000
--- a/third-party/boost/gil/extension/io_new/detail/dynamic_io_new.hpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- Copyright 2005-2007 Adobe Systems Incorporated
-
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-
- See http://opensource.adobe.com/gil for most recent version including documentation.
-*/
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_TOOLBOX_DYNAMIC_IMAGES_HPP_INCLUDED
-#define BOOST_GIL_EXTENSION_TOOLBOX_DYNAMIC_IMAGES_HPP_INCLUDED
-
-/// \file
-/// \brief Generic io functions for dealing with dynamic images
-//
-/// \author Hailin Jin and Lubomir Bourdev \n
-/// Adobe Systems Incorporated
-/// \date 2005-2007 \n Last updated May 30, 2006
-
-#include
-#include
-#include
-#include
-#include
-
-namespace boost { namespace gil {
-
-// need this for various meta functions.
-struct any_image_pixel_t {};
-struct any_image_channel_t {};
-struct any_image_color_space_t {};
-
-namespace detail {
-
-template
-struct construct_matched_t {
- template
- static bool apply(any_image& im,Pred pred) {
- if (pred.template apply::type>()) {
- typename mpl::at_c::type x;
- im.move_in(x);
- return true;
- } else return construct_matched_t::apply(im,pred);
- }
-};
-template <>
-struct construct_matched_t<0> {
- template
- static bool apply(any_image&,Pred) {return false;}
-};
-
-// A function object that can be passed to apply_operation.
-// Given a predicate IsSupported taking a view type and returning an MPL boolean,
-// calls the apply method of OpClass with the view if the given view IsSupported, or throws an exception otherwise
-template
-class dynamic_io_fnobj {
- OpClass* _op;
-
- template
- void apply(const View& view,mpl::true_ ) {_op->apply(view);}
-
- template
- void apply( const View& view
- , const Info& info
- , const mpl::true_
- )
- {
- _op->apply( view, info );
- }
-
- template
- void apply(const View& /* view */ ,mpl::false_) {io_error("dynamic_io: unsupported view type for the given file format");}
-
- template
- void apply( const View& /* view */
- , const Info& /* info */
- , const mpl::false_
- )
- {
- io_error( "dynamic_io: unsupported view type for the given file format" );
- }
-
-public:
- dynamic_io_fnobj(OpClass* op) : _op(op) {}
-
- typedef void result_type;
-
- template
- void operator()(const View& view) {apply(view,typename IsSupported::template apply::type());}
-
- template< typename View, typename Info >
- void operator()(const View& view, const Info& info )
- {
- apply( view
- , info
- , typename IsSupported::template apply< View >::type()
- );
- }
-
-};
-
-} // namespace detail
-
-/// \brief Within the any_image, constructs an image with the given dimensions
-/// and a type that satisfies the given predicate
-template
-inline bool construct_matched(any_image& im,Pred pred) {
- return detail::construct_matched_t::value>::apply(im,pred);
-}
-
-} } // namespace boost::gil
-
-#endif // BOOST_GIL_EXTENSION_TOOLBOX_DYNAMIC_IMAGES_HPP_INCLUDED
diff --git a/third-party/boost/gil/extension/io_new/detail/io.hpp b/third-party/boost/gil/extension/io_new/detail/io.hpp
deleted file mode 100644
index da1e7a14..00000000
--- a/third-party/boost/gil/extension/io_new/detail/io.hpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_IO_HPP
-#define BOOST_GIL_EXTENSION_IO_IO_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-/*!
- * \page iobackend Adding a new io backend
- * \section Overview of backend requirements
- * To add support for a new IO backend the following is required:
- * - a format tag, to identify the image format, derived from boost::gil::format_tag
- * - boolean meta function is_supported must be implemented for
- * the new format tag
- * - explicit specialisation of image_read_info must be provided, containing
- * runtime information available before/at reading the image
- * - explicit specialisation of image_write_info must be provided, containing
- * runtime encoding parameters for writing an image
- * - An image reader must be specialized:
- * \code
- * template
- * struct boost::gil::detail::reader
- * {
- * reader( IODevice & device )
- * reader( IODevice & device, typename ConversionPolicy::color_converter_type const& cc )
- * image_read_info get_info();
- * template
- * void read_image( Image &, point_t const& top_left );
- * template
- * void read_view( View &, point_t const& top_left );
- * };
- * \endcode
- * - An image writer must be specialized:
- * \code
- * \template
- * struct boost::gil::detail::writer
- * {
- * writer( IODevice & device )
- * template
- * void apply( View const&, point_t const& top_left );
- * template
- * void apply( View const&, point_t const& top_left, image_write_info const& );
- * };
- * \endcode
- *
- * Or instead of the items above implement overloads of read_view, read_and_convert_view, read_image,
- * read_and_convert_image, write_view and read_image_info.
- *
- * \section ConversionPolicy Interface of the ConversionPolicy
- * There are two different conversion policies in use, when reading images:
- * read_and_convert and read_and_no_convert. ColorConverter
- * can be a user defined color converter.
- *
- * \code
- * struct ConversionPolicy
- * {
- * template
- * void read( InputIterator in_begin, InputIterator in_end,
- * OutputIterator out_end );
- * };
- * \endcode
- *
- * Methods like read_view and read_image are supposed to bail out with an
- * exception instead of converting the image
- *
- * \section IODevice Concept of IO Device
- * A Device is simply an object used to read and write data to and from a stream.
- * The IODevice was added as a template paramter to be able to replace the file_name
- * access functionality. This is only an interim solution, as soon as boost provides
- * a good IO library, interfaces/constraints provided by that library could be used.
- *
- * \code
- * concept IODevice
- * {
- * void IODevice::read( unsigned char* data, int count );
- * void IODevice::write( unsigned char* data, int count );
- * void IODevice::seek(long count, int whence);
- * void IODevice::flush();
- * };
- * \endcode
- *
- * For the time being a boolean meta function must be specialized:
- * \code
- * namespace boost{namespace gil{namespace detail{
- * template
- * struct detail::is_input_device;
- * }}}
- * \endcode
- *
- */
-
-#endif // BOOST_GIL_EXTENSION_IO_IO_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/io_device.hpp b/third-party/boost/gil/extension/io_new/detail/io_device.hpp
deleted file mode 100644
index be8a66af..00000000
--- a/third-party/boost/gil/extension/io_new/detail/io_device.hpp
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- Copyright 2007-2008 Andreas Pokorny, Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_DETAIL_IO_DEVICE_HPP
-#define BOOST_GIL_EXTENSION_IO_DETAIL_IO_DEVICE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Andreas Pokorny, Christian Henning \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-
-#include
-
-#include
-#include "base.hpp"
-
-namespace boost { namespace gil { namespace detail {
-
-template < typename T > struct buff_item
-{
- static const unsigned int size = sizeof( T );
-};
-
-template <> struct buff_item< void >
-{
- static const unsigned int size = 1;
-};
-
-
-/*!
- * Implements the IODevice concept c.f. to \ref IODevice required by Image libraries like
- * libjpeg and libpng.
- *
- * \todo switch to a sane interface as soon as there is
- * something good in boost. I.E. the IOChains library
- * would fit very well here.
- *
- * This implementation is based on FILE*.
- */
-template< typename FormatTag >
-class file_stream_device
-{
-public:
-
- typedef FormatTag _tag_t;
-
-public:
- struct read_tag {};
- struct write_tag {};
-
- file_stream_device( std::string const& file_name, read_tag )
- : file(0),_close(true)
- {
- io_error_if( ( file = fopen( file_name.c_str(), "rb" )) == NULL
- , "file_stream_device: failed to open file" );
- }
-
- file_stream_device( std::string const& file_name, write_tag )
- : file(0),_close(true)
- {
- io_error_if( ( file = fopen( file_name.c_str(), "wb" )) == NULL
- , "file_stream_device: failed to open file" );
- }
-
- file_stream_device( FILE * filep)
- : file(filep),_close(false)
- {
- }
-
- ~file_stream_device()
- {
- if(_close)
- fclose(file);
- }
-
- int getc_unchecked()
- {
- return std::getc( file );
- }
-
- char getc()
- {
- int ch;
-
- if(( ch = std::getc( file )) == EOF )
- io_error( "file_stream_device: unexpected EOF" );
-
- return ( char ) ch;
- }
-
- std::size_t read( byte_t* data
- , std::size_t count )
- {
- return fread( data, 1, static_cast( count ), file );
- }
-
- /// Reads array
- template< typename T
- , int N
- >
- size_t read( T (&buf)[N] )
- {
- return read( buf, N );
- }
-
- /// Reads byte
- uint8_t read_int8() throw()
- {
- byte_t m[1];
-
- read( m );
- return m[0];
- }
-
- /// Reads 16 bit little endian integer
- uint16_t read_int16() throw()
- {
- byte_t m[2];
-
- read( m );
- return (m[1] << 8) | m[0];
- }
-
- /// Reads 32 bit little endian integer
- uint32_t read_int32() throw()
- {
- byte_t m[4];
-
- read( m );
- return (m[3] << 24) | (m[2] << 16) | (m[1] << 8) | m[0];
- }
-
- /// Writes number of elements from a buffer
- template < typename T >
- size_t write(const T *buf, size_t cnt) throw()
- {
- return fwrite( buf, buff_item::size, cnt, file );
- }
-
- /// Writes array
- template < typename T
- , size_t N
- >
- size_t write( const T (&buf)[N] ) throw()
- {
- return write( buf, N );
- }
-
- /// Writes byte
- void write_int8( uint8_t x ) throw()
- {
- byte_t m[1] = { x };
- write(m);
- }
-
- /// Writes 16 bit little endian integer
- void write_int16( uint16_t x ) throw()
- {
- byte_t m[2];
-
- m[0] = byte_t( x >> 0 );
- m[1] = byte_t( x >> 8 );
-
- write( m );
- }
-
- /// Writes 32 bit little endian integer
- void write_int32( uint32_t x ) throw()
- {
- byte_t m[4];
-
- m[0] = byte_t( x >> 0 );
- m[1] = byte_t( x >> 8 );
- m[2] = byte_t( x >> 16 );
- m[3] = byte_t( x >> 24 );
-
- write( m );
- }
-
-
- //!\todo replace with std::ios::seekdir?
- void seek( long count, int whence = SEEK_SET )
- {
- fseek(file, count, whence );
- }
-
- void flush()
- {
- fflush( file );
- }
-
- /// Prints formatted ASCII text
- void print_line( const std::string& line )
- {
- fwrite( line.c_str(), sizeof( char ), line.size(), file );
- }
-
-private:
-
- file_stream_device( file_stream_device const& );
- file_stream_device& operator=( file_stream_device const& );
-
- //@todo: why not fstream?
- FILE* file;
-
- bool _close;
-
-};
-
-
-/**
- * Input stream device
- */
-template< typename FormatTag >
-class istream_device
-{
-public:
- istream_device( std::istream& in )
- : _in( in ) {}
-
- int getc_unchecked()
- {
- return _in.get();
- }
-
- char getc()
- {
- int ch;
-
- if(( ch = _in.get() ) == EOF )
- io_error( "file_stream_device: unexpected EOF" );
-
- return ( char ) ch;
- }
-
- std::size_t read( byte_t* data
- , std::size_t count )
- {
- std::streamsize cr = 0;
-
- do
- {
- _in.peek();
- std::streamsize c = _in.readsome( reinterpret_cast< char* >( data )
- , static_cast< std::streamsize >( count ));
-
- count -= static_cast< std::size_t >( c );
- data += c;
- cr += c;
-
- } while( count && _in );
-
- return static_cast< std::size_t >( cr );
- }
-
- /// Reads array
- template< typename T
- , int N
- >
- size_t read( T (&buf)[N] )
- {
- return read( buf, N );
- }
-
- /// Reads byte
- uint8_t read_int8() throw()
- {
- byte_t m[1];
-
- read( m );
- return m[0];
- }
-
- /// Reads 16 bit little endian integer
- uint16_t read_int16() throw()
- {
- byte_t m[2];
-
- read( m );
- return (m[1] << 8) | m[0];
- }
-
- /// Reads 32 bit little endian integer
- uint32_t read_int32() throw()
- {
- byte_t m[4];
-
- read( m );
- return (m[3] << 24) | (m[2] << 16) | (m[1] << 8) | m[0];
- }
-
- void seek( long count, int whence = SEEK_SET )
- {
- _in.seekg( count
- , whence == SEEK_SET ? std::ios::beg
- :( whence == SEEK_CUR ? std::ios::cur
- : std::ios::end )
- );
- }
-
- void write( const byte_t* data
- , std::size_t count )
- {
- io_error( "Bad io error." );
- }
-
- void flush() {}
-
-private:
-
- std::istream& _in;
-};
-
-/**
- * Output stream device
- */
-template< typename FormatTag >
-class ostream_device
-{
-public:
- ostream_device( std::ostream & out )
- : _out( out )
- {
- }
-
- size_t read( byte_t* data
- , std::size_t count )
- {
- io_error( "Bad io error." );
-
- return 0;
- }
-
- void seek( long count, int whence )
- {
- _out.seekp( count
- , whence == SEEK_SET
- ? std::ios::beg
- : ( whence == SEEK_CUR
- ?std::ios::cur
- :std::ios::end )
- );
- }
-
- void write( const byte_t* data
- , std::size_t count )
- {
- _out.write( reinterpret_cast( data )
- , static_cast( count )
- );
- }
-
- /// Writes array
- template < typename T
- , size_t N
- >
- void write( const T (&buf)[N] ) throw()
- {
- write( buf, N );
- }
-
- /// Writes byte
- void write_int8( uint8_t x ) throw()
- {
- byte_t m[1] = { x };
- write(m);
- }
-
- /// Writes 16 bit little endian integer
- void write_int16( uint16_t x ) throw()
- {
- byte_t m[2];
-
- m[0] = byte_t( x >> 0 );
- m[1] = byte_t( x >> 8 );
-
- write( m );
- }
-
- /// Writes 32 bit little endian integer
- void write_int32( uint32_t x ) throw()
- {
- byte_t m[4];
-
- m[0] = byte_t( x >> 0 );
- m[1] = byte_t( x >> 8 );
- m[2] = byte_t( x >> 16 );
- m[3] = byte_t( x >> 24 );
-
- write( m );
- }
-
- void flush()
- {
- _out << std::flush;
- }
-
- /// Prints formatted ASCII text
- void print_line( const std::string& line )
- {
- _out << line;
- }
-
-
-
-private:
-
- std::ostream& _out;
-};
-
-
-/**
- * Metafunction to detect input devices.
- * Should be replaced by an external facility in the future.
- */
-template< typename IODevice > struct is_input_device : mpl::false_{};
-template< typename FormatTag > struct is_input_device< file_stream_device< FormatTag > > : mpl::true_{};
-template< typename FormatTag > struct is_input_device< istream_device< FormatTag > > : mpl::true_{};
-
-template< typename FormatTag
- , typename T
- , typename D = void
- >
-struct is_adaptable_input_device : mpl::false_{};
-
-template< typename FormatTag
- , typename T
- >
-struct is_adaptable_input_device< FormatTag
- , T
- , typename enable_if< mpl::or_< is_base_and_derived< std::istream, T >
- , is_same < std::istream, T >
- >
- >::type
- > : mpl::true_
-{
- typedef istream_device< FormatTag > device_type;
-};
-
-template< typename FormatTag >
-struct is_adaptable_input_device< FormatTag
- , FILE*
- , void
- >
- : mpl::true_
-{
- typedef file_stream_device< FormatTag > device_type;
-};
-
-
-
-/**
- * Metafunction to detect output devices.
- * Should be replaced by an external facility in the future.
- */
-template struct is_output_device : mpl::false_{};
-
-template< typename FormatTag > struct is_output_device< file_stream_device< FormatTag > > : mpl::true_{};
-template< typename FormatTag > struct is_output_device< ostream_device < FormatTag > > : mpl::true_{};
-
-template< typename FormatTag
- , typename IODevice
- , typename D = void
- >
-struct is_adaptable_output_device : mpl::false_ {};
-
-template< typename FormatTag
- , typename T
- > struct is_adaptable_output_device< FormatTag
- , T
- , typename enable_if< mpl::or_< is_base_and_derived< std::ostream, T >
- , is_same < std::ostream, T >
- >
- >::type
- > : mpl::true_
-{
- typedef ostream_device< FormatTag > device_type;
-};
-
-template struct is_adaptable_output_device
- : mpl::true_
-{
- typedef file_stream_device< FormatTag > device_type;
-};
-
-template< typename Device, typename FormatTag, typename ConversionPolicy > class reader;
-template< typename Device, typename FormatTag, typename Log = no_log > class writer;
-
-template< typename Device, typename FormatTag > class dynamic_image_reader;
-template< typename Device, typename FormatTag, typename Log = no_log > class dynamic_image_writer;
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_DETAIL_IO_DEVICE_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/io_error.hpp b/third-party/boost/gil/extension/io_new/detail/io_error.hpp
deleted file mode 100644
index b6c6e11a..00000000
--- a/third-party/boost/gil/extension/io_new/detail/io_error.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_DETAIL_IO_ERROR_HPP
-#define BOOST_GIL_EXTENSION_IO_DETAIL_IO_ERROR_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2010 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-namespace boost { namespace gil { namespace detail {
-
-inline
-void io_error( const std::string& descr )
-{
- throw std::ios_base::failure( descr );
-}
-
-inline
-void io_error_if( bool expr, const std::string& descr )
-{
- if( expr )
- io_error( descr );
-}
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_DETAIL_IO_ERROR_HPP
\ No newline at end of file
diff --git a/third-party/boost/gil/extension/io_new/detail/path_spec.hpp b/third-party/boost/gil/extension/io_new/detail/path_spec.hpp
deleted file mode 100644
index 9a6c030e..00000000
--- a/third-party/boost/gil/extension/io_new/detail/path_spec.hpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- Copyright 2007-2008 Andreas Pokorny, Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_DETAIL_PATH_SPEC_HPP
-#define BOOST_GIL_EXTENSION_IO_DETAIL_PATH_SPEC_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Andreas Pokorny, Christian Henning \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-
-#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
-#include
-#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
-namespace boost{ namespace gil{ namespace detail{
-
-template struct is_supported_path_spec : mpl::false_ {};
-template<> struct is_supported_path_spec< std::string > : mpl::true_ {};
-template<> struct is_supported_path_spec< std::wstring > : mpl::true_ {};
-template<> struct is_supported_path_spec< const char* > : mpl::true_ {};
-template<> struct is_supported_path_spec< char* > : mpl::true_ {};
-
-template struct is_supported_path_spec : mpl::true_ {};
-template struct is_supported_path_spec : mpl::true_ {};
-
-#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
-template
-struct is_supported_path_spec > : mpl::true_
-{};
-#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
-
-inline std::string convert_to_string( std::string const& obj)
-{
- return obj;
-}
-
-inline std::string convert_to_string( std::wstring const& s )
-{
- std::size_t len = wcslen( s.c_str() );
- char* c = reinterpret_cast( alloca( len ));
- wcstombs( c, s.c_str(), len );
-
- return std::string( c, c + len );
-}
-
-inline std::string convert_to_string( const char* str )
-{
- return std::string( str );
-}
-
-inline std::string convert_to_string( char* str )
-{
- return std::string( str );
-}
-
-#ifdef BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
-template
-inline std::string convert_to_string( filesystem::basic_path const& path )
-{
- return convert_to_string( path.string() );
-}
-#endif // BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
-
-}}}
-
-#endif // BOOST_GIL_EXTENSION_IO_DETAIL_PATH_SPEC_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/read_and_convert_image.hpp b/third-party/boost/gil/extension/io_new/detail/read_and_convert_image.hpp
deleted file mode 100644
index 46e50c0c..00000000
--- a/third-party/boost/gil/extension/io_new/detail/read_and_convert_image.hpp
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_READ_AND_CONVERT_IMAGE_HPP
-#define BOOST_GIL_EXTENSION_IO_READ_AND_CONVERT_IMAGE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-#include
-
-#include "base.hpp"
-#include "io_device.hpp"
-#include "path_spec.hpp"
-#include "conversion_policies.hpp"
-
-namespace boost{ namespace gil {
-
-/// \ingroup IO
-
-/// \brief Reads and color-converts an image. Image memory is allocated.
-/// \param file It's a device. Must satisfy is_input_device metafunction.
-/// \param img The image in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \param cc Color converter function object.
-/// \throw std::ios_base::failure
-template< typename Device
- , typename Image
- , typename ColorConverter
- , typename FormatTag
- >
-inline
-void read_and_convert_image( Device& file
- , Image& img
- , const image_read_settings< FormatTag >& settings
- , const ColorConverter& cc
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_input_device< Device >
- >
- >::type* /* ptr */ = 0
- )
-{
- typedef detail::read_and_convert< ColorConverter > reader_color_convert;
-
- detail::reader< Device
- , FormatTag
- , reader_color_convert
- > reader( file
- , cc
- , settings
- );
-
- reader.init_image( img
- , reader.get_info()
- );
-
- reader.apply( view( img ));
-}
-
-/// \brief Reads and color-converts an image. Image memory is allocated.
-/// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
-/// \param img The image in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \param cc Color converter function object.
-/// \throw std::ios_base::failure
-template< typename Device
- , typename Image
- , typename ColorConverter
- , typename FormatTag
- >
-inline
-void read_and_convert_image( Device& file
- , Image& img
- , const image_read_settings< FormatTag >& settings
- , const ColorConverter& cc
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_adaptable_input_device< FormatTag
- , Device
- >
- >
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::is_adaptable_input_device< FormatTag
- , Device
- >::device_type device_type;
- device_type dev( file );
-
- read_and_convert_image( dev
- , img
- , settings
- , cc
- );
-}
-
-/// \brief Reads and color-converts an image. Image memory is allocated.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param img The image in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \param cc Color converter function object.
-/// \throw std::ios_base::failure
-template < typename String
- , typename Image
- , typename ColorConverter
- , typename FormatTag
- >
-inline
-void read_and_convert_image( const String& file_name
- , Image& img
- , const image_read_settings< FormatTag >& settings
- , const ColorConverter& cc
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_supported_path_spec< String >
- >
- >::type* /* ptr */ = 0
- )
-{
- detail::file_stream_device< FormatTag > device( detail::convert_to_string( file_name )
- , typename detail::file_stream_device< FormatTag >::read_tag()
- );
-
- read_and_convert_image( device
- , img
- , settings
- , cc
- );
-}
-
-/// \brief Reads and color-converts an image. Image memory is allocated.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param img The image in which the data is read into.
-/// \param cc Color converter function object.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename String
- , typename Image
- , typename ColorConverter
- , typename FormatTag
- >
-inline
-void read_and_convert_image( const String& file_name
- , Image& img
- , const ColorConverter& cc
- , const FormatTag&
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_supported_path_spec< String >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_and_convert_image( file_name
- , img
- , image_read_settings< FormatTag >()
- , cc
- );
-}
-
-/// \brief Reads and color-converts an image. Image memory is allocated.
-/// \param file It's a device. Must satisfy is_input_device metafunction or is_adaptable_input_device.
-/// \param img The image in which the data is read into.
-/// \param cc Color converter function object.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename Image
- , typename ColorConverter
- , typename FormatTag
- >
-inline
-void read_and_convert_image( Device& device
- , Image& img
- , const ColorConverter& cc
- , const FormatTag&
- , typename enable_if< mpl::and_< mpl::or_< detail::is_input_device< Device >
- , detail::is_adaptable_input_device< FormatTag
- , Device
- >
- >
- , is_format_tag< FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_and_convert_image( device
- , img
- , image_read_settings< FormatTag >()
- , cc
- );
-}
-
-/// \brief Reads and color-converts an image. Image memory is allocated. Default color converter is used.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param img The image in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \throw std::ios_base::failure
-template < typename String
- , typename Image
- , typename FormatTag
- >
-inline
-void read_and_convert_image( const String& file_name
- , Image& img
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_supported_path_spec< String >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_and_convert_image( file_name
- , img
- , settings
- , default_color_converter()
- );
-}
-
-/// \brief Reads and color-converts an image. Image memory is allocated. Default color converter is used.
-/// \param file It's a device. Must satisfy is_input_device metafunction or is_adaptable_input_device.
-/// \param img The image in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename Image
- , typename FormatTag
- >
-inline
-void read_and_convert_image( Device& device
- , Image& img
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< mpl::or_< detail::is_input_device< Device >
- , detail::is_adaptable_input_device< FormatTag
- , Device
- >
- >
- , is_format_tag< FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_and_convert_image( device
- , img
- , settings
- , default_color_converter()
- );
-}
-
-/// \brief Reads and color-converts an image. Image memory is allocated. Default color converter is used.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param img The image in which the data is read into.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename String
- , typename Image
- , typename FormatTag
- >
-inline
-void read_and_convert_image( const String& file_name
- , Image& img
- , const FormatTag&
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_supported_path_spec< String >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_and_convert_image( file_name
- , img
- , image_read_settings< FormatTag >()
- , default_color_converter()
- );
-}
-
-/// \brief Reads and color-converts an image. Image memory is allocated. Default color converter is used.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param img The image in which the data is read into.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename Image
- , typename FormatTag
- >
-inline
-void read_and_convert_image( Device& device
- , Image& img
- , const FormatTag&
- , typename enable_if< mpl::and_< mpl::or_< detail::is_input_device< Device >
- , detail::is_adaptable_input_device< FormatTag
- , Device
- >
- >
- , is_format_tag< FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_and_convert_image( device
- , img
- , image_read_settings< FormatTag >()
- , default_color_converter()
- );
-}
-
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_READ_AND_CONVERT_IMAGE_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/read_and_convert_view.hpp b/third-party/boost/gil/extension/io_new/detail/read_and_convert_view.hpp
deleted file mode 100644
index b60a1020..00000000
--- a/third-party/boost/gil/extension/io_new/detail/read_and_convert_view.hpp
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_READ_AND_CONVERT_VIEW_HPP
-#define BOOST_GIL_EXTENSION_IO_READ_AND_CONVERT_VIEW_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-#include
-
-#include "base.hpp"
-#include "io_device.hpp"
-#include "path_spec.hpp"
-#include "conversion_policies.hpp"
-
-namespace boost{ namespace gil {
-
-/// \ingroup IO
-
-/// \brief Reads and color-converts an image view. No memory is allocated.
-/// \param file It's a device. Must satisfy is_input_device metafunction.
-/// \param view The image view in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \param cc Color converter function object.
-/// \throw std::ios_base::failure
-template< typename Device
- , typename View
- , typename ColorConverter
- , typename FormatTag
- >
-inline
-void read_and_convert_view( Device& file
- , const View& view
- , const image_read_settings< FormatTag >& settings
- , const ColorConverter& cc
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_input_device< Device >
- >
- >::type* /* ptr */ = 0
- )
-{
- typedef detail::read_and_convert< ColorConverter > reader_color_convert;
-
- detail::reader< Device
- , FormatTag
- , reader_color_convert
- > reader( file
- , cc
- , settings
- );
-
- reader.init_view( view
- , reader.get_info()
- );
-
- reader.apply( view );
-}
-
-/// \brief Reads and color-converts an image view. No memory is allocated.
-/// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
-/// \param view The image view in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \param cc Color converter function object.
-/// \throw std::ios_base::failure
-template< typename Device
- , typename View
- , typename ColorConverter
- , typename FormatTag
- >
-inline
-void read_and_convert_view( Device& file
- , const View& view
- , const image_read_settings< FormatTag >& settings
- , const ColorConverter& cc
- , typename enable_if< mpl::and_< detail::is_adaptable_input_device< FormatTag
- , Device
- >
- , is_format_tag< FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::is_adaptable_input_device< FormatTag
- , Device
- >::device_type device_type;
-
- device_type dev( file );
-
- read_and_convert_view( dev
- , view
- , settings
- , cc
- );
-}
-
-/// \brief Reads and color-converts an image view. No memory is allocated.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param view The image view in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \param cc Color converter function object.
-/// \throw std::ios_base::failure
-template < typename String
- , typename View
- , typename ColorConverter
- , typename FormatTag
- >
-inline
-void read_and_convert_view( const String& file_name
- , const View& view
- , const image_read_settings< FormatTag >& settings
- , const ColorConverter& cc
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_supported_path_spec< String >
- >
- >::type* /* ptr */ = 0
- )
-{
- detail::file_stream_device< FormatTag > device( detail::convert_to_string( file_name )
- , typename detail::file_stream_device< FormatTag >::read_tag()
- );
-
- read_and_convert_view( device
- , view
- , settings
- , cc
- );
-}
-
-/// \brief Reads and color-converts an image view. No memory is allocated.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param view The image view in which the data is read into.
-/// \param cc Color converter function object.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename String
- , typename View
- , typename ColorConverter
- , typename FormatTag
- >
-inline
-void read_and_convert_view( const String& file_name
- , const View& view
- , const ColorConverter& cc
- , const FormatTag&
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_supported_path_spec< String >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_and_convert_view( file_name
- , view
- , image_read_settings< FormatTag >()
- , cc
- );
-}
-
-/// \brief Reads and color-converts an image view. No memory is allocated.
-/// \param file It's a device. Must satisfy is_input_device metafunction or is_adaptable_input_device.
-/// \param view The image view in which the data is read into.
-/// \param cc Color converter function object.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename View
- , typename ColorConverter
- , typename FormatTag
- >
-inline
-void read_and_convert_view( Device& device
- , const View& view
- , const ColorConverter& cc
- , const FormatTag&
- , typename enable_if< mpl::and_< mpl::or_< detail::is_input_device< Device >
- , detail::is_adaptable_input_device< FormatTag
- , Device
- >
- >
- , is_format_tag< FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_and_convert_view( device
- , view
- , image_read_settings< FormatTag >()
- , cc
- );
-}
-
-/// \brief Reads and color-converts an image view. No memory is allocated.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param view The image view in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \throw std::ios_base::failure
-template < typename String
- , typename View
- , typename FormatTag
- >
-inline
-void read_and_convert_view( const String& file_name
- , const View& view
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_supported_path_spec< String >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_and_convert_view( file_name
- , view
- , settings
- , default_color_converter()
- );
-}
-
-/// \brief Reads and color-converts an image view. No memory is allocated.
-/// \param file It's a device. Must satisfy is_input_device metafunction or is_adaptable_input_device.
-/// \param view The image view in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename View
- , typename FormatTag
- >
-inline
-void read_and_convert_view( Device& device
- , const View& view
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< mpl::or_< detail::is_input_device< Device >
- , detail::is_adaptable_input_device< FormatTag
- , Device
- >
- >
- , is_format_tag< FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_and_convert_view( device
- , view
- , settings
- , default_color_converter()
- );
-}
-
-/// \brief Reads and color-converts an image view. No memory is allocated.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param view The image view in which the data is read into.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename String
- , typename View
- , typename FormatTag
- >
-inline
-void read_and_convert_view( const String& file_name
- , const View& view
- , const FormatTag&
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_supported_path_spec< String >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_and_convert_view( file_name
- , view
- , image_read_settings< FormatTag >()
- , default_color_converter()
- );
-}
-
-/// \brief Reads and color-converts an image view. No memory is allocated.
-/// \param file It's a device. Must satisfy is_input_device metafunction or is_adaptable_input_device.
-/// \param view The image view in which the data is read into.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename View
- , typename FormatTag
- >
-inline
-void read_and_convert_view( Device& device
- , const View& view
- , const FormatTag&
- , typename enable_if< mpl::and_< mpl::or_< detail::is_input_device< Device >
- , detail::is_adaptable_input_device< FormatTag
- , Device
- >
- >
- , is_format_tag< FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_and_convert_view( device
- , view
- , image_read_settings< FormatTag >()
- , default_color_converter()
- );
-}
-
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_READ_AND_CONVERT_VIEW_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/read_image.hpp b/third-party/boost/gil/extension/io_new/detail/read_image.hpp
deleted file mode 100644
index 09d92f84..00000000
--- a/third-party/boost/gil/extension/io_new/detail/read_image.hpp
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_READ_IMAGE_HPP
-#define BOOST_GIL_EXTENSION_IO_READ_IMAGE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-#include
-
-#include
-
-#include "base.hpp"
-#include "io_device.hpp"
-#include "path_spec.hpp"
-#include "conversion_policies.hpp"
-
-namespace boost{ namespace gil {
-
-/// \ingroup IO
-
-/// \brief Reads an image without conversion. Image memory is allocated.
-/// \param file It's a device. Must satisfy is_input_device metafunction.
-/// \param img The image in which the data is read into. Must satisfy is_read_supported metafunction.
-/// \param settings Specifies read settings depending on the image format.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename Image
- , typename FormatTag
- >
-inline
-void read_image( Device& file
- , Image& img
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< detail::is_input_device< Device >
- , is_format_tag < FormatTag >
- , is_read_supported < typename get_pixel_type< typename Image::view_t >::type
- , FormatTag
- >
- >
- >::type* /* ptr */ = 0
- )
-{
- detail::reader< Device
- , FormatTag
- , detail::read_and_no_convert
- > reader( file
- , settings
- );
-
- reader.init_image( img
- , reader.get_info()
- );
-
- reader.apply( view( img ));
-}
-
-/// \brief Reads an image without conversion. Image memory is allocated.
-/// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
-/// \param img The image in which the data is read into. Must satisfy is_read_supported metafunction.
-/// \param settings Specifies read settings depending on the image format.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename Image
- , typename FormatTag
- >
-inline
-void read_image( Device& file
- , Image& img
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< detail::is_adaptable_input_device< FormatTag
- , Device
- >
- , is_format_tag< FormatTag >
- , is_read_supported< typename get_pixel_type< typename Image::view_t >::type
- , FormatTag
- >
- >
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::is_adaptable_input_device< FormatTag
- , Device
- >::device_type device_type;
-
- device_type dev(file);
- detail::reader< device_type
- , FormatTag
- , detail::read_and_no_convert
- > reader( dev
- , settings
- );
-
- reader.init_image( img
- , reader.get_info()
- );
-
- reader.apply( view( img ));
-}
-
-/// \brief Reads an image without conversion. Image memory is allocated.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param img The image in which the data is read into. Must satisfy is_read_supported metafunction.
-/// \param settings Specifies read settings depending on the image format.
-/// \throw std::ios_base::failure
-template < typename String
- , typename Image
- , typename FormatTag
- >
-inline
-void read_image( const String& file_name
- , Image& img
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< detail::is_supported_path_spec< String >
- , is_format_tag< FormatTag >
- , is_read_supported< typename get_pixel_type< typename Image::view_t >::type
- , FormatTag
- >
- >
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::file_stream_device::read_tag read_tag;
-
- detail::file_stream_device device( detail::convert_to_string( file_name )
- , read_tag()
- );
-
- read_image( device
- , img
- , settings
- );
-}
-
-/// \brief Reads an image without conversion. Image memory is allocated.
-/// \param file It's a device. Must satisfy is_input_device metafunction.
-/// \param img The image in which the data is read into. Must satisfy is_read_supported metafunction.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename Image
- , typename FormatTag
- >
-inline
-void read_image( Device& file
- , Image& img
- , const FormatTag&
- , typename enable_if< mpl::and_< detail::is_input_device< Device >
- , is_format_tag < FormatTag >
- , is_read_supported < typename get_pixel_type< typename Image::view_t >::type
- , FormatTag
- >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_image( file
- , img
- , image_read_settings< FormatTag >()
- );
-}
-
-/// \brief Reads an image without conversion. Image memory is allocated.
-/// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
-/// \param img The image in which the data is read into. Must satisfy is_read_supported metafunction.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename Image
- , typename FormatTag
- >
-inline
-void read_image( Device& file
- , Image& img
- , const FormatTag&
- , typename enable_if< mpl::and_< detail::is_adaptable_input_device< FormatTag
- , Device
- >
- , is_format_tag< FormatTag >
- , is_read_supported< typename get_pixel_type< typename Image::view_t >::type
- , FormatTag
- >
- >
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::is_adaptable_input_device< FormatTag, Device >::device_type device_type;
- device_type dev( file );
-
- read_image( dev
- , img
- , image_read_settings< FormatTag >()
- );
-}
-
-/// \brief Reads an image without conversion. Image memory is allocated.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param img The image in which the data is read into. Must satisfy is_read_supported metafunction.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename String
- , typename Image
- , typename FormatTag
- >
-inline
-void read_image( const String& file_name
- , Image& img
- , const FormatTag&
- , typename enable_if< mpl::and_< detail::is_supported_path_spec< String >
- , is_format_tag< FormatTag >
- , is_read_supported< typename get_pixel_type< typename Image::view_t >::type
- , FormatTag
- >
- >
- >::type* /* ptr */ = 0
- )
-{
- detail::file_stream_device< FormatTag > device( detail::convert_to_string( file_name )
- , typename detail::file_stream_device< FormatTag >::read_tag()
- );
-
- read_image( device
- , img
- , image_read_settings< FormatTag >()
- );
-}
-
-///////////////////////////// dynamic images
-
-/// \brief Reads an image without conversion. Image memory is allocated.
-/// \param file It's a device. Must satisfy is_input_device metafunction.
-/// \param images Dynamic image ( mpl::vector ). See boost::gil::dynamic_image extension.
-/// \param settings Specifies read settings depending on the image format.
-template < typename Device
- , typename Images
- , typename FormatTag
- >
-inline
-void read_image( Device& file
- , any_image< Images >& images
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< detail::is_input_device< Device >
- , is_format_tag < FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- detail::dynamic_image_reader< Device
- , FormatTag
- > dyn_reader( file
- , settings
- );
-
- dyn_reader.init_image( images
- , dyn_reader.get_info()
- );
-
- dyn_reader.apply( images );
-}
-
-/// \brief Reads an image without conversion. Image memory is allocated.
-/// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
-/// \param images Dynamic image ( mpl::vector ). See boost::gil::dynamic_image extension.
-/// \param settings Specifies read settings depending on the image format.
-/// \throw std::ios_base::failure
-
-template < typename Device
- , typename Images
- , typename FormatTag
- >
-inline
-void read_image( Device& file
- , any_image< Images >& images
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< detail::is_adaptable_input_device< FormatTag
- , Device
- >
- , is_format_tag< FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::is_adaptable_input_device< FormatTag
- , Device
- >::device_type device_type;
- device_type dev( file );
-
- detail::reader< device_type
- , FormatTag
- , detail::read_and_no_convert
- > reader( dev
- , settings
- );
-
- reader.init_image( images
- , reader.get_info
- );
-
- reader.apply( view( images ));
-}
-
-/// \brief Reads an image without conversion. Image memory is allocated.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param images Dynamic image ( mpl::vector ). See boost::gil::dynamic_image extension.
-/// \param settings Specifies read settings depending on the image format.
-/// \throw std::ios_base::failure
-template < typename String
- , typename Images
- , typename FormatTag
- >
-inline
-void read_image( const String& file_name
- , any_image< Images >& images
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< detail::is_supported_path_spec< String >
- , is_format_tag< FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::file_stream_device< FormatTag >::read_tag read_tag;
-
- detail::file_stream_device device( detail::convert_to_string( file_name )
- , read_tag()
- );
-
- read_image( device
- , images
- , settings
- );
-}
-
-/// \brief Reads an image without conversion. Image memory is allocated.
-/// \param file It's a device. Must satisfy is_input_device metafunction.
-/// \param images Dynamic image ( mpl::vector ). See boost::gil::dynamic_image extension.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename Images
- , typename FormatTag
- >
-inline
-void read_image( Device& file
- , any_image< Images >& images
- , const FormatTag&
- , typename enable_if< mpl::and_< detail::is_input_device< Device >
- , is_format_tag < FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- read_image( file
- , images
- , image_read_settings< FormatTag >()
- );
-}
-
-/// \brief Reads an image without conversion. Image memory is allocated.
-/// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
-/// \param images Dynamic image ( mpl::vector ). See boost::gil::dynamic_image extension.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename Images
- , typename FormatTag
- >
-inline
-void read_image( Device& file
- , any_image< Images >& images
- , const FormatTag&
- , typename enable_if< mpl::and_< detail::is_adaptable_input_device< FormatTag
- , Device
- >
- , is_format_tag< FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::is_adaptable_input_device< FormatTag
- , Device
- >::device_type device_type;
- device_type dev( file );
-
- read_image( dev
- , images
- , image_read_settings< FormatTag >()
- );
-}
-
-/// \brief Reads an image without conversion. Image memory is allocated.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param images Dynamic image ( mpl::vector ). See boost::gil::dynamic_image extension.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename String
- , typename Images
- , typename FormatTag
- >
-inline
-void read_image( const String& file_name
- , any_image< Images >& images
- , const FormatTag&
- , typename enable_if< mpl::and_< detail::is_supported_path_spec< String >
- , is_format_tag< FormatTag >
- >
- >::type* /* ptr */ = 0
- )
-{
- detail::file_stream_device< FormatTag > device( detail::convert_to_string( file_name )
- , typename detail::file_stream_device< FormatTag >::read_tag()
- );
-
- read_image( device
- , images
- , image_read_settings< FormatTag >()
- );
-}
-
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_READ_IMAGE_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/read_image_info.hpp b/third-party/boost/gil/extension/io_new/detail/read_image_info.hpp
deleted file mode 100644
index 4c721cd1..00000000
--- a/third-party/boost/gil/extension/io_new/detail/read_image_info.hpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_IMAGE_READ_INFO_HPP
-#define BOOST_GIL_EXTENSION_IO_IMAGE_READ_INFO_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-#include
-
-#include "base.hpp"
-#include "io_device.hpp"
-#include "path_spec.hpp"
-
-namespace boost{ namespace gil {
-
-/// \ingroup IO
-
-/// \brief Returns the image info. Image info is file format specific.
-/// \param file It's a device. Must satisfy is_input_device metafunction.
-/// \param settings Specifies read settings depending on the image format.
-/// \return image_read_info object dependent on the image format.
-/// \throw std::ios_base::failure
-template< typename Device
- , typename FormatTag
- >
-inline
-image_read_info< FormatTag >
-read_image_info( Device& file
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_input_device< Device >
- >
- >::type* /* ptr */ = 0
- )
-{
- return detail::reader< Device
- , FormatTag
- , detail::read_and_no_convert
- >( file
- , settings
- ).get_info();
-}
-
-/// \brief Returns the image info. Image info is file format specific.
-/// \param file It's a device. Must satisfy is_input_device metafunction.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \return image_read_info object dependent on the image format.
-/// \throw std::ios_base::failure
-template< typename Device
- , typename FormatTag
- >
-inline
-image_read_info< FormatTag >
-read_image_info( Device& file
- , const FormatTag&
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_input_device< Device >
- >
- >::type* /* ptr */ = 0
- )
-{
- return read_image_info( file
- , image_read_settings< FormatTag >()
- );
-}
-
-
-/// \brief Returns the image info. Image info is file format specific.
-/// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
-/// \param settings Specifies read settings depending on the image format.
-/// \return image_read_info object dependent on the image format.
-/// \throw std::ios_base::failure
-template< typename Device
- , typename FormatTag
- >
-inline
-image_read_info
-read_image_info( Device& file
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_adaptable_input_device< FormatTag
- , Device
- >
- >
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::is_adaptable_input_device< FormatTag
- , Device
- >::device_type device_type;
-
- device_type dev( file );
-
- return detail::reader< device_type
- , FormatTag
- , detail::read_and_no_convert
- >( dev
- , settings
- ).get_info();
-}
-
-/// \brief Returns the image info. Image info is file format specific.
-/// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \return image_read_info object dependent on the image format.
-/// \throw std::ios_base::failure
-template< typename Device
- , typename FormatTag
- >
-inline
-image_read_info< FormatTag >
-read_image_info( Device& file
- , const FormatTag&
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_adaptable_input_device< FormatTag
- , Device
- >
- >
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::is_adaptable_input_device< FormatTag
- , Device
- >::device_type device_type;
-
- device_type dev( file );
-
- return read_image_info( dev
- , image_read_settings< FormatTag >()
- );
-}
-
-/// \brief Returns the image info. Image info is file format specific.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param settings Specifies read settings depending on the image format.
-/// \return image_read_info object dependent on the image format.
-/// \throw std::ios_base::failure
-template< typename String
- , typename FormatTag
- >
-inline
-image_read_info< FormatTag >
-read_image_info( const String& file_name
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_supported_path_spec< String >
- >
- >::type* /* ptr */ = 0
- )
-{
- detail::file_stream_device< FormatTag > reader( detail::convert_to_string( file_name )
- , typename detail::file_stream_device< FormatTag >::read_tag()
- );
-
- return read_image_info( reader
- , settings
- );
-}
-
-/// \brief Returns the image info. Image info is file format specific.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \return image_read_info object dependent on the image format.
-/// \throw std::ios_base::failure
-template< typename String
- , typename FormatTag
- >
-inline
-image_read_info< FormatTag >
-read_image_info( const String& file_name
- , const FormatTag&
- , typename enable_if< mpl::and_< is_format_tag< FormatTag >
- , detail::is_supported_path_spec< String >
- >
- >::type* /* ptr */ = 0
- )
-{
- detail::file_stream_device< FormatTag > reader( detail::convert_to_string( file_name )
- , typename detail::file_stream_device< FormatTag >::read_tag()
- );
-
- return read_image_info( reader
- , image_read_settings< FormatTag >()
- );
-}
-
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_IMAGE_READ_INFO_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/read_view.hpp b/third-party/boost/gil/extension/io_new/detail/read_view.hpp
deleted file mode 100644
index 8ffe5ea3..00000000
--- a/third-party/boost/gil/extension/io_new/detail/read_view.hpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_READ_VIEW_HPP
-#define BOOST_GIL_EXTENSION_IO_READ_VIEW_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-#include
-
-#include "base.hpp"
-#include "io_device.hpp"
-#include "path_spec.hpp"
-
-namespace boost{ namespace gil {
-
-/// \ingroup IO
-
-/// \brief Reads an image view without conversion. No memory is allocated.
-/// \param file It's a device. Must satisfy is_input_device metafunction.
-/// \param view The image view in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename View
- , typename FormatTag
- >
-inline
-void read_view( Device& file
- , const View& view
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< typename mpl::and_< typename detail::is_input_device< Device >::type
- , typename is_format_tag < FormatTag >::type
- , typename is_read_supported < typename get_pixel_type< View >::type
- , FormatTag
- >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- detail::reader< Device
- , FormatTag
- , detail::read_and_no_convert
- > reader( file
- , settings
- );
-
- reader.init_view( view
- , reader.get_info()
- );
-
- reader.apply( view );
-}
-
-/// \brief Reads an image view without conversion. No memory is allocated.
-/// \param file It's a device. Must satisfy is_adaptable_input_device metafunction.
-/// \param view The image view in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \throw std::ios_base::failure
-template < typename Device
- , typename View
- , typename FormatTag
- >
-inline
-void read_view( Device& file
- , const View& view
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< typename mpl::and_< typename detail::is_adaptable_input_device< FormatTag
- , Device
- >::type
- , typename is_format_tag::type
- , typename is_read_supported< typename get_pixel_type< View >::type
- , FormatTag
- >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::is_adaptable_input_device< FormatTag
- , Device
- >::device_type device_type;
-
- device_type dev( file );
-
- detail::reader< device_type
- , FormatTag
- , detail::read_and_no_convert
- > reader( dev
- , settings
- );
-
- reader.init_view( view
- , reader.get_info()
- );
-
- reader.apply( view );
-}
-
-/// \brief Reads an image view without conversion. No memory is allocated.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param view The image view in which the data is read into.
-/// \param settings Specifies read settings depending on the image format.
-/// \throw std::ios_base::failure
-template < typename String
- , typename View
- , typename FormatTag
- >
-inline
-void read_view( const String& file_name
- , const View& view
- , const image_read_settings< FormatTag >& settings
- , typename enable_if< typename mpl::and_< typename detail::is_supported_path_spec< String >::type
- , typename is_format_tag< FormatTag >::type
- , typename is_read_supported< typename get_pixel_type< View >::type
- , FormatTag
- >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- detail::file_stream_device device( detail::convert_to_string( file_name )
- , typename detail::file_stream_device< FormatTag >::read_tag()
- );
-
- read_view( device
- , view
- , settings
- );
-}
-
-/// \brief Reads an image view without conversion. No memory is allocated.
-/// \param file_name File name. Must satisfy is_supported_path_spec metafunction.
-/// \param view The image view in which the data is read into.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template < typename String
- , typename View
- , typename FormatTag
- >
-inline
-void read_view( const String& file_name
- , const View& view
- , const FormatTag&
- , typename enable_if< typename mpl::and_< typename detail::is_supported_path_spec< String >::type
- , typename is_format_tag< FormatTag >::type
- , typename is_read_supported< typename get_pixel_type< View >::type
- , FormatTag
- >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- read_view( file_name
- , view
- , image_read_settings< FormatTag >()
- );
-}
-
-/// \brief Reads an image view without conversion. No memory is allocated.
-/// \param file It's a device. Must satisfy is_input_device metafunction or is_adaptable_input_device.
-/// \param view The image view in which the data is read into.
-/// \param tag Defines the image format. Must satisfy is_format_tag metafunction.
-/// \throw std::ios_base::failure
-template< typename Device
- , typename View
- , typename FormatTag
- >
-inline
-void read_view( Device& device
- , const View& view
- , const FormatTag&
- , typename enable_if< typename mpl::and_< typename is_format_tag< FormatTag >::type
- , typename mpl::or_< typename detail::is_input_device< Device >::type
- , typename detail::is_adaptable_input_device< FormatTag
- , Device
- >::type
- >::type
- , typename is_read_supported< typename get_pixel_type< View >::type
- , FormatTag
- >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- read_view( device
- , view
- , image_read_settings< FormatTag >()
- );
-}
-
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_READ_VIEW_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/reader_base.hpp b/third-party/boost/gil/extension/io_new/detail/reader_base.hpp
deleted file mode 100644
index a8d6abd2..00000000
--- a/third-party/boost/gil/extension/io_new/detail/reader_base.hpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_DETAIL_READER_BASE_HPP
-#define BOOST_GIL_EXTENSION_IO_DETAIL_READER_BASE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include "base.hpp"
-
-namespace boost { namespace gil { namespace detail {
-
-/// Reader Base Class
-///
-/// It provides some basic functionality which is shared for all readers.
-/// For instance, it recreates images when necessary. It checks whether
-/// user supplied coordinates are valid.
-///
-/// @tparam FormatTag A format tag, like jpeg_tag.
-/// @tparam ConversionPolicy Conversion policy, see coversion_policies.hpp.
-template< typename FormatTag
- , typename ConversionPolicy
- >
-struct reader_base
-{
-public:
-
- /// Initializes an image. But also does some check ups.
- ///
- /// @tparam Image Image which implements boost::gil's ImageConcept.
- ///
- /// @param img The image.
- /// @param info The image read info.
- template< typename Image >
- void init_image( Image& img
- , const image_read_info< FormatTag >& info
- )
- {
- _info = info;
-
- setup( _settings._dim );
-
- img.recreate( _settings._dim.x
- , _settings._dim.y
- );
- }
-
- template< typename View >
- void init_view( const View& view
- , const image_read_info< FormatTag >& info
- )
- {
- _info = info;
-
- setup( view.dimensions() );
- }
-
-protected:
-
- reader_base( const image_read_settings< FormatTag >& settings )
- : _settings( settings )
- {}
- reader_base( const typename ConversionPolicy::color_converter_type& cc
- , const image_read_settings< FormatTag >& settings
- )
- : _settings( settings )
- , _cc_policy( cc )
- {}
-
-private:
-
- void setup( const point_t& dim )
- {
- check_coordinates( dim );
-
- if( dim == point_t( 0, 0 ))
- {
- _settings._dim.x = _info._width;
- _settings._dim.y = _info._height;
- }
- else
- {
- _settings._dim = dim;
- }
- }
-
- void check_coordinates( const point_t& dim )
- {
- typedef point_t::value_type int_t;
-
- int_t width = static_cast< int_t >( _info._width );
- int_t height = static_cast< int_t >( _info._height );
-
- io_error_if( ( _settings._top_left.x < 0
- || _settings._top_left.y < 0
- || dim.x < 0
- || dim.y < 0
- )
- , "User provided view has incorrect size." );
-
-
- io_error_if( ( ( width ) < _settings._top_left.x
- && ( width ) <= dim.x
- && ( height ) < _settings._top_left.y
- && ( height ) <= dim.y )
- , "User provided view has incorrect size." );
-
- io_error_if( ( ( _settings._top_left.x + dim.x ) > width
- || ( _settings._top_left.y + dim.y ) > height
- )
- , "User provided view has incorrect size." );
-
- }
-
-protected:
-
- image_read_settings< FormatTag > _settings;
- image_read_info< FormatTag > _info;
-
- ConversionPolicy _cc_policy;
-};
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_DETAIL_READER_BASE_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/row_buffer_helper.hpp b/third-party/boost/gil/extension/io_new/detail/row_buffer_helper.hpp
deleted file mode 100644
index 1e1752f1..00000000
--- a/third-party/boost/gil/extension/io_new/detail/row_buffer_helper.hpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_DETAIL_READ_HELPER_HPP
-#define BOOST_GIL_EXTENSION_IO_DETAIL_READ_HELPER_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief Helper for having one read implementation used for
-/// bit_aligned and byte images.
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-
-#include "typedefs.hpp"
-
-
-namespace boost { namespace gil { namespace detail {
-
-template< typename Pixel
- , typename DummyT = void
- >
-struct row_buffer_helper
-{
- typedef Pixel element_t;
- typedef std::vector< element_t > buffer_t;
- typedef typename buffer_t::iterator iterator_t;
-
- row_buffer_helper( std::size_t width
- , bool
- )
- : _row_buffer( width )
- {}
-
- element_t* data() { return &_row_buffer[0]; }
-
- iterator_t begin() { return _row_buffer.begin(); }
- iterator_t end() { return _row_buffer.end(); }
-
- buffer_t& buffer() { return _row_buffer; }
-
-private:
-
- buffer_t _row_buffer;
-};
-
-template
-struct row_buffer_helper< Pixel
- , typename enable_if< typename mpl::and_< typename is_bit_aligned< Pixel >::type
- , typename is_homogeneous< Pixel >::type
- >::type
- >::type
- >
-{
- typedef byte_t element_t;
- typedef std::vector< element_t > buffer_t;
- typedef Pixel pixel_type;
- typedef bit_aligned_pixel_iterator iterator_t;
-
- row_buffer_helper( std::size_t width
- , bool in_bytes
- )
- : _c( ( width
- * num_channels< pixel_type >::type::value
- * channel_type< pixel_type >::type::num_bits
- )
- >> 3
- )
-
- , _r( width
- * num_channels< pixel_type >::type::value
- * channel_type< pixel_type >::type::num_bits
- - ( _c << 3 )
- )
- {
- if( in_bytes )
- {
- _row_buffer.resize( width );
- }
- else
- {
- // add one byte if there are remaining bits
- _row_buffer.resize( _c + ( _r!=0 ));
- }
- }
-
- element_t* data() { return &_row_buffer[0]; }
-
- iterator_t begin() { return iterator_t( &_row_buffer.front(),0 ); }
- iterator_t end() { return _r == 0 ? iterator_t( &_row_buffer.back() + 1, 0 )
- : iterator_t( &_row_buffer.back() , (int) _r );
- }
-
- buffer_t& buffer() { return _row_buffer; }
-
-private:
-
- // For instance 25 pixels of rgb2 type would be:
- // overall 25 pixels * 3 channels * 2 bits/channel = 150 bits
- // c = 18 bytes
- // r = 6 bits
-
- std::size_t _c; // number of full bytes
- std::size_t _r; // number of remaining bits
-
- buffer_t _row_buffer;
-};
-
-template< typename View
- , typename D = void
- >
-struct row_buffer_helper_view : row_buffer_helper< typename View::value_type >
-{
- row_buffer_helper_view( std::size_t width
- , bool in_bytes
- )
- : row_buffer_helper< typename View::value_type >( width
- , in_bytes
- )
- {}
-};
-
-
-template< typename View >
-struct row_buffer_helper_view< View
- , typename enable_if< typename is_bit_aligned< typename View::value_type
- >::type
- >::type
- > : row_buffer_helper< typename View::reference >
-{
- row_buffer_helper_view( std::size_t width
- , bool in_bytes
- )
- : row_buffer_helper< typename View::reference >( width
- , in_bytes
- )
- {}
-};
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_DETAIL_READ_HELPER_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/typedefs.hpp b/third-party/boost/gil/extension/io_new/detail/typedefs.hpp
deleted file mode 100644
index 45b79d2d..00000000
--- a/third-party/boost/gil/extension/io_new/detail/typedefs.hpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_BASE_HPP
-#define BOOST_GIL_EXTENSION_IO_BASE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-
-#include
-
-#include
-#include
-
-#ifdef BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-#include
-#endif // BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-
-namespace boost { namespace gil {
-
-struct double_zero { static double apply() { return 0.0; } };
-struct double_one { static double apply() { return 1.0; } };
-
-typedef scoped_channel_value< double, double_zero, double_one > bits64f;
-
-typedef unsigned char byte_t;
-typedef std::vector< byte_t > byte_vector_t;
-
-typedef point2< std::ptrdiff_t > point_t;
-
-} // namespace gil
-} // namespace boost
-
-namespace boost {
-
-template<> struct is_floating_point< gil::bits32f > : mpl::true_ {};
-template<> struct is_floating_point< gil::bits64f > : mpl::true_ {};
-
-} // namespace boost
-
-namespace boost { namespace gil { namespace detail {
-
-///@todo We should use boost::preprocessor here.
-
-typedef bit_aligned_image1_type< 1, gray_layout_t >::type gray1_image_t;
-typedef bit_aligned_image1_type< 2, gray_layout_t >::type gray2_image_t;
-typedef bit_aligned_image1_type< 4, gray_layout_t >::type gray4_image_t;
-
-typedef pixel< double, gray_layout_t > gray64f_pixel_t;
-#ifdef BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-typedef pixel< double, gray_alpha_layout_t > gray_alpha64f_pixel_t;
-#endif // BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-typedef pixel< double, rgb_layout_t > rgb64f_pixel_t;
-typedef pixel< double, rgba_layout_t > rgba64f_pixel_t;
-
-typedef image< gray64f_pixel_t , false > gray64f_image_t;
-
-#ifdef BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-typedef image< gray_alpha32f_pixel_t, false > gray_alpha32f_image_t;
-typedef image< gray_alpha32f_pixel_t, true > gray_alpha32f_planar_image_t;
-typedef image< gray_alpha64f_pixel_t, false > gray_alpha64f_image_t;
-typedef image< gray_alpha64f_pixel_t, true > gray_alpha64f_planar_image_t;
-#endif // BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-typedef image< rgb64f_pixel_t , false > rgb64f_image_t;
-typedef image< rgb64f_pixel_t , true > rgb64f_planar_image_t;
-typedef image< rgba64f_pixel_t , false > rgba64f_image_t;
-typedef image< rgba64f_pixel_t , true > rgba64f_planar_image_t;
-
-} // namespace details
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_BASE_HPP
diff --git a/third-party/boost/gil/extension/io_new/detail/write_view.hpp b/third-party/boost/gil/extension/io_new/detail/write_view.hpp
deleted file mode 100644
index 9e0fd50c..00000000
--- a/third-party/boost/gil/extension/io_new/detail/write_view.hpp
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_WRITE_VIEW_HPP
-#define BOOST_GIL_EXTENSION_IO_WRITE_VIEW_HPP
-
-#include
-#include
-#include
-#include
-
-#include "base.hpp"
-#include "io_device.hpp"
-#include "path_spec.hpp"
-#include "conversion_policies.hpp"
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-namespace boost{ namespace gil {
-
-/// \ingroup IO
-template< typename Device
- , typename View
- , typename FormatTag
- >
-inline
-void write_view( Device& device
- , const View& view
- , const FormatTag&
- , typename enable_if< typename mpl::and_< typename detail::is_output_device< Device >::type
- , typename is_format_tag< FormatTag >::type
- , typename is_write_supported< typename get_pixel_type< View >::type
- , FormatTag
- >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- detail::writer< Device
- , FormatTag
- > writer( device );
-
- writer.apply( view );
-}
-
-template< typename Device
- , typename View
- , typename FormatTag
- >
-inline
-void write_view( Device& device
- , const View& view
- , const FormatTag& tag
- , typename enable_if< typename mpl::and_< typename detail::is_adaptable_output_device< FormatTag
- , Device
- >::type
- , typename is_format_tag< FormatTag >::type
- , typename is_write_supported< typename get_pixel_type< View >::type
- , FormatTag
- >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::is_adaptable_output_device< FormatTag
- , Device
- >::device_type dev_t;
- dev_t dev( device );
-
- write_view( dev
- , view
- , tag
- );
-}
-
-template< typename String
- , typename View
- , typename FormatTag
- >
-inline
-void write_view( const String& file_name
- , const View& view
- , const FormatTag& tag
- , typename enable_if< typename mpl::and_< typename detail::is_supported_path_spec< String >::type
- , typename is_format_tag< FormatTag >::type
- , typename is_write_supported< typename get_pixel_type< View >::type
- , FormatTag
- >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- detail::file_stream_device device( detail::convert_to_string( file_name )
- , typename detail::file_stream_device::write_tag()
- );
-
- write_view( device
- , view
- , tag
- );
-}
-
-/// \ingroup IO
-template< typename Device
- , typename View
- , typename FormatTag
- , typename Log
- >
-inline
-void write_view( Device& device
- , const View& view
- , const image_write_info& info
- , typename enable_if< typename mpl::and_< typename detail::is_output_device< Device >::type
- , typename is_format_tag< FormatTag >::type
- , typename is_write_supported< typename get_pixel_type< View >::type
- , FormatTag
- >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- detail::writer< Device
- , FormatTag
- , Log
- > writer( device );
-
- writer.apply( view
- , info );
-}
-
-template< typename Device
- , typename View
- , typename FormatTag
- , typename Log
- >
-inline
-void write_view( Device& device
- , const View& view
- , const image_write_info< FormatTag, Log >& info
- , typename enable_if< typename mpl::and_< typename detail::is_adaptable_output_device< FormatTag
- , Device
- >::type
- , typename is_format_tag< FormatTag >::type
- , typename is_write_supported< typename get_pixel_type< View >::type
- , FormatTag
- >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- typename detail::is_adaptable_output_device< FormatTag
- , Device
- >::device_type dev( device );
-
- write_view( dev
- , view
- , info
- );
-}
-
-template< typename String
- , typename View
- , typename FormatTag
- , typename Log
- >
-inline
-void write_view( const String& file_name
- , const View& view
- , const image_write_info< FormatTag, Log >& info
- , typename enable_if< typename mpl::and_< typename detail::is_supported_path_spec< String >::type
- , typename is_format_tag< FormatTag >::type
- , typename is_write_supported< typename get_pixel_type< View >::type
- , FormatTag
- >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- detail::file_stream_device< FormatTag > device( detail::convert_to_string( file_name )
- , typename detail::file_stream_device< FormatTag >::write_tag()
- );
-
- write_view( device
- , view
- , info
- );
-}
-
-
-////////////////////////////////////// dynamic_image
-
-// without image_write_info
-template< typename Device
- , typename Views
- , typename FormatTag
- >
-inline
-void write_view( Device& device
- , const any_image_view< Views >& view
- , const FormatTag&
- , typename enable_if< typename mpl::and_< typename detail::is_output_device< Device >::type
- , typename is_format_tag< FormatTag >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- detail::dynamic_image_writer< Device
- , FormatTag
- > dyn_writer( device );
-
- dyn_writer.apply( view );
-}
-
-template< typename Device
- , typename Views
- , typename FormatTag
- >
-inline
-void write_view( Device& device
- , const any_image_view< Views >& views
- , const FormatTag& tag
- , typename enable_if< typename mpl::and_< typename detail::is_adaptable_output_device< FormatTag
- , Device
- >::type
- , typename is_format_tag< FormatTag >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- typedef typename detail::is_adaptable_output_device< FormatTag
- , Device
- >::device_type dev_t;
- dev_t dev( device );
-
- write_view( dev
- , views
- , tag
- );
-}
-
-template< typename String
- , typename Views
- , typename FormatTag
- >
-inline
-void write_view( const String& file_name
- , const any_image_view< Views >& views
- , const FormatTag& tag
- , typename enable_if< typename mpl::and_< typename detail::is_supported_path_spec< String >::type
- , typename is_format_tag< FormatTag >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- detail::file_stream_device device( detail::convert_to_string( file_name )
- , typename detail::file_stream_device::write_tag()
- );
-
- write_view( device
- , views
- , tag
- );
-}
-
-// with image_write_info
-/// \ingroup IO
-template< typename Device
- , typename Views
- , typename FormatTag
- , typename Log
- >
-inline
-void write_view( Device& device
- , const any_image_view< Views >& views
- , const image_write_info< FormatTag
- , Log
- >& info
- , typename enable_if< typename mpl::and_< typename detail::is_output_device< Device >::type
- , typename is_format_tag< FormatTag >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- detail::dynamic_image_writer< Device
- , FormatTag
- , Log
- > dyn_writer( device );
-
- dyn_writer.apply( views
- , info
- );
-}
-
-template< typename Device
- , typename Views
- , typename FormatTag
- , typename Log
- >
-inline
-void write_view( Device& device
- , const any_image_view< Views >& views
- , const image_write_info< FormatTag
- , Log
- >& info
- , typename enable_if< typename mpl::and_< typename detail::is_adaptable_output_device< FormatTag
- , Device
- >::type
- , typename is_format_tag< FormatTag >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- typename detail::is_adaptable_output_device< FormatTag
- , Device
- >::device_type dev( device );
-
- write_view( dev
- , views
- , info
- );
-}
-
-template< typename String
- , typename Views
- , typename FormatTag
- , typename Log
- >
-inline
-void write_view( const String& file_name
- , const any_image_view< Views >& views
- , const image_write_info< FormatTag
- , Log
- >& info
- , typename enable_if< typename mpl::and_< typename detail::is_supported_path_spec< String >::type
- , typename is_format_tag< FormatTag >::type
- >::type
- >::type* /* ptr */ = 0
- )
-{
- detail::file_stream_device< FormatTag > device( detail::convert_to_string( file_name )
- , typename detail::file_stream_device< FormatTag >::write_tag()
- );
-
- write_view( device
- , views
- , info
- );
-}
-
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_WRITE_VIEW_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/bmp/is_allowed.hpp b/third-party/boost/gil/extension/io_new/formats/bmp/is_allowed.hpp
deleted file mode 100644
index 720b2202..00000000
--- a/third-party/boost/gil/extension/io_new/formats/bmp/is_allowed.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- Copyright 2009 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_BMP_IO_IS_ALLOWED_HPP
-#define BOOST_GIL_EXTENSION_IO_BMP_IO_IS_ALLOWED_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-namespace boost { namespace gil { namespace detail {
-
-template< typename View >
-bool is_allowed( const image_read_info< bmp_tag >& info
- , mpl::true_ // is read_and_no_convert
- )
-{
- bmp_bits_per_pixel::type src_bits_per_pixel = 0;
-
- switch( info._bits_per_pixel )
- {
- case 1:
- case 4:
- case 8:
- {
- if( info._header_size == bmp_header_size::_win32_info_size
- && info._compression != bmp_compression::_rle8
- && info._compression != bmp_compression::_rle4
- )
- {
- src_bits_per_pixel = 32;
- }
- else
- {
- src_bits_per_pixel = 24;
- }
-
- break;
- }
-
- case 15:
- case 16:
- {
- src_bits_per_pixel = 24;
-
- break;
- }
-
- case 24:
- case 32:
- {
- src_bits_per_pixel = info._bits_per_pixel;
-
- break;
- }
- default:
- {
- io_error( "Pixel size not supported." );
- }
- }
-
- typedef typename channel_traits< typename element_type< typename View::value_type >::type >::value_type channel_t;
- bmp_bits_per_pixel::type dst_bits_per_pixel = detail::unsigned_integral_num_bits< channel_t >::value
- * num_channels< View >::value;
-
- return ( dst_bits_per_pixel == src_bits_per_pixel );
-}
-
-template< typename View >
-bool is_allowed( const image_read_info< bmp_tag >& /* info */
- , mpl::false_ // is read_and_convert
- )
-{
- return true;
-}
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_BMP_IO_IS_ALLOWED_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/bmp/read.hpp b/third-party/boost/gil/extension/io_new/formats/bmp/read.hpp
deleted file mode 100644
index b7bab9d5..00000000
--- a/third-party/boost/gil/extension/io_new/formats/bmp/read.hpp
+++ /dev/null
@@ -1,865 +0,0 @@
-/*
- Copyright 2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_BMP_IO_READ_HPP
-#define BOOST_GIL_EXTENSION_IO_BMP_IO_READ_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "is_allowed.hpp"
-
-namespace boost { namespace gil { namespace detail {
-
-/// Color channel mask
-struct bit_field
-{
- unsigned int mask; // Bit mask at corresponding position
- unsigned int width; // Bit width of the mask
- unsigned int shift; // Bit position from right to left
-};
-
-/// BMP color masks
-struct color_mask
-{
- bit_field red; // Red bits
- bit_field green; // Green bits
- bit_field blue; // Blue bits
-};
-
-
-template< typename Device
- , typename ConversionPolicy
- >
-class reader< Device
- , bmp_tag
- , ConversionPolicy
- >
- : public reader_base< bmp_tag
- , ConversionPolicy
- >
-{
-private:
-
- typedef typename ConversionPolicy::color_converter_type cc_t;
-
-public:
-
- reader( Device& device
- , const image_read_settings< bmp_tag >& settings
- )
- : reader_base< bmp_tag
- , ConversionPolicy >( settings )
- , _io_dev( device )
- {}
-
- reader( Device& device
- , const cc_t& cc
- , const image_read_settings< bmp_tag >& settings
- )
- : reader_base< bmp_tag
- , ConversionPolicy
- >( cc
- , settings
- )
- , _io_dev( device )
- {}
-
- image_read_info< bmp_tag > get_info()
- {
- // read file header
-
- // the magic number used to identify the BMP file:
- // 0x42 0x4D (ASCII code points for B and M)
- if( _io_dev.read_int16() == 0x424D )
- {
- io_error( "Wrong magic number for bmp file." );
- }
-
- // the size of the BMP file in bytes
- _io_dev.read_int32();
-
- // reserved; actual value depends on the application that creates the image
- _io_dev.read_int16();
- // reserved; actual value depends on the application that creates the image
- _io_dev.read_int16();
-
- _info._offset = _io_dev.read_int32();
-
-
- // bitmap information
-
- // the size of this header ( 40 bytes )
- _info._header_size = _io_dev.read_int32();
-
- if( _info._header_size == bmp_header_size::_win32_info_size )
- {
- _info._width = _io_dev.read_int32();
- _info._height = _io_dev.read_int32();
-
- // the number of color planes being used. Must be set to 1.
- _io_dev.read_int16();
-
- _info._bits_per_pixel = _io_dev.read_int16();
-
- _info._compression = _io_dev.read_int32();
-
- _info._image_size = _io_dev.read_int32();
-
- _info._horizontal_resolution = _io_dev.read_int32();
- _info._vertical_resolution = _io_dev.read_int32();
-
- _info._num_colors = _io_dev.read_int32();
- _info._num_important_colors = _io_dev.read_int32();
-
- }
- else if( _info._header_size == bmp_header_size::_os2_info_size )
- {
- _info._width = static_cast< bmp_image_width::type >( _io_dev.read_int16() );
- _info._height = static_cast< bmp_image_height::type >( _io_dev.read_int16() );
-
- // the number of color planes being used. Must be set to 1.
- _io_dev.read_int16();
-
- _info._bits_per_pixel = _io_dev.read_int16();
-
- _info._compression = bmp_compression::_rgb;
-
- // not used
- _info._image_size = 0;
- _info._horizontal_resolution = 0;
- _info._vertical_resolution = 0;
- _info._num_colors = 0;
- _info._num_important_colors = 0;
- }
- else
- {
- io_error( "Invalid BMP info header." );
- }
-
- _info._valid = true;
-
- return _info;
- }
-
- template< typename View >
- void apply( const View& dst_view )
- {
- if( !_info._valid )
- {
- get_info();
- }
-
- typedef typename is_same< ConversionPolicy
- , read_and_no_convert
- >::type is_read_and_convert_t;
-
- io_error_if( !is_allowed< View >( this->_info
- , is_read_and_convert_t()
- )
- , "Image types aren't compatible."
- );
-
- // the row pitch must be multiple 4 bytes
- int pitch;
-
- if( _info._bits_per_pixel < 8 )
- {
- pitch = (( this->_info._width * this->_info._bits_per_pixel ) + 7 ) >> 3;
- }
- else
- {
- pitch = _info._width * (( this->_info._bits_per_pixel + 7 ) >> 3);
- }
-
- pitch = (pitch + 3) & ~3;
-
-
- std::ptrdiff_t ybeg = 0;
- std::ptrdiff_t yend = this->_settings._dim.y;
- std::ptrdiff_t yinc = 1;
-
- // offset to first scanline
- std::ptrdiff_t offset = 0;
-
- if( _info._height > 0 )
- {
- // the image is upside down
- ybeg = this->_settings._dim.y - 1;
- yend = -1;
- yinc = -1;
-
- offset = _info._offset
- + ( this->_info._height
- - this->_settings._top_left.y
- - this->_settings._dim.y
- ) * pitch;
-
-
- }
- else
- {
- offset = _info._offset
- + this->_settings._top_left.y * pitch;
- }
-
- switch( _info._bits_per_pixel )
- {
- case 1:
- {
- read_palette_image< gray1_image_t::view_t
- , mirror_bits< byte_vector_t
- , mpl::true_
- >
- > ( dst_view
- , pitch
- , ybeg
- , yend
- , yinc
- , offset
- );
- break;
- }
-
- case 4:
- {
- switch ( _info._compression )
- {
- case bmp_compression::_rle4:
- {
- read_palette_image_rle( dst_view
- , ybeg
- , yend
- , yinc
- , offset
- );
-
- break;
- }
-
- case bmp_compression::_rgb:
- {
- read_palette_image< gray4_image_t::view_t
- , swap_half_bytes< byte_vector_t
- , mpl::true_
- >
- > ( dst_view
- , pitch
- , ybeg
- , yend
- , yinc
- , offset
- );
- break;
- }
-
- default:
- {
- io_error( "Unsupported compression mode in BMP file." );
- break;
- }
- }
- break;
- }
-
- case 8:
- {
- switch ( _info._compression )
- {
- case bmp_compression::_rle8:
- {
- read_palette_image_rle( dst_view
- , ybeg
- , yend
- , yinc
- , offset
- );
- break;
- }
-
- case bmp_compression::_rgb:
- {
- read_palette_image< gray8_image_t::view_t
- , do_nothing< std::vector< gray8_pixel_t > >
- > ( dst_view
- , pitch
- , ybeg
- , yend
- , yinc
- , offset
- );
- break;
- }
-
- default:
- {
- io_error( "Unsupported compression mode in BMP file." );
- break;
- }
- }
-
- break;
- }
-
- case 15: case 16:
- {
- read_data_15( dst_view
- , pitch
- , ybeg
- , yend
- , yinc
- , offset
- );
-
- break;
- }
-
- case 24: { read_data< bgr8_view_t >( dst_view, pitch, ybeg, yend, yinc, offset ); break; }
- case 32: { read_data< bgra8_view_t >( dst_view, pitch, ybeg, yend, yinc, offset ); break; }
- }
- }
-
-private:
-
- void read_palette( std::vector< rgba8_pixel_t >& palette )
- {
- int entries = _info._num_colors;
-
- if( entries == 0 )
- {
- entries = 1 << _info._bits_per_pixel;
- }
-
- palette.resize( entries );
-
- for( int i = 0; i < entries; ++i )
- {
- get_color( palette[i], blue_t() ) = _io_dev.read_int8();
- get_color( palette[i], green_t() ) = _io_dev.read_int8();
- get_color( palette[i], red_t() ) = _io_dev.read_int8();
-
- // there are 4 entries when windows header
- // but 3 for os2 header
- if( _info._header_size == bmp_header_size::_win32_info_size )
- {
- _io_dev.read_int8();
- }
-
- } // for
- }
-
- template< typename View_Src
- , typename Byte_Manipulator
- , typename View_Dst
- >
- void read_palette_image( const View_Dst& view
- , int pitch
- , std::ptrdiff_t ybeg
- , std::ptrdiff_t yend
- , std::ptrdiff_t yinc
- , std::ptrdiff_t offset
- )
- {
- std::vector< rgba8_pixel_t > pal;
- read_palette( pal );
-
- // jump to first scanline
- _io_dev.seek( static_cast< long >( offset ));
-
- typedef row_buffer_helper_view< View_Src > rh_t;
- typedef typename rh_t::iterator_t it_t;
-
- rh_t rh( pitch, true );
-
- // we have to swap bits
- Byte_Manipulator byte_manipulator;
-
- for( std::ptrdiff_t y = ybeg; y != yend; y += yinc )
- {
- // @todo: For now we're reading the whole scanline which is
- // slightly inefficient. Later versions should try to read
- // only the bytes which are necessary.
- _io_dev.read( reinterpret_cast< byte_t* >( rh.data() )
- , pitch
- );
-
- byte_manipulator( rh.buffer() );
-
- typename View_Dst::x_iterator dst_it = view.row_begin( y );
-
- it_t it = rh.begin() + this->_settings._top_left.x;
- it_t end = it + this->_settings._dim.x;
-
- for( ; it != end; ++it, ++dst_it )
- {
- unsigned char c = get_color( *it, gray_color_t() );
- *dst_it = pal[ c ];
- }
- }
- }
-
- template< typename View >
- void read_data_15( const View& view
- , int pitch
- , std::ptrdiff_t ybeg
- , std::ptrdiff_t yend
- , std::ptrdiff_t yinc
- , std::ptrdiff_t offset
- )
- {
- byte_vector_t row( pitch );
-
- // read the color masks
- color_mask mask = { {0} };
- if( _info._compression == bmp_compression::_bitfield )
- {
- mask.red.mask = _io_dev.read_int32();
- mask.green.mask = _io_dev.read_int32();
- mask.blue.mask = _io_dev.read_int32();
-
- mask.red.width = count_ones( mask.red.mask );
- mask.green.width = count_ones( mask.green.mask );
- mask.blue.width = count_ones( mask.blue.mask );
-
- mask.red.shift = trailing_zeros( mask.red.mask );
- mask.green.shift = trailing_zeros( mask.green.mask );
- mask.blue.shift = trailing_zeros( mask.blue.mask );
- }
- else if( _info._compression == bmp_compression::_rgb )
- {
- switch( _info._bits_per_pixel )
- {
- case 15:
- case 16:
- {
- mask.red.mask = 0x007C00; mask.red.width = 5; mask.red.shift = 10;
- mask.green.mask = 0x0003E0; mask.green.width = 5; mask.green.shift = 5;
- mask.blue.mask = 0x00001F; mask.blue.width = 5; mask.blue.shift = 0;
- break;
- }
-
- case 24:
- case 32:
- {
- mask.red.mask = 0xFF0000; mask.red.width = 8; mask.red.shift = 16;
- mask.green.mask = 0x00FF00; mask.green.width = 8; mask.green.shift = 8;
- mask.blue.mask = 0x0000FF; mask.blue.width = 8; mask.blue.shift = 0;
- break;
- }
- }
- }
- else
- {
- io_error( "bmp_reader::apply(): unsupported BMP compression" );
- }
-
- // jump to first scanline
- _io_dev.seek( static_cast< long >( offset ));
-
- typedef rgb8_image_t image_t;
- typedef image_t::view_t::x_iterator it_t;
-
- for( std::ptrdiff_t y = ybeg; y != yend; y += yinc )
- {
- // @todo: For now we're reading the whole scanline which is
- // slightly inefficient. Later versions should try to read
- // only the bytes which are necessary.
- _io_dev.read( &row.front(), row.size() );
-
- image_t img_row( _info._width, 1 );
- image_t::view_t v = gil::view( img_row );
- it_t it = v.row_begin( 0 );
-
- it_t beg = v.row_begin( 0 ) + this->_settings._top_left.x;
- it_t end = beg + this->_settings._dim.x;
-
- byte_t* src = &row.front();
- for( int32_t i = 0 ; i < _info._width; ++i, src += 2 )
- {
- int p = ( src[1] << 8 ) | src[0];
-
- int r = ((p & mask.red.mask) >> mask.red.shift) << (8 - mask.red.width);
- int g = ((p & mask.green.mask) >> mask.green.shift) << (8 - mask.green.width);
- int b = ((p & mask.blue.mask) >> mask.blue.shift) << (8 - mask.blue.width);
-
- get_color( it[i], red_t() ) = static_cast< byte_t >( r );
- get_color( it[i], green_t() ) = static_cast< byte_t >( g );
- get_color( it[i], blue_t() ) = static_cast< byte_t >( b );
- }
-
- this->_cc_policy.read( beg
- , end
- , view.row_begin( y )
- );
- }
- }
-
-
- // 8-8-8 BGR
- // 8-8-8-8 BGRA
- template< typename View_Src
- , typename View_Dst
- >
- void read_data( const View_Dst& view
- , int pitch
- , std::ptrdiff_t ybeg
- , std::ptrdiff_t yend
- , std::ptrdiff_t yinc
- , std::ptrdiff_t offset
- )
- {
- byte_vector_t row( pitch );
-
- // jump to first scanline
- _io_dev.seek( static_cast< long >( offset ));
-
- View_Src v = interleaved_view( _info._width
- , 1
- , (typename View_Src::value_type*) &row.front()
- , _info._width * num_channels< View_Src >::value
- );
-
- typename View_Src::x_iterator beg = v.row_begin( 0 ) + this->_settings._top_left.x;
- typename View_Src::x_iterator end = beg + this->_settings._dim.x;
-
- for( std::ptrdiff_t y = ybeg; y != yend; y += yinc )
- {
- // @todo: For now we're reading the whole scanline which is
- // slightly inefficient. Later versions should try to read
- // only the bytes which are necessary.
- _io_dev.read( &row.front(), row.size() );
-
- this->_cc_policy.read( beg
- , end
- , view.row_begin( y )
- );
- }
- }
-
-
- template< typename Buffer
- , typename View
- >
- void copy_row_if_needed( const Buffer& buf
- , const View& view
- , std::ptrdiff_t y
- )
- {
- if( y >= this->_settings._top_left.y
- && y < this->_settings._dim.y
- )
- {
- typename Buffer::const_iterator beg = buf.begin() + this->_settings._top_left.x;
- typename Buffer::const_iterator end = beg + this->_settings._dim.x;
-
- std::copy( beg
- , end
- , view.row_begin( y )
- );
- }
- }
-
- template< typename View_Dst >
- void read_palette_image_rle( const View_Dst& view
- , std::ptrdiff_t ybeg
- , std::ptrdiff_t yend
- , std::ptrdiff_t yinc
- , std::ptrdiff_t offset
- )
- {
- assert( _info._compression == bmp_compression::_rle4
- || _info._compression == bmp_compression::_rle8
- );
-
- std::vector< rgba8_pixel_t > pal;
- read_palette( pal );
-
- // jump to start of rle4 data
- _io_dev.seek( static_cast< long >( offset ));
-
- // we need to know the stream position for padding purposes
- std::size_t stream_pos = offset;
-
- typedef std::vector< rgba8_pixel_t > Buf_type;
- Buf_type buf( this->_settings._dim.x );
- Buf_type::iterator dst_it = buf.begin();
- Buf_type::iterator dst_end = buf.end();
-
- std::ptrdiff_t y = ybeg;
- bool finished = false;
-
- while ( !finished )
- {
- std::ptrdiff_t count = _io_dev.read_int8();
- std::ptrdiff_t second = _io_dev.read_int8();
- stream_pos += 2;
-
- if ( count )
- {
- // encoded mode
-
- // clamp to boundary
- if( count > dst_end - dst_it )
- {
- count = dst_end - dst_it;
- }
-
- if( _info._compression == bmp_compression::_rle4 )
- {
- std::ptrdiff_t cs[2] = { second >> 4, second & 0x0f };
-
- for( int i = 0; i < count; ++i )
- {
- *dst_it++ = pal[ cs[i & 1] ];
- }
- }
- else
- {
- for( int i = 0; i < count; ++i )
- {
- *dst_it++ = pal[ second ];
- }
- }
- }
- else
- {
- switch( second )
- {
- case 0: // end of row
- {
- copy_row_if_needed( buf, view, y );
-
- y += yinc;
- if( y == yend )
- {
- finished = true;
- }
- else
- {
- dst_it = buf.begin();
- dst_end = buf.end();
- }
-
- break;
- }
-
- case 1: // end of bitmap
- {
- copy_row_if_needed( buf, view, y );
- finished = true;
-
- break;
- }
-
- case 2: // offset coordinates
- {
- std::ptrdiff_t dx = _io_dev.read_int8();
- std::ptrdiff_t dy = _io_dev.read_int8() * yinc;
- stream_pos += 2;
-
- if( dy )
- {
- copy_row_if_needed( buf, view, y );
- }
-
- std::ptrdiff_t x = dst_it - buf.begin();
- x += dx;
-
- if( x > _info._width )
- {
- io_error( "Mangled BMP file." );
- }
-
- y += dy;
- if( yinc > 0 ? y > yend : y < yend )
- {
- io_error( "Mangled BMP file." );
- }
-
- dst_it = buf.begin() + x;
- dst_end = buf.end();
-
- break;
- }
-
- default: // absolute mode
- {
- count = second;
-
- // clamp to boundary
- if( count > dst_end - dst_it )
- {
- count = dst_end - dst_it;
- }
-
- if ( _info._compression == bmp_compression::_rle4 )
- {
- for( int i = 0; i < count; ++i )
- {
- uint8_t packed_indices = _io_dev.read_int8();
- ++stream_pos;
-
- *dst_it++ = pal[ packed_indices >> 4 ];
- if( ++i == second )
- break;
-
- *dst_it++ = pal[ packed_indices & 0x0f ];
- }
- }
- else
- {
- for( int i = 0; i < count; ++i )
- {
- uint8_t c = _io_dev.read_int8();
- ++stream_pos;
- *dst_it++ = pal[ c ];
- }
- }
-
- // pad to word boundary
- if( ( stream_pos - offset ) & 1 )
- {
- _io_dev.seek( 1, SEEK_CUR );
- ++stream_pos;
- }
-
- break;
- }
- }
- }
- }
- }
-
-protected:
-
- Device& _io_dev;
- image_read_info< bmp_tag > _info;
-};
-
-/////////////////////////////////// dynamic image
-
-class bmp_type_format_checker
-{
-public:
-
- bmp_type_format_checker( const bmp_bits_per_pixel::type& bpp )
- : _bpp( bpp )
- {}
-
- template< typename Image >
- bool apply()
- {
- if( _bpp < 32 )
- {
- return pixels_are_compatible< typename Image::value_type, rgb8_pixel_t >::value
- ? true
- : false;
- }
- else
- {
- return pixels_are_compatible< typename Image::value_type, rgba8_pixel_t >::value
- ? true
- : false;
- }
- }
-
-private:
-
- const bmp_bits_per_pixel::type& _bpp;
-};
-
-struct bmp_read_is_supported
-{
- template< typename View >
- struct apply : public is_read_supported< typename get_pixel_type< View >::type
- , bmp_tag
- >
- {};
-};
-
-template< typename Device
- >
-class dynamic_image_reader< Device
- , bmp_tag
- >
- : public reader< Device
- , bmp_tag
- , detail::read_and_no_convert
- >
-{
- typedef reader< Device
- , bmp_tag
- , detail::read_and_no_convert
- > parent_t;
-
-public:
-
- dynamic_image_reader( Device& device
- , const image_read_settings< bmp_tag >& settings
- )
- : parent_t( device
- , settings
- )
- {}
-
- template< typename Images >
- void apply( any_image< Images >& images )
- {
- if( !this->_info._valid )
- {
- parent_t::get_info();
- }
-
- bmp_type_format_checker format_checker( this->_info._bits_per_pixel );
-
- if( !construct_matched( images
- , format_checker
- ))
- {
- io_error( "No matching image type between those of the given any_image and that of the file" );
- }
- else
- {
- init_image( images
- , this->_info
- );
-
- dynamic_io_fnobj< bmp_read_is_supported
- , parent_t
- > op( this );
-
- apply_operation( view( images )
- , op
- );
- }
- }
-};
-
-} // detail
-} // gil
-} // boost
-
-#endif // BOOST_GIL_EXTENSION_IO_BMP_IO_READ_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/bmp/supported_types.hpp b/third-party/boost/gil/extension/io_new/formats/bmp/supported_types.hpp
deleted file mode 100644
index 3ff427e9..00000000
--- a/third-party/boost/gil/extension/io_new/formats/bmp/supported_types.hpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- Copyright 2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_BMP_SUPPORTED_TYPES_HPP
-#define BOOST_GIL_EXTENSION_IO_BMP_SUPPORTED_TYPES_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-
-#include
-#include
-
-#include
-
-namespace boost { namespace gil { namespace detail {
-
-// Read support
-
-template< typename Channel
- , typename ColorSpace
- >
-struct bmp_read_support : read_support_false
-{
- static const bmp_bits_per_pixel::type bpp = 0;
-};
-
-template< typename BitField
- , bool Mutable
- >
-struct bmp_read_support< packed_dynamic_channel_reference< BitField
- , 1
- , Mutable
- >
- , gray_t
- > : read_support_true
-{
- static const bmp_bits_per_pixel::type bpp = 1;
-};
-
-template< typename BitField
- , bool Mutable
- >
-struct bmp_read_support< packed_dynamic_channel_reference< BitField
- , 4
- , Mutable
- >
- , gray_t
- > : read_support_true
-{
- static const bmp_bits_per_pixel::type bpp = 4;
-};
-
-
-template<>
-struct bmp_read_support< bits8
- , gray_t
- > : read_support_true
-{
- static const bmp_bits_per_pixel::type bpp = 8;
-};
-
-
-
-template<>
-struct bmp_read_support< bits8
- , rgb_t
- > : read_support_true
-{
- static const bmp_bits_per_pixel::type bpp = 24;
-};
-
-
-template<>
-struct bmp_read_support< bits8
- , rgba_t
- > : read_support_true
-{
- static const bmp_bits_per_pixel::type bpp = 32;
-};
-
-
-// Write support
-
-template< typename Channel
- , typename ColorSpace
- >
-struct bmp_write_support : write_support_false
-{};
-
-template<>
-struct bmp_write_support< bits8
- , rgb_t
- > : write_support_true {};
-
-template<>
-struct bmp_write_support< bits8
- , rgba_t
- > : write_support_true {};
-
-} // namespace detail
-
-
-template< typename Pixel >
-struct is_read_supported< Pixel
- , bmp_tag
- >
- : mpl::bool_< detail::bmp_read_support< typename channel_type< Pixel >::type
- , typename color_space_type< Pixel >::type
- >::is_supported
- >
-{
- typedef detail::bmp_read_support< typename channel_type< Pixel >::type
- , typename color_space_type< Pixel >::type
- > parent_t;
-
- static const typename bmp_bits_per_pixel::type bpp = parent_t::bpp;
-};
-
-template< typename Pixel >
-struct is_write_supported< Pixel
- , bmp_tag
- >
- : mpl::bool_< detail::bmp_write_support< typename channel_type< Pixel >::type
- , typename color_space_type< Pixel >::type
- >::is_supported
- > {};
-
-} // namespace gil
-} // namespace boost
-
-
-#endif // BOOST_GIL_EXTENSION_IO_BMP_SUPPORTED_TYPES_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/bmp/write.hpp b/third-party/boost/gil/extension/io_new/formats/bmp/write.hpp
deleted file mode 100644
index 75c51478..00000000
--- a/third-party/boost/gil/extension/io_new/formats/bmp/write.hpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- Copyright 2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_BMP_IO_WRITE_HPP
-#define BOOST_GIL_EXTENSION_IO_BMP_IO_WRITE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-
-#include
-#include
-
-#include
-
-namespace boost { namespace gil { namespace detail {
-
-template < int N > struct get_bgr_cs {};
-template <> struct get_bgr_cs< 1 > { typedef gray8_view_t type; };
-template <> struct get_bgr_cs< 3 > { typedef bgr8_view_t type; };
-template <> struct get_bgr_cs< 4 > { typedef bgra8_view_t type; };
-
-template< typename Device >
-class writer< Device
- , bmp_tag
- >
-{
-public:
-
- writer( Device& file )
- : _out( file )
- {
- }
-
- ~writer()
- {
- }
-
- template
- void apply( const View& view )
- {
- write( view );
- }
-
- template
- void apply( const View& view
- , const image_write_info< bmp_tag >& /* info */
- )
- {
- // Add code here, once image_write_info< bmp_tag > isn't empty anymore.
-
- write( view );
- }
-
-private:
-
- template< typename View >
- void write( const View& view )
- {
- typedef typename channel_type<
- typename get_pixel_type< View >::type >::type channel_t;
-
- typedef typename color_space_type< View >::type color_space_t;
-
- // check if supported
-/*
- /// todo
- if( bmp_read_write_support_private::channel != 8)
- {
- io_error("Input view type is incompatible with the image type");
- }
-*/
-
- // compute the file size
- int bpp = num_channels< View >::value * 8;
- int entries = 0;
-
-/*
- /// @todo: Not supported for now. bit_aligned_images refer to indexed images
- /// in this context.
- if( bpp <= 8 )
- {
- entries = 1 << bpp;
- }
-*/
-
- std::size_t spn = ( view.width() * num_channels< View >::value + 3 ) & ~3;
- std::size_t ofs = bmp_header_size::_size
- + bmp_header_size::_win32_info_size
- + entries * 4;
-
- std::size_t siz = ofs + spn * view.height();
-
- // write the BMP file header
- _out.write_int16( bmp_signature );
- _out.write_int32( (uint32_t) siz );
- _out.write_int16( 0 );
- _out.write_int16( 0 );
- _out.write_int32( (uint32_t) ofs );
-
- // writes Windows information header
- _out.write_int32( bmp_header_size::_win32_info_size );
- _out.write_int32( static_cast< uint32_t >( view.width() ));
- _out.write_int32( static_cast< uint32_t >( view.height() ));
- _out.write_int16( 1 );
- _out.write_int16( static_cast< uint16_t >( bpp ));
- _out.write_int32( bmp_compression::_rgb );
- _out.write_int32( 0 );
- _out.write_int32( 0 );
- _out.write_int32( 0 );
- _out.write_int32( entries );
- _out.write_int32( 0 );
-
- write_image< View
- , typename get_bgr_cs< num_channels< View >::value >::type
- >( view, spn );
- }
-
-
- template< typename View
- , typename BMP_View
- >
- void write_image( const View& view
- , const std::size_t spn
- )
- {
- byte_vector_t buffer( spn );
- std::fill( buffer.begin(), buffer.end(), 0 );
-
-
- BMP_View row = interleaved_view( view.width()
- , 1
- , (typename BMP_View::value_type*) &buffer.front()
- , spn
- );
-
- for( typename View::y_coord_t y = view.height() - 1; y > -1; --y )
- {
- copy_pixels( subimage_view( view
- , 0
- , (int) y
- , (int) view.width()
- , 1
- )
- , row
- );
-
- _out.write( &buffer.front(), spn );
- }
-
- }
-
-private:
-
- Device& _out;
-};
-
-
-struct bmp_write_is_supported
-{
- template< typename View >
- struct apply
- : public is_write_supported< typename get_pixel_type< View >::type
- , bmp_tag
- >
- {};
-};
-
-template< typename Device >
-class dynamic_image_writer< Device
- , bmp_tag
- >
- : public writer< Device
- , bmp_tag
- >
-{
- typedef writer< Device
- , bmp_tag
- > parent_t;
-
-public:
-
- dynamic_image_writer( Device& file )
- : parent_t( file )
- {}
-
- template< typename Views >
- void apply( const any_image_view< Views >& views )
- {
- dynamic_io_fnobj< bmp_write_is_supported
- , parent_t
- > op( this );
-
- apply_operation( views, op );
- }
-};
-
-} // detail
-} // gil
-} // boost
-
-#endif // BOOST_GIL_EXTENSION_IO_BMP_IO_WRITE_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/jpeg/base.hpp b/third-party/boost/gil/extension/io_new/formats/jpeg/base.hpp
deleted file mode 100644
index 113df11f..00000000
--- a/third-party/boost/gil/extension/io_new/formats/jpeg/base.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- Copyright 2010 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_DETAIL_JPEG_IO_BASE_HPP
-#define BOOST_GIL_EXTENSION_IO_DETAIL_JPEG_IO_BASE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2010 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-#include
-
-namespace boost { namespace gil { namespace detail {
-
-class jpeg_io_base
-{
-
-protected:
-
- jpeg_error_mgr _jerr;
- jmp_buf _mark;
-};
-
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_DETAIL_JPEG_IO_BASE_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/jpeg/is_allowed.hpp b/third-party/boost/gil/extension/io_new/formats/jpeg/is_allowed.hpp
deleted file mode 100644
index 78691eb6..00000000
--- a/third-party/boost/gil/extension/io_new/formats/jpeg/is_allowed.hpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- Copyright 2009 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_JPEG_IO_IS_ALLOWED_HPP
-#define BOOST_GIL_EXTENSION_IO_JPEG_IO_IS_ALLOWED_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-namespace boost { namespace gil { namespace detail {
-
-template< typename View >
-bool is_allowed( const image_read_info< jpeg_tag >& info
- , mpl::true_ // is read_and_no_convert
- )
-{
- if( info._color_space == JCS_YCbCr )
- {
- // We read JCS_YCbCr files as rgb.
- return ( is_read_supported< typename View::value_type
- , jpeg_tag
- >::_color_space == JCS_RGB );
- }
-
- return ( is_read_supported< typename View::value_type
- , jpeg_tag
- >::_color_space == info._color_space );
-}
-
-template< typename View >
-bool is_allowed( const image_read_info< jpeg_tag >& /* info */
- , mpl::false_ // is read_and_convert
- )
-{
- return true;
-}
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_JPEG_IO_IS_ALLOWED_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/jpeg/read.hpp b/third-party/boost/gil/extension/io_new/formats/jpeg/read.hpp
deleted file mode 100644
index accc3e22..00000000
--- a/third-party/boost/gil/extension/io_new/formats/jpeg/read.hpp
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_JPEG_IO_READ_HPP
-#define BOOST_GIL_EXTENSION_IO_JPEG_IO_READ_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#include "base.hpp"
-#include "is_allowed.hpp"
-
-namespace boost { namespace gil { namespace detail {
-
-template
-struct jpeg_decompress_mgr : public jpeg_io_base
-{
- jpeg_decompress_mgr( Device& file )
- : in(file)
- {
- _cinfo.err = jpeg_std_error( &_jerr );
- _cinfo.client_data = this;
-
- // Error exit handler: does not return to caller.
- _jerr.error_exit = &jpeg_decompress_mgr::error_exit;
-
- if( setjmp( _mark )) { raise_error(); }
-
- _src._jsrc.bytes_in_buffer = 0;
- _src._jsrc.next_input_byte = buffer;
- _src._jsrc.init_source = reinterpret_cast< void(*) ( j_decompress_ptr )>( &jpeg_decompress_mgr< Device >::init_device );
- _src._jsrc.fill_input_buffer = reinterpret_cast< boolean(*)( j_decompress_ptr )>( &jpeg_decompress_mgr< Device >::fill_buffer );
- _src._jsrc.skip_input_data = reinterpret_cast< void(*) ( j_decompress_ptr
- , long num_bytes
- ) >( &jpeg_decompress_mgr< Device >::skip_input_data );
- _src._jsrc.term_source = reinterpret_cast< void(*) ( j_decompress_ptr ) >( &jpeg_decompress_mgr< Device >::close_device );
- _src._jsrc.resync_to_restart = jpeg_resync_to_restart;
- _src._this = this;
-
- jpeg_create_decompress( &_cinfo );
-
- _cinfo.src = &_src._jsrc;
-
- jpeg_read_header( &_cinfo
- , TRUE );
-
- io_error_if( _cinfo.data_precision != 8
- , "Image file is not supported."
- );
- }
-
- ~jpeg_decompress_mgr()
- {
- jpeg_destroy_decompress( &_cinfo );
- }
-
-protected:
-
- // Taken from jerror.c
- /*
- * Error exit handler: must not return to caller.
- *
- * Applications may override this if they want to get control back after
- * an error. Typically one would longjmp somewhere instead of exiting.
- * The setjmp buffer can be made a private field within an expanded error
- * handler object. Note that the info needed to generate an error message
- * is stored in the error object, so you can generate the message now or
- * later, at your convenience.
- * You should make sure that the JPEG object is cleaned up (with jpeg_abort
- * or jpeg_destroy) at some point.
- */
- static void error_exit( j_common_ptr cinfo )
- {
- jpeg_decompress_mgr< Device >* mgr = reinterpret_cast< jpeg_decompress_mgr< Device >* >( cinfo->client_data );
-
- longjmp( mgr->_mark, 1 );
- }
-
- void raise_error()
- {
- // we clean up in the destructor
-
- io_error( "jpeg is invalid." );
- }
-
-private:
-
- // See jdatasrc.c for default implementation for the following static member functions.
-
- static void init_device( jpeg_decompress_struct * cinfo )
- {
- gil_jpeg_source_mgr* src = reinterpret_cast< gil_jpeg_source_mgr* >( cinfo->src );
- src->_jsrc.bytes_in_buffer = 0;
- src->_jsrc.next_input_byte = src->_this->buffer;
- }
-
- static boolean fill_buffer( jpeg_decompress_struct * cinfo )
- {
- gil_jpeg_source_mgr* src = reinterpret_cast< gil_jpeg_source_mgr* >( cinfo->src );
- size_t count= src->_this->in.read(src->_this->buffer, sizeof(src->_this->buffer) );
-
- if( count <= 0 )
- {
- // libjpeg does that: adding an EOF marker
- src->_this->buffer[0] = (JOCTET) 0xFF;
- src->_this->buffer[1] = (JOCTET) JPEG_EOI;
- count = 2;
- }
-
- src->_jsrc.next_input_byte = src->_this->buffer;
- src->_jsrc.bytes_in_buffer = count;
-
- return TRUE;
- }
-
- static void skip_input_data( jpeg_decompress_struct * cinfo, long num_bytes )
- {
- gil_jpeg_source_mgr* src = reinterpret_cast< gil_jpeg_source_mgr* >( cinfo->src );
-
- if( num_bytes > 0 )
- {
- while( num_bytes > long( src->_jsrc.bytes_in_buffer ))
- {
- num_bytes -= (long) src->_jsrc.bytes_in_buffer;
- fill_buffer( cinfo );
- }
-
- src->_jsrc.next_input_byte += num_bytes;
- src->_jsrc.bytes_in_buffer -= num_bytes;
- }
- }
-
- static void close_device( jpeg_decompress_struct* ) {}
-
-protected:
- jpeg_decompress_struct _cinfo;
-
-
-private:
- Device ∈
-
- struct gil_jpeg_source_mgr
- {
- jpeg_source_mgr _jsrc;
- jpeg_decompress_mgr* _this;
- };
-
- gil_jpeg_source_mgr _src;
-
- // libjpeg default is 4096 - see jdatasrc.c
- JOCTET buffer[4096];
-};
-
-template< typename Device
- , typename ConversionPolicy
- >
-class reader< Device
- , jpeg_tag
- , ConversionPolicy
- >
- : public jpeg_decompress_mgr< Device >
- , public reader_base< jpeg_tag
- , ConversionPolicy >
-{
-public:
- reader( Device& device
- , const image_read_settings< jpeg_tag >& settings
- )
- : jpeg_decompress_mgr( device )
- , reader_base< jpeg_tag
- , ConversionPolicy >( settings )
- {}
-
- reader( Device& device
- , const typename ConversionPolicy::color_converter_type& cc
- , const image_read_settings< jpeg_tag >& settings
- )
- : jpeg_decompress_mgr< Device >( device )
- , reader_base< jpeg_tag
- , ConversionPolicy >( cc
- , settings
- )
- {}
-
- image_read_info< jpeg_tag > get_info()
- {
- image_read_info ret;
- ret._width = this->_cinfo.image_width;
- ret._height = this->_cinfo.image_height;
- ret._num_components = this->_cinfo.num_components;
- ret._color_space = this->_cinfo.jpeg_color_space;
- ret._data_precision = this->_cinfo.data_precision;
-
- return ret;
- }
-
- template
- void apply( const View& view )
- {
- // Fire exception in case of error.
- if( setjmp( this->_mark )) { this->raise_error(); }
-
- jpeg_decompress_struct& cinfo = this->_cinfo;
- cinfo.dct_method = this->_settings._dct_method;
-
- typedef typename is_same< ConversionPolicy
- , read_and_no_convert
- >::type is_read_and_convert_t;
-
- io_error_if( !is_allowed< View >( this->_info
- , is_read_and_convert_t()
- )
- , "Image types aren't compatible."
- );
-
- if( jpeg_start_decompress( &this->_cinfo ) == false )
- {
- io_error( "Cannot start decompression." );
- }
-
- switch( this->_info._color_space )
- {
- case JCS_GRAYSCALE: { read_rows< gray8_pixel_t >( view ); break; }
- case JCS_RGB: { read_rows< rgb8_pixel_t >( view ); break; }
-
- //!\todo add Y'CbCr? We loose image quality when reading JCS_YCbCr as JCS_RGB
- case JCS_YCbCr: { read_rows< rgb8_pixel_t >( view ); break; }
-
- case JCS_CMYK: { read_rows< cmyk8_pixel_t >( view ); break; }
-
- //!\todo add Y'CbCrK? We loose image quality when reading JCS_YCCK as JCS_CMYK
- case JCS_YCCK:
- {
- this->_cinfo.out_color_space = JCS_CMYK;
- read_rows< cmyk8_pixel_t >( view );
-
- break;
- }
- default: { io_error( "Unsupported jpeg color space." ); }
- }
-
- jpeg_finish_decompress ( &this->_cinfo );
- }
-
-private:
-
- template< typename ImagePixel
- , typename View
- >
- void read_rows( const View& view )
- {
- typedef std::vector buffer_t;
- buffer_t buffer( this->_info._width );
-
- // In case of an error we'll jump back to here and fire an exception.
- // @todo Is the buffer above cleaned up when the exception is thrown?
- // The strategy right now is to allocate necessary memory before
- // the setjmp.
- if( setjmp( this->_mark )) { this->raise_error(); }
-
-
- JSAMPLE *row_adr = reinterpret_cast< JSAMPLE* >( &buffer[0] );
-
- //Skip scanlines if necessary.
- for( int y = 0; y < this->_settings._top_left.y; ++y )
- {
- io_error_if( jpeg_read_scanlines( &this->_cinfo
- , &row_adr
- , 1
- ) !=1
- , "jpeg_read_scanlines: fail to read JPEG file"
- );
- }
-
- // Read data.
- for( int y = 0; y < view.height(); ++y )
- {
- io_error_if( jpeg_read_scanlines( &this->_cinfo
- , &row_adr
- , 1
- ) !=1
- , "jpeg_read_scanlines: fail to read JPEG file"
- );
-
- typename buffer_t::iterator beg = buffer.begin() + this->_settings._top_left.x;
- typename buffer_t::iterator end = beg + this->_settings._dim.x;
-
- this->_cc_policy.read( beg
- , end
- , view.row_begin( y )
- );
- }
-
- //@todo: There might be a better way to do that.
- while( this->_cinfo.output_scanline < this->_cinfo.image_height )
- {
- io_error_if( jpeg_read_scanlines( &this->_cinfo
- , &row_adr
- , 1
- ) !=1
- , "jpeg_read_scanlines: fail to read JPEG file"
- );
- }
-
- }
-};
-
-struct jpeg_type_format_checker
-{
- jpeg_type_format_checker( jpeg_color_space::type color_space )
- : _color_space( color_space )
- {}
-
- template< typename Image >
- bool apply()
- {
- return is_read_supported< typename get_pixel_type< typename Image::view_t >::type
- , jpeg_tag
- >::_color_space == _color_space;
- }
-
-private:
-
- jpeg_color_space::type _color_space;
-};
-
-struct jpeg_read_is_supported
-{
- template< typename View >
- struct apply : public is_read_supported< typename get_pixel_type< View >::type
- , jpeg_tag
- >
- {};
-};
-
-template< typename Device
- >
-class dynamic_image_reader< Device
- , jpeg_tag
- >
- : public reader< Device
- , jpeg_tag
- , detail::read_and_no_convert
- >
-{
- typedef reader< Device
- , jpeg_tag
- , detail::read_and_no_convert
- > parent_t;
-
-public:
-
- dynamic_image_reader( Device& device
- , const image_read_settings< jpeg_tag >& settings
- )
- : parent_t( device
- , settings
- )
- {}
-
- template< typename Images >
- void apply( any_image< Images >& images )
- {
- jpeg_type_format_checker format_checker( this->_info._color_space != JCS_YCbCr
- ? this->_info._color_space
- : JCS_RGB
- );
-
- if( !construct_matched( images
- , format_checker
- ))
- {
- io_error( "No matching image type between those of the given any_image and that of the file" );
- }
- else
- {
- init_image( images
- , this->_info
- );
-
- dynamic_io_fnobj< jpeg_read_is_supported
- , parent_t
- > op( this );
-
- apply_operation( view( images )
- , op
- );
- }
- }
-};
-
-} // detail
-} // gil
-} // boost
-
-#endif // BOOST_GIL_EXTENSION_IO_JPEG_IO_READ_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/jpeg/supported_types.hpp b/third-party/boost/gil/extension/io_new/formats/jpeg/supported_types.hpp
deleted file mode 100644
index f0f0862b..00000000
--- a/third-party/boost/gil/extension/io_new/formats/jpeg/supported_types.hpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_JPEG_SUPPORTED_TYPES_HPP
-#define BOOST_GIL_EXTENSION_IO_JPEG_SUPPORTED_TYPES_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-
-#include
-#include
-
-namespace boost { namespace gil { namespace detail {
-
-// Read support
-
-template< jpeg_color_space::type ColorSpace >
-struct jpeg_rw_support_base
-{
- static const jpeg_color_space::type _color_space = ColorSpace;
-};
-
-template< typename Channel
- , typename ColorSpace
- >
-struct jpeg_read_support : read_support_false
- , jpeg_rw_support_base< JCS_UNKNOWN > {};
-
-template<>
-struct jpeg_read_support< bits8
- , rgb_t
- > : read_support_true
- , jpeg_rw_support_base< JCS_RGB > {};
-
-template<>
-struct jpeg_read_support< bits8
- , cmyk_t
- > : read_support_true
- , jpeg_rw_support_base< JCS_CMYK > {};
-
-template<>
-struct jpeg_read_support< bits8
- , gray_t
- > : read_support_true
- , jpeg_rw_support_base< JCS_GRAYSCALE > {};
-
-// Write support
-
-template< typename Channel
- , typename ColorSpace
- >
-struct jpeg_write_support : write_support_false
- , jpeg_rw_support_base< JCS_UNKNOWN > {};
-
-template<>
-struct jpeg_write_support< bits8
- , gray_t
- > : write_support_true
- , jpeg_rw_support_base< JCS_GRAYSCALE > {};
-
-template<>
-struct jpeg_write_support< bits8
- , rgb_t
- > : write_support_true
- , jpeg_rw_support_base< JCS_RGB > {};
-
-template<>
-struct jpeg_write_support< bits8
- , cmyk_t
- > : write_support_true
- , jpeg_rw_support_base< JCS_CMYK > {};
-
-} // namespace detail
-
-template< typename Pixel >
-struct is_read_supported< Pixel
- , jpeg_tag
- >
- : mpl::bool_< detail::jpeg_read_support< typename channel_type< Pixel >::type
- , typename color_space_type< Pixel >::type
- >::is_supported
- >
-{
- typedef detail::jpeg_read_support< typename channel_type< Pixel >::type
- , typename color_space_type< Pixel >::type
- > parent_t;
-
- static const typename jpeg_color_space::type _color_space = parent_t::_color_space;
-};
-
-template< typename Pixel >
-struct is_write_supported< Pixel
- , jpeg_tag
- >
- : mpl::bool_< detail::jpeg_write_support< typename channel_type< Pixel >::type
- , typename color_space_type< Pixel >::type
- >::is_supported
- >
-{};
-
-
-} // namespace gil
-} // namespace boost
-
-
-#endif // BOOST_GIL_EXTENSION_IO_JPEG_SUPPORTED_TYPES_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/jpeg/write.hpp b/third-party/boost/gil/extension/io_new/formats/jpeg/write.hpp
deleted file mode 100644
index b8974b69..00000000
--- a/third-party/boost/gil/extension/io_new/formats/jpeg/write.hpp
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_JPEG_IO_WRITE_HPP
-#define BOOST_GIL_EXTENSION_IO_JPEG_IO_WRITE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-
-#include
-#include
-
-#include
-
-#include "base.hpp"
-#include "supported_types.hpp"
-
-namespace boost { namespace gil { namespace detail {
-
-template< typename Device >
-class writer< Device
- , jpeg_tag
- > : public jpeg_io_base
-{
-public:
-
- writer( Device& file )
- : out( file )
- {
- _cinfo.err = jpeg_std_error( &_jerr );
- _cinfo.client_data = this;
-
- // Error exit handler: does not return to caller.
- _jerr.error_exit = &writer< Device, jpeg_tag >::error_exit;
-
- // Fire exception in case of error.
- if( setjmp( _mark )) { raise_error(); }
-
- _dest._jdest.free_in_buffer = sizeof( buffer );
- _dest._jdest.next_output_byte = buffer;
- _dest._jdest.init_destination = reinterpret_cast< void(*) ( j_compress_ptr ) >( &writer< Device, jpeg_tag >::init_device );
- _dest._jdest.empty_output_buffer = reinterpret_cast< boolean(*)( j_compress_ptr ) >( &writer< Device, jpeg_tag >::empty_buffer );
- _dest._jdest.term_destination = reinterpret_cast< void(*) ( j_compress_ptr ) >( &writer< Device, jpeg_tag >::close_device );
- _dest._this = this;
-
- jpeg_create_compress( &_cinfo );
- _cinfo.dest = &_dest._jdest;
-
- }
-
- ~writer()
- {
- jpeg_finish_compress ( &_cinfo );
- jpeg_destroy_compress( &_cinfo );
- }
-
- template
- void apply( const View& view )
- {
- write_rows( view
- , jpeg_quality::default_value
- , jpeg_dct_method::default_value
- );
- }
-
- template< typename View >
- void apply( const View& view
- , const image_write_info< jpeg_tag >& info )
- {
- write_rows( view
- , info._quality
- , info._dct_method
- );
- }
-
-private:
-
- template
- void write_rows( const View& view
- , const jpeg_quality::type quality
- , const jpeg_dct_method::type dct_method
- )
- {
- std::vector< typename View::value_type > row_buffer( view.width() );
-
- // In case of an error we'll jump back to here and fire an exception.
- // @todo Is the buffer above cleaned up when the exception is thrown?
- // The strategy right now is to allocate necessary memory before
- // the setjmp.
- if( setjmp( _mark )) { raise_error(); }
-
- typedef typename channel_type< typename View::value_type >::type channel_t;
-
- _cinfo.image_width = JDIMENSION( view.width() );
- _cinfo.image_height = JDIMENSION( view.height() );
- _cinfo.input_components = num_channels::value;
- _cinfo.in_color_space = detail::jpeg_write_support< channel_t
- , typename color_space_type< View >::type
- >::_color_space;
-
- jpeg_set_defaults( &_cinfo );
- jpeg_set_quality ( &_cinfo
- , quality
- , TRUE
- );
-
- // Needs to be done after jpeg_set_defaults() since it's overridding this value back to slow.
- _cinfo.dct_method = dct_method;
-
- jpeg_start_compress( &_cinfo
- , TRUE
- );
-
- JSAMPLE* row_addr = reinterpret_cast< JSAMPLE* >( &row_buffer[0] );
-
- for( int y =0; y != view.height(); ++ y )
- {
- std::copy( view.row_begin( y )
- , view.row_end ( y )
- , row_buffer.begin()
- );
-
- jpeg_write_scanlines( &this->_cinfo
- , &row_addr
- , 1
- );
- }
- }
-
- struct gil_jpeg_destination_mgr
- {
- jpeg_destination_mgr _jdest;
- writer * _this;
- };
-
- static void init_device( jpeg_compress_struct* cinfo )
- {
- gil_jpeg_destination_mgr* dest = reinterpret_cast< gil_jpeg_destination_mgr* >( cinfo->dest );
-
- dest->_jdest.free_in_buffer = sizeof( dest->_this->buffer );
- dest->_jdest.next_output_byte = dest->_this->buffer;
- }
-
- static boolean empty_buffer( jpeg_compress_struct* cinfo )
- {
- gil_jpeg_destination_mgr* dest = reinterpret_cast< gil_jpeg_destination_mgr* >( cinfo->dest );
-
- dest->_this->out.write( dest->_this->buffer
- , buffer_size
- );
-
- writer::init_device( cinfo );
- return 1;
- }
-
- static void close_device( jpeg_compress_struct* cinfo )
- {
- writer::empty_buffer( cinfo );
-
- gil_jpeg_destination_mgr* dest = reinterpret_cast< gil_jpeg_destination_mgr* >( cinfo->dest );
-
- dest->_this->out.flush();
- }
-
- void raise_error()
- {
- io_error( "Cannot write jpeg file." );
- }
-
- static void error_exit( j_common_ptr cinfo )
- {
- writer< Device, jpeg_tag >* mgr = reinterpret_cast< writer< Device, jpeg_tag >* >( cinfo->client_data );
-
- longjmp( mgr->_mark, 1 );
- }
-
-private:
-
- Device &out;
-
- jpeg_compress_struct _cinfo;
-
- gil_jpeg_destination_mgr _dest;
-
- static const unsigned int buffer_size = 1024;
- JOCTET buffer[buffer_size];
-};
-
-struct jpeg_write_is_supported
-{
- template< typename View >
- struct apply
- : public is_write_supported< typename get_pixel_type< View >::type
- , jpeg_tag
- >
- {};
-};
-
-// unary application
-template
-typename Op::result_type GIL_FORCEINLINE apply_operation_basec( const Bits& bits
- , std::size_t index
- , const image_write_info< Tag >& info
- , Op op
- )
-{
- return detail::apply_operation_fwd_fn::value>().template applyc( bits
- , index
- , op
- );
-}
-
-// unary application
-template< typename Types
- , typename Info
- , typename Bits
- , typename Op
- >
-typename Op::result_type GIL_FORCEINLINE apply_operation_base( Bits& bits
- , std::size_t index
- , const Info& info
- , Op op
- )
-{
- return detail::apply_operation_fwd_fn< mpl::size< Types >::value>().template apply< Types
- >( bits
- , index
- , info
- , op
- );
-}
-
-
-
-/// \ingroup Variant
-/// \brief Invokes a generic constant operation (represented as a binary function object) on two variants
-template< typename Types1
- , typename Info
- , typename BinaryOp
- >
-GIL_FORCEINLINE
-typename BinaryOp::result_type apply_operation( const variant< Types1 >& arg1
- , const Info& info
- , BinaryOp op
- )
-{
- typename variant< Types1 >::base_t bits = arg1.bits();
-
- return apply_operation_base< Types1
- , image_write_info< jpeg_tag >
- >( bits
- , arg1.index()
- , info
- , op
- );
-}
-
-template< typename Device >
-class dynamic_image_writer< Device
- , jpeg_tag
- >
- : public writer< Device
- , jpeg_tag
- >
-{
- typedef writer< Device
- , jpeg_tag
- > parent_t;
-
-public:
-
- dynamic_image_writer( Device& file )
- : parent_t( file )
- {}
-
- template< typename Views >
- void apply( const any_image_view< Views >& views )
- {
- dynamic_io_fnobj< jpeg_write_is_supported
- , parent_t
- > op( this );
-
- apply_operation( views, op );
- }
-
- template< typename Views >
- void apply( const any_image_view < Views >& views
- , const image_write_info< jpeg_tag >& info
- )
- {
- dynamic_io_fnobj< jpeg_write_is_supported
- , parent_t
- > op( this );
-
- apply_operation( views, info, op );
- }
-};
-
-} // detail
-} // gil
-} // boost
-
-#endif // BOOST_GIL_EXTENSION_IO_JPEG_IO_WRITE_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/png/base.hpp b/third-party/boost/gil/extension/io_new/formats/png/base.hpp
deleted file mode 100644
index 86bee9aa..00000000
--- a/third-party/boost/gil/extension/io_new/formats/png/base.hpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_DETAIL_PNG_IO_BASE_HPP
-#define BOOST_GIL_EXTENSION_IO_DETAIL_PNG_IO_BASE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-
-#include
-#include
-#include
-#include
-
-namespace boost { namespace gil { namespace detail {
-
-template
-class png_io_base
-{
-public:
- png_io_base( Device & io_dev )
- : _io_dev(io_dev)
- {}
-
-protected:
- Device & _io_dev;
-
- void check() const
- {
- byte_t buf[PNG_BYTES_TO_CHECK];
-
- io_error_if(_io_dev.read(buf, PNG_BYTES_TO_CHECK) != PNG_BYTES_TO_CHECK,
- "png_check_validity: failed to read image");
-
- io_error_if(png_sig_cmp(png_bytep(buf), png_size_t(0), PNG_BYTES_TO_CHECK)!=0,
- "png_check_validity: invalid png image");
- }
-
- static void read_data( png_structp png_ptr
- , png_bytep data
- , png_size_t length
- )
- {
- static_cast(png_get_io_ptr(png_ptr) )->read( data
- , length );
- }
-
- static void write_data( png_structp png_ptr
- , png_bytep data
- , png_size_t length
- )
- {
- static_cast( png_get_io_ptr( png_ptr ))->write( data
- , length );
- }
-
- static void flush( png_structp png_ptr )
- {
- static_cast(png_get_io_ptr(png_ptr) )->flush();
- }
-
-
- static int read_user_chunk_callback( png_struct* /* png_ptr */
- , png_unknown_chunkp /* chunk */
- )
- {
- // @todo
- return 0;
- }
-
- static void read_row_callback( png_structp /* png_ptr */
- , png_uint_32 /* row_number */
- , int /* pass */
- )
- {
- // @todo
- }
-
-};
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_DETAIL_PNG_IO_BASE_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/png/is_allowed.hpp b/third-party/boost/gil/extension/io_new/formats/png/is_allowed.hpp
deleted file mode 100644
index cd9fbada..00000000
--- a/third-party/boost/gil/extension/io_new/formats/png/is_allowed.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- Copyright 2008 Christian Henning, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_PNG_IO_IS_ALLOWED_HPP
-#define BOOST_GIL_EXTENSION_IO_PNG_IO_IS_ALLOWED_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-
-namespace boost { namespace gil { namespace detail {
-
-template< typename View >
-bool is_allowed( const image_read_info< png_tag >& info
- , mpl::true_ // is read_and_no_convert
- )
-{
- typedef typename get_pixel_type< View >::type pixel_t;
-
- typedef typename channel_traits<
- typename element_type< pixel_t >::type >::value_type channel_t;
-
- const png_num_channels::type dst_num_channels = num_channels< pixel_t >::value;
- const png_bitdepth::type dst_bit_depth = detail::unsigned_integral_num_bits< channel_t >::value;
-
- return dst_num_channels == info._num_channels
- && dst_bit_depth == info._bit_depth;
-}
-
-template< typename View >
-bool is_allowed( const image_read_info< png_tag >& /* info */
- , mpl::false_ // is read_and_convert
- )
-{
- return true;
-}
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_PNG_IO_IS_ALLOWED_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/png/read.hpp b/third-party/boost/gil/extension/io_new/formats/png/read.hpp
deleted file mode 100644
index 8d9966a3..00000000
--- a/third-party/boost/gil/extension/io_new/formats/png/read.hpp
+++ /dev/null
@@ -1,923 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_DETAIL_PNG_IO_READ_HPP
-#define BOOST_GIL_EXTENSION_IO_DETAIL_PNG_IO_READ_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "base.hpp"
-#include "is_allowed.hpp"
-
-namespace boost { namespace gil { namespace detail {
-
-template< typename Device
- , typename ConversionPolicy
- >
-class reader< Device
- , png_tag
- , ConversionPolicy
- >
- : public png_io_base< Device >
- , public reader_base< png_tag
- , ConversionPolicy >
-{
-public:
-
- reader( Device& io_dev
- , const image_read_settings< png_tag >& settings
- )
- : png_io_base< Device >( io_dev )
- , reader_base< png_tag
- , ConversionPolicy >( settings )
- , _png_ptr ( NULL )
- , _info_ptr( NULL )
- {
- this->check();
- init_reader();
- }
-
- reader( Device& io_dev
- , const typename ConversionPolicy::color_converter_type& cc
- , const image_read_settings< png_tag >& settings
- )
- : png_io_base< Device >( io_dev )
- , reader_base< png_tag
- , ConversionPolicy >( cc
- , settings
- )
- , _png_ptr ( 0 )
- , _info_ptr( 0 )
- {
- this->check();
- init_reader();
- }
-
- ~reader()
- {
- png_destroy_read_struct( &_png_ptr
- , &_info_ptr
- , NULL
- );
- }
-
- image_read_info get_info() const
- {
- image_read_info< png_tag > ret;
-
- // get PNG_IHDR chunk information from png_info structure
- png_get_IHDR( _png_ptr
- , _info_ptr
- , &ret._width
- , &ret._height
- , &ret._bit_depth
- , &ret._color_type
- , &ret._interlace_method
- , &ret._compression_method
- , &ret._filter_method
- );
-
- // get number of color channels in image
- ret._num_channels = png_get_channels( _png_ptr
- , _info_ptr
- );
-
-#ifdef BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
-
- // Get CIE chromacities and referenced white point for given image
- if( this->_settings._read_cie_chromacities )
- {
- ret._valid_cie_colors = png_get_cHRM( _png_ptr
- , _info_ptr
- , &ret._white_x, &ret._white_y
- , &ret._red_x, &ret._red_y
- , &ret._green_x, &ret._green_y
- , &ret._blue_x, &ret._blue_y
- );
- }
-
- // get the gamma value for given image
- if( this->_settings._read_file_gamma )
- {
- ret._valid_file_gamma = png_get_gAMA( _png_ptr
- , _info_ptr
- , &ret._file_gamma
- );
- if( ret._valid_file_gamma == false )
- {
- ret._file_gamma = 1.0;
- }
- }
-#else
-
- // Get CIE chromacities and referenced white point for given image
- if( this->_settings._read_cie_chromacities )
- {
- ret._valid_cie_colors = png_get_cHRM_fixed( _png_ptr
- , _info_ptr
- , &ret._white_x, &ret._white_y
- , &ret._red_x, &ret._red_y
- , &ret._green_x, &ret._green_y
- , &ret._blue_x, &ret._blue_y
- );
- }
-
- // get the gamma value for given image
- if( this->_settings._read_file_gamma )
- {
- ret._valid_file_gamma = png_get_gAMA_fixed( _png_ptr
- , _info_ptr
- , &ret._file_gamma
- );
-
- if( ret._valid_file_gamma == false )
- {
- ret._file_gamma = 1;
- }
- }
-#endif // BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
-
- // get the embedded ICC profile data for given image
- if( this->_settings._read_icc_profile )
- {
- png_charp icc_name = png_charp( NULL );
- png_charp profile = png_charp( NULL );
-
- ret._valid_icc_profile = png_get_iCCP( _png_ptr
- , _info_ptr
- , &icc_name
- , &ret._iccp_compression_type
- , &profile
- , &ret._profile_length
- );
- if( icc_name )
- {
- ret._icc_name.append( icc_name
- , std::strlen( icc_name )
- );
- }
-
- if( ret._profile_length > 0 )
- {
- ret._profile.append( profile
- , ret._profile_length
- );
- }
- }
-
- // get the rendering intent for given image
- if( this->_settings._read_intent )
- {
- ret._valid_intent = png_get_sRGB( _png_ptr
- , _info_ptr
- , &ret._intent
- );
- }
-
- // get image palette information from png_info structure
- if( this->_settings._read_palette )
- {
- png_colorp palette = png_colorp( NULL );
-
- ret._valid_palette = png_get_PLTE( _png_ptr
- , _info_ptr
- , &palette
- , &ret._num_palette
- );
-
- if( ret._num_palette > 0 )
- {
- ret._palette.resize( ret._num_palette );
- std::copy( palette
- , palette + ret._num_palette
- , &ret._palette.front()
- );
- }
- }
-
- // get background color for given image
- if( this->_settings._read_background )
- {
- png_color_16p background = png_color_16p( NULL );
-
- ret._valid_background = png_get_bKGD( _png_ptr
- , _info_ptr
- , &background
- );
- if( background )
- {
- ret._background = *background;
- }
- }
-
- // get the histogram for given image
- if( this->_settings._read_histogram )
- {
- png_uint_16p histogram = png_uint_16p( NULL );
-
- ret._valid_histogram = png_get_hIST( _png_ptr
- , _info_ptr
- , &histogram
- );
-
- if( histogram )
- {
- // the number of values is set by the number of colors inside
- // the palette.
- if( this->_settings._read_palette == false )
- {
- png_colorp palette = png_colorp( NULL );
- png_get_PLTE( _png_ptr
- , _info_ptr
- , &palette
- , &ret._num_palette
- );
- }
-
- std::copy( histogram
- , histogram + ret._num_palette
- , &ret._histogram.front()
- );
- }
- }
-
- // get screen offsets for the given image
- if( this->_settings._read_screen_offsets )
- {
- ret._valid_offset = png_get_oFFs( _png_ptr
- , _info_ptr
- , &ret._offset_x
- , &ret._offset_y
- , &ret._off_unit_type
- );
- }
-
-
- // get pixel calibration settings
- if( this->_settings._read_pixel_calibration )
- {
- png_charp purpose = png_charp ( NULL );
- png_charp units = png_charp ( NULL );
- png_charpp params = png_charpp( NULL );
-
- ret._valid_pixel_calibration = png_get_pCAL( _png_ptr
- , _info_ptr
- , &purpose
- , &ret._X0
- , &ret._X1
- , &ret._cal_type
- , &ret._num_params
- , &units
- , ¶ms
- );
- if( purpose )
- {
- ret._purpose.append( purpose
- , std::strlen( purpose )
- );
- }
-
- if( units )
- {
- ret._units.append( units
- , std::strlen( units )
- );
- }
-
- if( ret._num_params > 0 )
- {
- ret._params.resize( ret._num_params );
-
- for( png_CAL_nparam::type i = 0
- ; i < ret._num_params
- ; ++i
- )
- {
- ret._params[i].append( params[i]
- , std::strlen( params[i] )
- );
- }
- }
- }
-
- // get the physical resolution for given image
- if( this->_settings._read_physical_resolution )
- {
- ret._valid_resolution = png_get_pHYs( _png_ptr
- , _info_ptr
- , &ret._res_x
- , &ret._res_y
- , &ret._phy_unit_type
- );
- }
-
- // get number of significant bits for each color channel
- if( this->_settings._read_number_of_significant_bits )
- {
- png_color_8p sig_bits = png_color_8p( NULL );
-
- ret._valid_significant_bits = png_get_sBIT( _png_ptr
- , _info_ptr
- , &sig_bits
- );
-
- // @todo Is there one or more colors?
- if( sig_bits )
- {
- ret._sig_bits = *sig_bits;
- }
- }
-
-#ifdef BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
-
- // get physical scale settings
- if( this->_settings._read_scale_factors )
- {
- ret._valid_scale_factors = png_get_sCAL( _png_ptr
- , _info_ptr
- , &ret._scale_unit
- , &ret._scale_width
- , &ret._scale_height
- );
- }
-#else
-#ifdef BOOST_GIL_IO_PNG_FIXED_POINT_SUPPORTED
- if( this->_settings._read_scale_factors )
- {
- png_charp scale_width, scale_height;
-
- if( ret._valid_scale_factors = png_get_sCAL_s( _png_ptr
- , _info_ptr
- , &ret._scale_unit
- , &scale_width
- , &scale_height
- )
- )
- {
- if( scale_width )
- {
- ret._scale_width.append( scale_width
- , std::strlen( scale_width )
- );
- }
-
- if( scale_height )
- {
- ret._scale_height.append( scale_height
- , std::strlen( scale_height )
- );
- }
- }
- }
-#endif // BOOST_GIL_IO_PNG_FIXED_POINT_SUPPORTED
-#endif // BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
-
- // get comments information from png_info structure
- if( this->_settings._read_comments )
- {
- png_textp text = png_textp( NULL );
-
- ret._valid_text = png_get_text( _png_ptr
- , _info_ptr
- , &text
- , &ret._num_text
- );
-
- if( ret._num_text > 0 )
- {
- ret._text.resize( ret._num_text );
-
- for( png_num_text::type i = 0
- ; i < ret._num_text
- ; ++i
- )
- {
- ret._text[i]._compression = text[i].compression;
- ret._text[i]._key.append( text[i].key
- , std::strlen( text[i].key )
- );
-
- ret._text[i]._text.append( text[i].text
- , std::strlen( text[i].text )
- );
- }
- }
- }
-
- // get last modification time for the image
- if( this->_settings._read_last_modification_time )
- {
- png_timep mod_time = png_timep( NULL );
- ret._valid_modification_time = png_get_tIME( _png_ptr
- , _info_ptr
- , &mod_time
- );
- ret._mod_time = *mod_time;
- }
-
- // get transparency data for images
- if( this->_settings._read_transparency_data )
- {
- png_bytep trans = png_bytep ( NULL );
- png_color_16p trans_values = png_color_16p( NULL );
-
- ret._valid_transparency_factors = png_get_tRNS( _png_ptr
- , _info_ptr
- , &trans
- , &ret._num_trans
- , &trans_values
- );
-
- if( trans )
- {
- //@todo What to do, here? How do I know the length of the "trans" array?
- }
-
- if( ret._num_trans )
- {
- ret._trans_values.resize( ret._num_trans );
- std::copy( trans_values
- , trans_values + ret._num_trans
- , &ret._trans_values.front()
- );
- }
- }
-
- // @todo One day!
-/*
- if( false )
- {
- png_unknown_chunkp unknowns = png_unknown_chunkp( NULL );
- int num_unknowns = static_cast< int >( png_get_unknown_chunks( _png_ptr
- , _info_ptr
- , &unknowns
- )
- );
- }
-*/
-
- return ret;
- }
-
- template< typename View >
- void apply( const View& view )
- {
- // The info structures are filled at this point.
-
- // Now it's time for some transformations.
-
- if( little_endian() )
- {
- if( this->_info._bit_depth == 16 )
- {
- // Swap bytes of 16 bit files to least significant byte first.
- png_set_swap( _png_ptr );
- }
-
- if( this->_info._bit_depth < 8 )
- {
- // swap bits of 1, 2, 4 bit packed pixel formats
- png_set_packswap( _png_ptr );
- }
- }
-
- if( this->_info._color_type == PNG_COLOR_TYPE_PALETTE )
- {
- png_set_palette_to_rgb( _png_ptr );
- }
-
- if( this->_info._num_trans > 0 )
- {
- png_set_tRNS_to_alpha( _png_ptr );
- }
-
- // Tell libpng to handle the gamma conversion for you. The final call
- // is a good guess for PC generated images, but it should be configurable
- // by the user at run time by the user. It is strongly suggested that
- // your application support gamma correction.
- if( this->_settings._apply_screen_gamma )
- {
- // png_set_gamma will change the image data!
-
-#ifdef BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
- png_set_gamma( _png_ptr
- , this->_settings._screen_gamma
- , this->_info._file_gamma
- );
-#else
- png_set_gamma( _png_ptr
- , this->_settings._screen_gamma
- , this->_info._file_gamma
- );
-#endif // BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
- }
-
- // Turn on interlace handling. REQUIRED if you are not using
- // png_read_image(). To see how to handle interlacing passes,
- // see the png_read_row() method below:
- _number_passes = png_set_interlace_handling( _png_ptr );
-
-
- // The above transformation might have changed the bit_depth and color type.
- png_read_update_info( _png_ptr
- , _info_ptr
- );
-
- this->_info._bit_depth = png_get_bit_depth( _png_ptr
- , _info_ptr
- );
-
- this->_info._num_channels = png_get_channels( _png_ptr
- , _info_ptr
- );
-
- this->_info._color_type = png_get_color_type( _png_ptr
- , _info_ptr
- );
-
- switch( this->_info._color_type )
- {
- case PNG_COLOR_TYPE_GRAY:
- {
- switch( this->_info._bit_depth )
- {
- case 1: read_rows< gray1_image_t::view_t::reference >( view ); break;
- case 2: read_rows< gray2_image_t::view_t::reference >( view ); break;
- case 4: read_rows< gray4_image_t::view_t::reference >( view ); break;
- case 8: read_rows< gray8_pixel_t >( view ); break;
- case 16: read_rows< gray16_pixel_t >( view ); break;
- default: io_error( "png_reader::read_data(): unknown combination of color type and bit depth" );
- }
-
- break;
- }
- case PNG_COLOR_TYPE_GA:
- {
- #ifdef BOOST_GIL_IO_ENABLE_GRAY_ALPHA
- switch( this->_info._bit_depth )
- {
- case 8: read_rows< gray_alpha8_pixel_t > ( view ); break;
- case 16: read_rows< gray_alpha16_pixel_t >( view ); break;
- default: io_error( "png_reader::read_data(): unknown combination of color type and bit depth" );
- }
- #else
- io_error( "gray_alpha isn't enabled. Use ENABLE_GRAY_ALPHA when building application." );
- #endif // BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-
-
- break;
- }
- case PNG_COLOR_TYPE_RGB:
- {
- switch( this->_info._bit_depth )
- {
- case 8: read_rows< rgb8_pixel_t > ( view ); break;
- case 16: read_rows< rgb16_pixel_t >( view ); break;
- default: io_error( "png_reader::read_data(): unknown combination of color type and bit depth" );
- }
-
- break;
- }
- case PNG_COLOR_TYPE_RGBA:
- {
- switch( this->_info._bit_depth )
- {
- case 8: read_rows< rgba8_pixel_t > ( view ); break;
- case 16: read_rows< rgba16_pixel_t >( view ); break;
- default: io_error( "png_reader_color_convert::read_data(): unknown combination of color type and bit depth" );
- }
-
- break;
- }
- default: io_error( "png_reader_color_convert::read_data(): unknown color type" );
- }
-
- // read rest of file, and get additional chunks in info_ptr
- png_read_end( _png_ptr
- , NULL
- );
- }
-
-
-private:
-
- template< typename ImagePixel
- , typename View
- >
- void read_rows( const View& view )
- {
- typedef row_buffer_helper_view< ImagePixel > row_buffer_helper_t;
-
- typedef typename row_buffer_helper_t::buffer_t buffer_t;
- typedef typename row_buffer_helper_t::iterator_t it_t;
-
- typedef typename is_same< ConversionPolicy
- , read_and_no_convert
- >::type is_read_and_convert_t;
-
- io_error_if( !is_allowed< View >( this->_info
- , is_read_and_convert_t()
- )
- , "Image types aren't compatible."
- );
-
- std::size_t rowbytes = png_get_rowbytes( _png_ptr
- , _info_ptr
- );
-
- row_buffer_helper_t buffer( rowbytes
- , true
- );
-
- png_bytep row_ptr = (png_bytep)( &( buffer.data()[0]));
-
- for( std::size_t pass = 0; pass < _number_passes; pass++ )
- {
- if( pass == _number_passes - 1 )
- {
- // skip lines if necessary
- for( std::ptrdiff_t y = 0; y < this->_settings._top_left.y; ++y )
- {
- // Read the image using the "sparkle" effect.
- png_read_rows( _png_ptr
- , &row_ptr
- , NULL
- , 1
- );
- }
-
- for( std::ptrdiff_t y = 0
- ; y < this->_settings._dim.y
- ; ++y
- )
- {
- // Read the image using the "sparkle" effect.
- png_read_rows( _png_ptr
- , &row_ptr
- , NULL
- , 1
- );
-
- it_t first = buffer.begin() + this->_settings._top_left.x;
- it_t last = first + this->_settings._dim.x; // one after last element
-
- this->_cc_policy.read( first
- , last
- , view.row_begin( y ));
- }
-
- // Read the rest of the image. libpng needs that.
- std::ptrdiff_t remaining_rows = static_cast< std::ptrdiff_t >( this->_info._height )
- - this->_settings._top_left.y
- - this->_settings._dim.y;
- for( std::ptrdiff_t y = 0
- ; y < remaining_rows
- ; ++y
- )
- {
- // Read the image using the "sparkle" effect.
- png_read_rows( _png_ptr
- , &row_ptr
- , NULL
- , 1
- );
- }
- }
- else
- {
- for( int y = 0; y < view.height(); ++y )
- {
- // Read the image using the "sparkle" effect.
- png_read_rows( _png_ptr
- , &row_ptr
- , NULL
- , 1
- );
- }
- }
- }
-
- }
-
- void init_reader()
- {
- // Create and initialize the png_struct with the desired error handler
- // functions. If you want to use the default stderr and longjump method,
- // you can supply NULL for the last three parameters. We also supply the
- // the compiler header file version, so that we know if the application
- // was compiled with a compatible version of the library. REQUIRED
- _png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING
- , NULL // user_error_ptr
- , NULL // user_error_fn
- , NULL // user_warning_fn
- );
-
- io_error_if( _png_ptr == NULL
- , "png_reader: fail to call png_create_write_struct()"
- );
-
- png_uint_32 user_chunk_data[4];
- user_chunk_data[0] = 0;
- user_chunk_data[1] = 0;
- user_chunk_data[2] = 0;
- user_chunk_data[3] = 0;
- png_set_read_user_chunk_fn( _png_ptr
- , user_chunk_data
- , png_io_base< Device >::read_user_chunk_callback
- );
-
- // Allocate/initialize the memory for image information. REQUIRED.
- _info_ptr = png_create_info_struct( _png_ptr );
-
- if( _info_ptr == NULL )
- {
- png_destroy_read_struct( &_png_ptr
- , NULL
- , NULL
- );
-
- io_error( "png_reader: fail to call png_create_info_struct()" );
- }
-
- // Set error handling if you are using the setjmp/longjmp method (this is
- // the normal method of doing things with libpng). REQUIRED unless you
- // set up your own error handlers in the png_create_read_struct() earlier.
- if( setjmp( png_jmpbuf( _png_ptr )))
- {
- //free all of the memory associated with the png_ptr and info_ptr
- png_destroy_read_struct( &_png_ptr
- , &_info_ptr
- , NULL
- );
-
- io_error( "png is invalid" );
- }
-
- png_set_read_fn( _png_ptr
- , static_cast< png_voidp >( &this->_io_dev )
- , png_io_base< Device >::read_data
- );
-
- // Set up a callback function that will be
- // called after each row has been read, which you can use to control
- // a progress meter or the like.
- png_set_read_status_fn( _png_ptr
- , png_io_base< Device >::read_row_callback
- );
-
- // Set up a callback which implements user defined transformation.
- // @todo
- png_set_read_user_transform_fn( _png_ptr
- , png_user_transform_ptr( NULL )
- );
-
- png_set_keep_unknown_chunks( _png_ptr
- , PNG_HANDLE_CHUNK_ALWAYS
- , NULL
- , 0
- );
-
-
- // Make sure we read the signature.
- // @todo make it an option
- png_set_sig_bytes( _png_ptr
- , PNG_BYTES_TO_CHECK
- );
-
- // The call to png_read_info() gives us all of the information from the
- // PNG file before the first IDAT (image data chunk). REQUIRED
- png_read_info( _png_ptr
- , _info_ptr
- );
- }
-
-private:
-
- png_structp _png_ptr;
- png_infop _info_ptr;
-
- std::size_t _number_passes;
-};
-
-
-struct png_type_format_checker
-{
- png_type_format_checker( png_bitdepth::type bit_depth
- , png_color_type::type color_type
- )
- : _bit_depth ( bit_depth )
- , _color_type( color_type )
- {}
-
- template< typename Image >
- bool apply()
- {
- typedef is_read_supported< typename get_pixel_type< typename Image::view_t >::type
- , png_tag
- > is_supported_t;
-
- return is_supported_t::_bit_depth == _bit_depth
- && is_supported_t::_color_type == _color_type;
- }
-
-private:
-
- png_bitdepth::type _bit_depth;
- png_color_type::type _color_type;
-};
-
-struct png_read_is_supported
-{
- template< typename View >
- struct apply : public is_read_supported< typename get_pixel_type< View >::type
- , png_tag
- >
- {};
-};
-
-template< typename Device
- >
-class dynamic_image_reader< Device
- , png_tag
- >
- : public reader< Device
- , png_tag
- , detail::read_and_no_convert
- >
-{
- typedef reader< Device
- , png_tag
- , detail::read_and_no_convert
- > parent_t;
-
-public:
-
- dynamic_image_reader( Device& device
- , const image_read_settings< png_tag >& settings
- )
- : parent_t( device
- , settings
- )
- {}
-
- template< typename Images >
- void apply( any_image< Images >& images )
- {
- png_type_format_checker format_checker( this->_info._bit_depth
- , this->_info._color_type
- );
-
- if( !construct_matched( images
- , format_checker
- ))
- {
- io_error( "No matching image type between those of the given any_image and that of the file" );
- }
- else
- {
- init_image( images
- , this->_info
- );
-
- dynamic_io_fnobj< png_read_is_supported
- , parent_t
- > op( this );
-
- apply_operation( view( images )
- , op
- );
- }
- }
-};
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-
-
-#endif // BOOST_GIL_EXTENSION_IO_DETAIL_PNG_IO_READ_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/png/supported_types.hpp b/third-party/boost/gil/extension/io_new/formats/png/supported_types.hpp
deleted file mode 100644
index b0fc89bd..00000000
--- a/third-party/boost/gil/extension/io_new/formats/png/supported_types.hpp
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_PNG_SUPPORTED_TYPES_HPP
-#define BOOST_GIL_EXTENSION_IO_PNG_SUPPORTED_TYPES_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-#include
-#endif // BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-
-namespace boost { namespace gil { namespace detail {
-
-static const size_t PNG_BYTES_TO_CHECK = 4;
-
-// Read support
-template< png_bitdepth::type BitDepth
- , png_color_type::type ColorType
- >
-struct png_rw_support_base
-{
- static const png_bitdepth::type _bit_depth = BitDepth;
- static const png_color_type::type _color_type = ColorType;
-};
-
-template< typename Channel
- , typename ColorSpace
- >
-struct png_read_support : read_support_false
- , png_rw_support_base< 1
- , PNG_COLOR_TYPE_GRAY
- > {};
-
-template< typename BitField
- , bool Mutable
- >
-struct png_read_support< packed_dynamic_channel_reference< BitField
- , 1
- , Mutable
- >
- , gray_t
- > : read_support_true
- , png_rw_support_base< 1
- , PNG_COLOR_TYPE_GRAY
- > {};
-
-template< typename BitField
- , bool Mutable
- >
-struct png_read_support< packed_dynamic_channel_reference< BitField
- , 2
- , Mutable
- >
- , gray_t
- > : read_support_true
- , png_rw_support_base< 2
- , PNG_COLOR_TYPE_GRAY
- > {};
-
-template< typename BitField
- , bool Mutable
- >
-struct png_read_support< packed_dynamic_channel_reference< BitField
- , 4
- , Mutable
- >
- , gray_t
- > : read_support_true
- , png_rw_support_base< 4
- , PNG_COLOR_TYPE_GRAY
- > {};
-
-template<>
-struct png_read_support< bits8
- , gray_t
- > : read_support_true
- , png_rw_support_base< 8
- , PNG_COLOR_TYPE_GRAY
- > {};
-
-#ifdef BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-template<>
-struct png_read_support< bits8
- , gray_alpha_t
- > : read_support_true
- , png_rw_support_base< 8
- , PNG_COLOR_TYPE_GA
- > {};
-#endif // BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-
-template<>
-struct png_read_support< bits8
- , rgb_t
- > : read_support_true
- , png_rw_support_base< 8
- , PNG_COLOR_TYPE_RGB
- > {};
-
-template<>
-struct png_read_support< bits8
- , rgba_t
- > : read_support_true
- , png_rw_support_base< 8
- , PNG_COLOR_TYPE_RGBA
- > {};
-
-template<>
-struct png_read_support< bits16
- , gray_t
- > : read_support_true
- , png_rw_support_base< 16
- , PNG_COLOR_TYPE_GRAY
- > {};
-
-template<>
-struct png_read_support< bits16
- , rgb_t
- > : read_support_true
- , png_rw_support_base< 16
- , PNG_COLOR_TYPE_RGB
- > {};
-
-template<>
-struct png_read_support< bits16
- , rgba_t
- > : read_support_true
- , png_rw_support_base< 16
- , PNG_COLOR_TYPE_RGBA
- > {};
-
-#ifdef BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-template<>
-struct png_read_support< bits16
- , gray_alpha_t
- > : read_support_true
- , png_rw_support_base< 16
- , PNG_COLOR_TYPE_GA
- > {};
-#endif // BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-
-// Write support
-
-template< typename Channel
- , typename ColorSpace
- >
-struct png_write_support : write_support_false
- , png_rw_support_base< 1
- , PNG_COLOR_TYPE_GRAY
- > {};
-
-template< typename BitField
- , bool Mutable
- >
-struct png_write_support< packed_dynamic_channel_reference< BitField
- , 1
- , Mutable
- >
- , gray_t
- > : write_support_true
- , png_rw_support_base< 1
- , PNG_COLOR_TYPE_GRAY
- >
-{};
-
-template< typename BitField
- , bool Mutable
- >
-struct png_write_support< packed_dynamic_channel_reference< BitField
- , 1
- , Mutable
- > const
- , gray_t
- > : write_support_true
- , png_rw_support_base< 1
- , PNG_COLOR_TYPE_GRAY
- >
-{};
-
-template< typename BitField
- , bool Mutable
- >
-struct png_write_support< packed_dynamic_channel_reference< BitField
- , 2
- , Mutable
- >
- , gray_t
- > : write_support_true
- , png_rw_support_base< 2
- , PNG_COLOR_TYPE_GRAY
- >
-{};
-
-template< typename BitField
- , bool Mutable
- >
-struct png_write_support< packed_dynamic_channel_reference< BitField
- , 2
- , Mutable
- > const
- , gray_t
- > : write_support_true
- , png_rw_support_base< 2
- , PNG_COLOR_TYPE_GRAY
- >
-{};
-
-template< typename BitField
- , bool Mutable
- >
-struct png_write_support< packed_dynamic_channel_reference< BitField
- , 4
- , Mutable
- >
- , gray_t
- > : write_support_true
- , png_rw_support_base< 4
- , PNG_COLOR_TYPE_GRAY
- >
-{};
-
-template< typename BitField
- , bool Mutable
- >
-struct png_write_support< packed_dynamic_channel_reference< BitField
- , 4
- , Mutable
- > const
- , gray_t
- > : write_support_true
- , png_rw_support_base< 4
- , PNG_COLOR_TYPE_GRAY
- >
-{};
-
-template<>
-struct png_write_support< bits8
- , gray_t
- > : write_support_true
- , png_rw_support_base< 8
- , PNG_COLOR_TYPE_GRAY
- >
-{};
-
-#ifdef BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-template<>
-struct png_write_support< bits8
- , gray_alpha_t
- > : write_support_true
- , png_rw_support_base< 8
- , PNG_COLOR_TYPE_GA
- >
-{};
-#endif // BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-
-template<>
-struct png_write_support< bits8
- , rgb_t
- > : write_support_true
- , png_rw_support_base< 8
- , PNG_COLOR_TYPE_RGB
- >
-{};
-
-template<>
-struct png_write_support< bits8
- , rgba_t
- > : write_support_true
- , png_rw_support_base< 8
- , PNG_COLOR_TYPE_RGBA
- >
-{};
-
-template<>
-struct png_write_support< bits16
- , gray_t
- > : write_support_true
- , png_rw_support_base< 16
- , PNG_COLOR_TYPE_GRAY
- >
-{};
-
-template<>
-struct png_write_support< bits16
- , rgb_t
- > : write_support_true
- , png_rw_support_base< 16
- , PNG_COLOR_TYPE_RGB
- >
-{};
-
-template<>
-struct png_write_support< bits16
- , rgba_t
- > : write_support_true
- , png_rw_support_base< 16
- , PNG_COLOR_TYPE_RGBA
- >
-{};
-
-#ifdef BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-template<>
-struct png_write_support< bits16
- , gray_alpha_t
- > : write_support_true
- , png_rw_support_base< 16
- , PNG_COLOR_TYPE_GA
- >
-{};
-#endif // BOOST_GIL_IO_ENABLE_GRAY_ALPHA
-
-
-} // namespace detail
-
-template< typename Pixel >
-struct is_read_supported< Pixel
- , png_tag
- >
- : mpl::bool_< detail::png_read_support< typename channel_type< Pixel >::type
- , typename color_space_type< Pixel >::type
- >::is_supported
- >
-{
- typedef detail::png_read_support< typename channel_type< Pixel >::type
- , typename color_space_type< Pixel >::type
- > parent_t;
-
- static const png_bitdepth::type _bit_depth = parent_t::_bit_depth;
- static const png_color_type::type _color_type = parent_t::_color_type;
-};
-
-template< typename Pixel >
-struct is_write_supported< Pixel
- , png_tag
- >
- : mpl::bool_< detail::png_write_support< typename channel_type< Pixel >::type
- , typename color_space_type< Pixel >::type
- >::is_supported
- >
-{
- typedef detail::png_write_support< typename channel_type< Pixel >::type
- , typename color_space_type< Pixel >::type
- > parent_t;
-
- static const png_bitdepth::type _bit_depth = parent_t::_bit_depth;
- static const png_color_type::type _color_type = parent_t::_color_type;
-};
-
-} // namespace gil
-} // namespace boost
-
-
-#endif // BOOST_GIL_EXTENSION_IO_PNG_SUPPORTED_TYPES_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/png/write.hpp b/third-party/boost/gil/extension/io_new/formats/png/write.hpp
deleted file mode 100644
index 2ec5276a..00000000
--- a/third-party/boost/gil/extension/io_new/formats/png/write.hpp
+++ /dev/null
@@ -1,521 +0,0 @@
-/*
- Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_DETAIL_PNG_IO_WRITE_HPP
-#define BOOST_GIL_EXTENSION_IO_DETAIL_PNG_IO_WRITE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-extern "C" {
-#include
-}
-
-#include
-#include
-#include
-
-#include "base.hpp"
-#include "supported_types.hpp"
-
-namespace boost { namespace gil { namespace detail {
-
-template
-class writer< Device
- , png_tag
- > : png_io_base< Device >
-{
-
-public:
-
- writer( Device& io_dev )
- : png_io_base< Device >( io_dev )
- , _png_ptr ( NULL )
- , _info_ptr( NULL )
- {
- // Create and initialize the png_struct with the desired error handler
- // functions. If you want to use the default stderr and longjump method,
- // you can supply NULL for the last three parameters. We also check that
- // the library version is compatible with the one used at compile time,
- // in case we are using dynamically linked libraries. REQUIRED.
- _png_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING
- , NULL // user_error_ptr
- , NULL // user_error_fn
- , NULL // user_warning_fn
- );
-
- io_error_if( _png_ptr == NULL
- , "png_writer: fail to call png_create_write_struct()"
- );
-
- // Allocate/initialize the image information data. REQUIRED
- _info_ptr = png_create_info_struct( _png_ptr );
-
- if( _info_ptr == NULL )
- {
- png_destroy_write_struct( &_png_ptr
- , NULL
- );
-
- io_error( "png_writer: fail to call png_create_info_struct()" );
- }
-
- // Set error handling. REQUIRED if you aren't supplying your own
- // error handling functions in the png_create_write_struct() call.
- if( setjmp( png_jmpbuf( _png_ptr )))
- {
- //free all of the memory associated with the png_ptr and info_ptr
- png_destroy_write_struct( &_png_ptr
- , &_info_ptr
- );
-
- io_error( "png_writer: fail to call setjmp()" );
- }
-
- this->init_io( _png_ptr );
- }
-
- ~writer()
- {
- png_destroy_write_struct( &_png_ptr
- , &_info_ptr
- );
- }
-
- template< typename View >
- void apply( const View& view )
- {
- apply( view, image_write_info< png_tag >() );
- }
-
- template
- void apply( const View& view
- , const image_write_info< png_tag >& info
- )
- {
- typedef png_write_support< typename channel_type < typename get_pixel_type< View >::type >::type
- , typename color_space_type< View >::type
- > png_rw_info_t;
-
- io_error_if( view.width() == 0 && view.height() == 0
- , "png format cannot handle empty views."
- );
-
- // Set the image information here. Width and height are up to 2^31,
- // bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
- // the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
- // PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB,
- // or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or
- // PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
- // currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED
- png_set_IHDR( _png_ptr
- , _info_ptr
- , static_cast< png_image_width::type >( view.width() )
- , static_cast< png_image_height::type >( view.height() )
- , static_cast< png_bitdepth::type >( png_rw_info_t::_bit_depth )
- , static_cast< png_color_type::type >( png_rw_info_t::_color_type )
- , info._interlace_method
- , info._compression_method
- , info._filter_method
- );
-
-#ifdef BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
- if( info._valid_cie_colors )
- {
- png_set_cHRM( _png_ptr
- , _info_ptr
- , info._white_x
- , info._white_y
- , info._red_x
- , info._red_y
- , info._green_x
- , info._green_y
- , info._blue_x
- , info._blue_y
- );
- }
-
- if( info._valid_file_gamma )
- {
- png_set_gAMA( _png_ptr
- , _info_ptr
- , info._gamma
- );
- }
-#else
- if( info._valid_cie_colors )
- {
- png_set_cHRM_fixed( _png_ptr
- , _info_ptr
- , info._white_x
- , info._white_y
- , info._red_x
- , info._red_y
- , info._green_x
- , info._green_y
- , info._blue_x
- , info._blue_y
- );
- }
-
- if( info._valid_file_gamma )
- {
- png_set_gAMA_fixed( _png_ptr
- , _info_ptr
- , info._file_gamma
- );
- }
-#endif // BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
-
- if( info._valid_icc_profile )
- {
- png_set_iCCP( _png_ptr
- , _info_ptr
- , const_cast< png_charp >( info._icc_name.c_str() )
- , info._iccp_compression_type
- , const_cast< png_charp >( info._profile.c_str() )
- , info._profile_length
- );
- }
-
- if( info._valid_intent )
- {
- png_set_sRGB( _png_ptr
- , _info_ptr
- , info._intent
- );
- }
-
- if( info._valid_palette )
- {
- png_set_PLTE( _png_ptr
- , _info_ptr
- , const_cast< png_colorp >( &info._palette.front() )
- , info._num_palette
- );
- }
-
- if( info._valid_background )
- {
- png_set_bKGD( _png_ptr
- , _info_ptr
- , const_cast< png_color_16p >( &info._background )
- );
- }
-
- if( info._valid_histogram )
- {
- png_set_hIST( _png_ptr
- , _info_ptr
- , const_cast< png_uint_16p >( &info._histogram.front() )
- );
- }
-
- if( info._valid_offset )
- {
- png_set_oFFs( _png_ptr
- , _info_ptr
- , info._offset_x
- , info._offset_y
- , info._off_unit_type
- );
- }
-
- if( info._valid_pixel_calibration )
- {
- std::vector< const char* > params( info._num_params );
- for( std::size_t i = 0; i < params.size(); ++i )
- {
- params[i] = info._params[ i ].c_str();
- }
-
- png_set_pCAL( _png_ptr
- , _info_ptr
- , const_cast< png_charp >( info._purpose.c_str() )
- , info._X0
- , info._X1
- , info._cal_type
- , info._num_params
- , const_cast< png_charp >( info._units.c_str() )
- , const_cast< png_charpp >( ¶ms.front() )
- );
- }
-
- if( info._valid_resolution )
- {
- png_set_pHYs( _png_ptr
- , _info_ptr
- , info._res_x
- , info._res_y
- , info._phy_unit_type
- );
- }
-
- if( info._valid_significant_bits )
- {
- png_set_sBIT( _png_ptr
- , _info_ptr
- , const_cast< png_color_8p >( &info._sig_bits )
- );
- }
-
-#ifdef BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
- if( info._valid_scale_factors )
- {
- png_set_sCAL( _png_ptr
- , _info_ptr
- , info._scale_unit
- , info._scale_width
- , info._scale_height
- );
- }
-#else
-#ifdef BOOST_GIL_IO_PNG_FIXED_POINT_SUPPORTED
-
- if( info._valid_scale_factors )
- {
- png_set_sCAL_s( _png_ptr
- , _info_ptr
- , _scale_unit
- , const_cast< png_charp >( _scale_width.c_str() )
- , const_cast< png_charp >( _scale_height.c_str() )
- );
- }
-#endif // BOOST_GIL_IO_PNG_FIXED_POINT_SUPPORTED
-#endif // BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED
-
-
- if( info._valid_text )
- {
- std::vector< png_text > texts( info._num_text );
- for( std::size_t i = 0; i < texts.size(); ++i )
- {
- png_text pt;
- pt.compression = info._text[i]._compression;
- pt.key = const_cast< png_charp >( info._text[i]._key.c_str() );
- pt.text = const_cast< png_charp >( info._text[i]._text.c_str() );
- pt.text_length = info._text[i]._text.length();
-
- texts[i] = pt;
- }
-
- png_set_text( _png_ptr
- , _info_ptr
- , &texts.front()
- , info._num_text
- );
- }
-
- if( info._valid_modification_time )
- {
- png_set_tIME( _png_ptr
- , _info_ptr
- , const_cast< png_timep >( &info._mod_time )
- );
- }
-
- if( info._valid_transparency_factors )
- {
- int sample_max = ( 1 << info._bit_depth );
-
- /* libpng doesn't reject a tRNS chunk with out-of-range samples */
- if( !( ( info._color_type == PNG_COLOR_TYPE_GRAY
- && (int) info._trans_values[0].gray > sample_max
- )
- || ( info._color_type == PNG_COLOR_TYPE_RGB
- &&( (int) info._trans_values[0].red > sample_max
- || (int) info._trans_values[0].green > sample_max
- || (int) info._trans_values[0].blue > sample_max
- )
- )
- )
- )
- {
- //@todo Fix that once reading transparency values works
-/*
- png_set_tRNS( _png_ptr
- , _info_ptr
- , trans
- , num_trans
- , trans_values
- );
-*/
- }
- }
-
- png_write_info( _png_ptr
- ,_info_ptr
- );
-
- write_view( view
- , typename is_bit_aligned< View >::type()
- );
- }
-
-private:
-
- template
- void write_view( const View& view
- , mpl::false_ // is bit aligned
- )
- {
- typedef typename get_pixel_type< View >::type pixel_t;
-
- typedef png_write_support< typename channel_type < pixel_t >::type
- , typename color_space_type< pixel_t >::type
- > png_rw_info;
-
- if( little_endian() )
- {
- if( png_rw_info::_bit_depth == 16 )
- {
- png_set_swap( _png_ptr );
- }
-
- if( png_rw_info::_bit_depth < 8 )
- {
- png_set_packswap( _png_ptr );
- }
- }
-
- row_buffer_helper_view< View > row_buffer( view.width()
- , false
- );
-
- for( int y = 0; y != view.height(); ++ y)
- {
- std::copy( view.row_begin( y )
- , view.row_end ( y )
- , row_buffer.begin()
- );
-
- png_write_row( _png_ptr
- , reinterpret_cast< png_bytep >( row_buffer.data() )
- );
- }
-
- png_write_end( _png_ptr
- , _info_ptr
- );
- }
-
- template
- void write_view( const View& view
- , mpl::true_ // is bit aligned
- )
- {
- typedef png_write_support< typename kth_semantic_element_type< typename View::value_type
- , 0
- >::type
- , typename color_space_type::type
- > png_rw_info;
-
- if (little_endian() )
- {
- if( png_rw_info::_bit_depth == 16 )
- {
- png_set_swap( _png_ptr );
- }
-
- if( png_rw_info::_bit_depth < 8 )
- {
- png_set_packswap( _png_ptr );
- }
- }
-
- row_buffer_helper_view< View > row_buffer( view.width()
- , false
- );
-
- for( int y = 0; y != view.height(); ++y )
- {
- std::copy( view.row_begin( y )
- , view.row_end ( y )
- , row_buffer.begin()
- );
-
- png_write_row( _png_ptr
- , reinterpret_cast< png_bytep >( row_buffer.data() )
- );
- }
-
- png_free_data( _png_ptr
- , _info_ptr
- , PNG_FREE_UNKN
- , -1
- );
-
- png_write_end( _png_ptr
- , _info_ptr
- );
- }
-
- void init_io( png_structp png_ptr )
- {
- png_set_write_fn( png_ptr
- , static_cast< void* > ( &this->_io_dev )
- , static_cast< png_rw_ptr > ( &png_io_base::write_data )
- , static_cast< png_flush_ptr >( &png_io_base::flush )
- );
- }
-
- png_structp _png_ptr;
- png_infop _info_ptr;
-};
-
-struct png_write_is_supported
-{
- template< typename View >
- struct apply
- : public is_write_supported< typename get_pixel_type< View >::type
- , png_tag
- >
- {};
-};
-
-template< typename Device >
-class dynamic_image_writer< Device
- , png_tag
- >
- : public writer< Device
- , png_tag
- >
-{
- typedef writer< Device
- , png_tag
- > parent_t;
-
-public:
-
- dynamic_image_writer( Device& file )
- : parent_t( file )
- {}
-
- template< typename Views >
- void apply( const any_image_view< Views >& views )
- {
- dynamic_io_fnobj< png_write_is_supported
- , parent_t
- > op( this );
-
- apply_operation( views, op );
- }
-};
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_DETAIL_PNG_IO_WRITE_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/pnm/is_allowed.hpp b/third-party/boost/gil/extension/io_new/formats/pnm/is_allowed.hpp
deleted file mode 100644
index 42a9f171..00000000
--- a/third-party/boost/gil/extension/io_new/formats/pnm/is_allowed.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- Copyright 2009 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_PNM_IO_IS_ALLOWED_HPP
-#define BOOST_GIL_EXTENSION_IO_PNM_IO_IS_ALLOWED_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-namespace boost { namespace gil { namespace detail {
-
-template< typename View >
-bool is_allowed( const image_read_info< pnm_tag >& info
- , mpl::true_ // is read_and_no_convert
- )
-{
- pnm_image_type::type asc_type = is_read_supported< typename get_pixel_type< View >::type
- , pnm_tag
- >::_asc_type;
-
- pnm_image_type::type bin_type = is_read_supported< typename get_pixel_type< View >::type
- , pnm_tag
- >::_bin_type;
- if( info._type == pnm_image_type::mono_asc_t::value )
- {
- // ascii mono images are read gray8_image_t
- return ( asc_type == pnm_image_type::gray_asc_t::value );
- }
-
-
- return ( asc_type == info._type
- || bin_type == info._type
- );
-}
-
-template< typename View >
-bool is_allowed( const image_read_info< pnm_tag >& /* info */
- , mpl::false_ // is read_and_convert
- )
-{
- return true;
-}
-
-} // namespace detail
-} // namespace gil
-} // namespace boost
-
-#endif // BOOST_GIL_EXTENSION_IO_PNM_IO_IS_ALLOWED_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/pnm/read.hpp b/third-party/boost/gil/extension/io_new/formats/pnm/read.hpp
deleted file mode 100644
index 044b8db5..00000000
--- a/third-party/boost/gil/extension/io_new/formats/pnm/read.hpp
+++ /dev/null
@@ -1,498 +0,0 @@
-/*
- Copyright 2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_PNM_IO_READ_HPP
-#define BOOST_GIL_EXTENSION_IO_PNM_IO_READ_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "is_allowed.hpp"
-
-namespace boost { namespace gil { namespace detail {
-
-template< typename View, typename T >
-struct calc_pitch {};
-
-template< typename View >
-struct calc_pitch< View, mpl::false_ >
-{
- static uint32_t do_it( uint32_t width ) { return width * num_channels< View >::value; }
-};
-
-template< typename View >
-struct calc_pitch< View, mpl::true_ >
-{
- static uint32_t do_it( uint32_t width ) { return ( width + 7 ) >> 3; }
-};
-
-
-template< typename Device
- , typename ConversionPolicy
- >
-class reader< Device
- , pnm_tag
- , ConversionPolicy
- >
- : public reader_base< pnm_tag
- , ConversionPolicy
- >
-{
-private:
-
- typedef typename ConversionPolicy::color_converter_type cc_t;
-
-public:
- reader( Device& device
- , const image_read_settings< pnm_tag >& settings
- )
- : reader_base< pnm_tag
- , ConversionPolicy >( settings )
- , _io_dev( device )
- {}
-
- reader( Device& device
- , const cc_t& cc
- , const image_read_settings< pnm_tag >& settings
- )
- : reader_base< pnm_tag
- , ConversionPolicy >( cc
- , settings
- )
- , _io_dev( device )
- {}
-
- image_read_info get_info()
- {
- image_read_info ret;
-
- // read signature
- io_error_if( read_char() != 'P', "Invalid PNM signature" );
-
- ret._type = read_char() - '0';
-
- io_error_if( ret._type < pnm_image_type::mono_asc_t::value || ret._type > pnm_image_type::color_bin_t::value
- , "Invalid PNM file (supports P1 to P6)"
- );
-
- ret._width = read_int();
- ret._height = read_int();
-
- if( ret._type == pnm_image_type::mono_asc_t::value || ret._type == pnm_image_type::mono_bin_t::value )
- {
- ret._max_value = 1;
- }
- else
- {
- ret._max_value = read_int();
-
- io_error_if( ret._max_value > 255
- , "Unsupported PNM format (supports maximum value 255)"
- );
- }
-
- return ret;
- }
-
- template
- void apply( const View& view )
- {
-
- typedef typename is_same< ConversionPolicy
- , read_and_no_convert
- >::type is_read_and_convert_t;
-
- io_error_if( !is_allowed< View >( this->_info
- , is_read_and_convert_t()
- )
- , "Image types aren't compatible."
- );
-
- switch( this->_info._type )
- {
- // reading mono text is reading grayscale but with only two values
- case pnm_image_type::mono_asc_t::value: { read_text_data< gray8_view_t >( view ); break; }
- case pnm_image_type::gray_asc_t::value: { read_text_data< gray8_view_t >( view ); break; }
- case pnm_image_type::color_asc_t::value: { read_text_data< rgb8_view_t >( view ); break; }
-
- case pnm_image_type::mono_bin_t::value: { read_bin_data< gray1_image_t::view_t >( view ); break; }
- case pnm_image_type::gray_bin_t::value: { read_bin_data< gray8_view_t >( view ); break; }
- case pnm_image_type::color_bin_t::value: { read_bin_data< rgb8_view_t >( view ); break; }
- }
- }
-
-private:
-
- template< typename View_Src
- , typename View_Dst
- >
- void read_text_data( const View_Dst& dst )
- {
- typedef typename View_Dst::y_coord_t y_t;
-
- uint32_t pitch = this->_info._width * num_channels< View_Src >::value;
-
- byte_vector_t row( pitch );
-
- //Skip scanlines if necessary.
- for( int y = 0; y < this->_settings._top_left.y; ++y )
- {
- read_text_row< View_Src >( dst, row, pitch, y, false );
- }
-
- for( y_t y = 0; y < dst.height(); ++y )
- {
- read_text_row< View_Src >( dst, row, pitch, y, true );
- }
- }
-
- template< typename View_Src
- , typename View_Dst
- >
- void read_text_row( const View_Dst& dst
- , byte_vector_t& row
- , uint32_t pitch
- , typename View_Dst::y_coord_t y
- , bool process
- )
- {
- static char buf[16];
-
- View_Src src = interleaved_view( this->_info._width
- , 1
- , (typename View_Src::value_type*) &row.front()
- , pitch
- );
-
- for( uint32_t x = 0; x < pitch; ++x )
- {
- for( uint32_t k = 0; ; )
- {
- int ch = _io_dev.getc_unchecked();
-
- if( isdigit( ch ))
- {
- buf[ k++ ] = static_cast< char >( ch );
- }
- else if( k )
- {
- buf[ k ] = 0;
- break;
- }
- else if( ch == EOF || !isspace( ch ))
- {
- return;
- }
- }
-
- if( process )
- {
- int value = atoi( buf );
-
- if( this->_info._max_value == 1 )
- {
- typedef typename channel_type< typename get_pixel_type< View_Dst >::type >::type channel_t;
-
- // for pnm format 0 is white
- row[x] = ( value != 0 )
- ? typename channel_traits< channel_t >::value_type( 0 )
- : channel_traits< channel_t >::max_value();
- }
- else
- {
- row[x] = static_cast< byte_t >( value );
- }
- }
- }
-
- if( process )
- {
- // We are reading a gray1_image like a gray8_image but the two pixel_t
- // aren't compatible. Though, read_and_no_convert::read(...) wont work.
- copy_data< View_Dst
- , View_Src >( dst
- , src
- , y
- , typename is_same< View_Dst
- , gray1_image_t::view_t
- >::type()
- );
- }
- }
-
- template< typename View_Dst
- , typename View_Src
- >
- void copy_data( const View_Dst& dst
- , const View_Src& src
- , typename View_Dst::y_coord_t y
- , mpl::true_ // is gray1_view
- )
- {
- if( this->_info._max_value == 1 )
- {
- typename View_Dst::x_iterator it = dst.row_begin( y );
-
- for( typename View_Dst::x_coord_t x = 0
- ; x < dst.width()
- ; ++x
- )
- {
- it[x] = src[x];
- }
- }
- else
- {
- copy_data( dst
- , src
- , y
- , mpl::false_()
- );
- }
- }
-
- template< typename View_Dst
- , typename View_Src
- >
- void copy_data( const View_Dst& view
- , const View_Src& src
- , typename View_Dst::y_coord_t y
- , mpl::false_ // is gray1_view
- )
- {
- typename View_Src::x_iterator beg = src.row_begin( 0 ) + this->_settings._top_left.x;
- typename View_Src::x_iterator end = beg + this->_settings._dim.x;
-
- this->_cc_policy.read( beg
- , end
- , view.row_begin( y )
- );
- }
-
-
- template< typename View_Src
- , typename View_Dst
- >
- void read_bin_data( const View_Dst& view )
- {
- typedef typename View_Dst::y_coord_t y_t;
- typedef typename is_bit_aligned<
- typename View_Src::value_type >::type is_bit_aligned_t;
-
- uint32_t pitch = calc_pitch< View_Src, is_bit_aligned_t >::do_it( this->_info._width );
-
- typedef row_buffer_helper_view< View_Src > rh_t;
- rh_t rh( pitch, true );
-
- typename rh_t::iterator_t beg = rh.begin() + this->_settings._top_left.x;
- typename rh_t::iterator_t end = beg + this->_settings._dim.x;
-
- // For bit_aligned images we need to negate all bytes in the row_buffer
- // to make sure that 0 is black and 255 is white.
- negate_bits< typename rh_t::buffer_t
- , is_bit_aligned_t
- > neg;
-
- swap_half_bytes< typename rh_t::buffer_t
- , is_bit_aligned_t
- > swhb;
-
- //Skip scanlines if necessary.
- for( y_t y = 0; y < this->_settings._top_left.y; ++y )
- {
- _io_dev.read( reinterpret_cast< byte_t* >( rh.data() )
- , pitch
- );
- }
-
- for( y_t y = 0; y < view.height(); ++y )
- {
- _io_dev.read( reinterpret_cast< byte_t* >( rh.data() )
- , pitch
- );
-
- neg( rh.buffer() );
- swhb( rh.buffer() );
-
- this->_cc_policy.read( beg
- , end
- , view.row_begin( y )
- );
- }
- }
-
-private:
-
- // Read a character and skip a comment if necessary.
- char read_char()
- {
- char ch;
-
- if(( ch = _io_dev.getc() ) == '#' )
- {
- // skip comment to EOL
- do
- {
- ch = _io_dev.getc();
- }
- while (ch != '\n' && ch != '\r');
- }
-
- return ch;
- }
-
- unsigned int read_int()
- {
- char ch;
-
- // skip whitespaces, tabs, and new lines
- do
- {
- ch = read_char();
- }
- while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');
-
- if( ch < '0' || ch > '9' )
- {
- io_error( "Unexpected characters reading decimal digits" );
- }
-
- unsigned val = 0;
-
- do
- {
- unsigned dig = ch - '0';
-
- if( val > INT_MAX / 10 - dig )
- {
- io_error( "Integer too large" );
- }
-
- val = val * 10 + dig;
-
- ch = read_char();
- }
- while( '0' <= ch && ch <= '9' );
-
- return val;
- }
-
-private:
-
- Device& _io_dev;
-};
-
-struct pnm_type_format_checker
-{
- pnm_type_format_checker( pnm_image_type::type type )
- : _type( type )
- {}
-
- template< typename Image >
- bool apply()
- {
- typedef is_read_supported< typename get_pixel_type< typename Image::view_t >::type
- , pnm_tag
- > is_supported_t;
-
- return is_supported_t::_asc_type == _type
- || is_supported_t::_bin_type == _type;
- }
-
-private:
-
- pnm_image_type::type _type;
-};
-
-struct pnm_read_is_supported
-{
- template< typename View >
- struct apply : public is_read_supported< typename get_pixel_type< View >::type
- , pnm_tag
- >
- {};
-};
-
-template< typename Device
- >
-class dynamic_image_reader< Device
- , pnm_tag
- >
- : public reader< Device
- , pnm_tag
- , detail::read_and_no_convert
- >
-{
- typedef reader< Device
- , pnm_tag
- , detail::read_and_no_convert
- > parent_t;
-
-public:
-
- dynamic_image_reader( Device& device
- , const image_read_settings< pnm_tag >& settings
- )
- : parent_t( device
- , settings
- )
- {}
-
- template< typename Images >
- void apply( any_image< Images >& images )
- {
- pnm_type_format_checker format_checker( this->_info._type );
-
- if( !construct_matched( images
- , format_checker
- ))
- {
- io_error( "No matching image type between those of the given any_image and that of the file" );
- }
- else
- {
- init_image( images
- , this->_info
- );
-
- dynamic_io_fnobj< pnm_read_is_supported
- , parent_t
- > op( this );
-
- apply_operation( view( images )
- , op
- );
- }
- }
-};
-
-} // detail
-} // gil
-} // boost
-
-#endif // BOOST_GIL_EXTENSION_IO_PNM_IO_READ_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/pnm/supported_types.hpp b/third-party/boost/gil/extension/io_new/formats/pnm/supported_types.hpp
deleted file mode 100644
index d7915946..00000000
--- a/third-party/boost/gil/extension/io_new/formats/pnm/supported_types.hpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- Copyright 2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_PNM_SUPPORTED_TYPES_HPP
-#define BOOST_GIL_EXTENSION_IO_PNM_SUPPORTED_TYPES_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-#include
-
-#include
-#include
-
-namespace boost { namespace gil { namespace detail {
-
-// Read Support
-
-template< pnm_image_type::type ASCII_Type
- , pnm_image_type::type Binary_Type
- >
-struct pnm_rw_support_base
-{
- static const pnm_image_type::type _asc_type = ASCII_Type;
- static const pnm_image_type::type _bin_type = Binary_Type;
-};
-
-template< typename Channel
- , typename ColorSpace
- >
-struct pnm_read_support : read_support_false
- , pnm_rw_support_base< 0
- , 0
- > {};
-
-template< typename BitField, bool Mutable >
-struct pnm_read_support< packed_dynamic_channel_reference< BitField
- , 1
- , Mutable
- >
- , gray_t
- > : read_support_true
- , pnm_rw_support_base< pnm_image_type::mono_asc_t::value
- , pnm_image_type::mono_bin_t::value
- > {};
-
-template<>
-struct pnm_read_support< bits8
- , gray_t
- > : read_support_true
- , pnm_rw_support_base< pnm_image_type::gray_asc_t::value
- , pnm_image_type::gray_bin_t::value
- > {};
-
-
-template<>
-struct pnm_read_support< bits8
- , rgb_t
- > : read_support_true
- , pnm_rw_support_base< pnm_image_type::color_asc_t::value
- , pnm_image_type::color_bin_t::value
- > {};
-
-// Write support
-
-template< typename Channel
- , typename ColorSpace
- >
-struct pnm_write_support : write_support_false
-{};
-
-template< typename BitField, bool Mutable >
-struct pnm_write_support< packed_dynamic_channel_reference< BitField
- , 1
- , Mutable
- >
- , gray_t
- > : write_support_true
- , pnm_rw_support_base< pnm_image_type::mono_asc_t::value
- , pnm_image_type::mono_bin_t::value
- > {};
-
-
-template<>
-struct pnm_write_support< bits8
- , gray_t
- > : write_support_true
- , pnm_rw_support_base< pnm_image_type::gray_asc_t::value
- , pnm_image_type::gray_bin_t::value
- > {};
-
-
-template<>
-struct pnm_write_support< bits8
- , rgb_t
- > : write_support_true
- , pnm_rw_support_base< pnm_image_type::color_asc_t::value
- , pnm_image_type::color_bin_t::value
- > {};
-
-} // namespace detail
-
-template< typename Pixel >
-struct is_read_supported< Pixel
- , pnm_tag
- >
- : mpl::bool_< detail::pnm_read_support< typename channel_type < Pixel >::type
- , typename color_space_type< Pixel >::type
- >::is_supported
- >
-{
- typedef detail::pnm_read_support< typename channel_type < Pixel >::type
- , typename color_space_type< Pixel >::type
- > parent_t;
-
- static const pnm_image_type::type _asc_type = parent_t::_asc_type;
- static const pnm_image_type::type _bin_type = parent_t::_bin_type;
-};
-
-template< typename Pixel >
-struct is_write_supported< Pixel
- , pnm_tag
- >
- : mpl::bool_< detail::pnm_write_support< typename channel_type < Pixel >::type
- , typename color_space_type< Pixel >::type
- >::is_supported
- > {};
-
-} // namespace gil
-} // namespace boost
-
-
-#endif // BOOST_GIL_EXTENSION_IO_PNM_SUPPORTED_TYPES_HPP
diff --git a/third-party/boost/gil/extension/io_new/formats/pnm/write.hpp b/third-party/boost/gil/extension/io_new/formats/pnm/write.hpp
deleted file mode 100644
index 2e997a67..00000000
--- a/third-party/boost/gil/extension/io_new/formats/pnm/write.hpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- Copyright 2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
-#ifndef BOOST_GIL_EXTENSION_IO_PNM_IO_WRITE_HPP
-#define BOOST_GIL_EXTENSION_IO_PNM_IO_WRITE_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief
-/// \author Christian Henning \n
-///
-/// \date 2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include
-
-#include
-
-#include