Blob Blame Raw
From 004aa183846ebe77a0d2924d92d6b2a59d881ca6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu@fedoraproject.org>
Date: Tue, 19 Feb 2019 19:00:35 +0100
Subject: [PATCH 106/106] Reintroduce boost < 1.69.0 compatibility

---
 k3dsdk/bitmap.h                     | 2 ++
 modules/jpeg_io/bitmap_importer.cpp | 9 +++++++++
 modules/jpeg_io/bitmap_reader.cpp   | 9 +++++++++
 modules/jpeg_io/bitmap_writer.cpp   | 9 +++++++++
 modules/png_io/bitmap_importer.cpp  | 9 +++++++++
 modules/png_io/bitmap_reader.cpp    | 9 +++++++++
 modules/png_io/bitmap_writer.cpp    | 9 +++++++++
 modules/tiff_io/bitmap_exporter.cpp | 9 +++++++++
 modules/tiff_io/bitmap_importer.cpp | 9 +++++++++
 modules/tiff_io/bitmap_reader.cpp   | 9 +++++++++
 modules/tiff_io/bitmap_writer.cpp   | 9 +++++++++
 11 files changed, 92 insertions(+)

diff --git a/k3dsdk/bitmap.h b/k3dsdk/bitmap.h
index d9b5c58e..61d89945 100644
--- a/k3dsdk/bitmap.h
+++ b/k3dsdk/bitmap.h
@@ -46,8 +46,10 @@ namespace boost
 namespace gil
 {
 
+#if BOOST_VERSION >= 106900
 typedef boost::uint8_t  bits8;
 typedef float32_t bits32f;
+#endif
 
 template<>
 struct channel_traits<half>
diff --git a/modules/jpeg_io/bitmap_importer.cpp b/modules/jpeg_io/bitmap_importer.cpp
index 7d881c12..dade91dc 100644
--- a/modules/jpeg_io/bitmap_importer.cpp
+++ b/modules/jpeg_io/bitmap_importer.cpp
@@ -27,8 +27,13 @@
 #include <k3dsdk/path.h>
 #include <k3dsdk/string_modifiers.h>
 
+#include <boost/version.hpp>
 #include <boost/assign/list_of.hpp>
+#if BOOST_VERSION < 106900
+#include <boost/gil/extension/io/jpeg_io.hpp>
+#else
 #include <boost/gil/extension/io/jpeg.hpp>
+#endif
 
 namespace module
 {
@@ -55,7 +60,11 @@ public:
 		try
 		{
 			k3d::log() << info << "Reading " << Path.native_console_string() << " using " << get_factory().name() << std::endl;
+#if BOOST_VERSION < 106900
+			boost::gil::jpeg_read_and_convert_image(Path.native_filesystem_string(), Bitmap);
+#else
 			boost::gil::read_and_convert_image(Path.native_filesystem_string(), Bitmap, boost::gil::jpeg_tag());
+#endif
 			return true;
 		}
 		catch(std::exception& e)
diff --git a/modules/jpeg_io/bitmap_reader.cpp b/modules/jpeg_io/bitmap_reader.cpp
index 795dd3b2..cd07d88c 100644
--- a/modules/jpeg_io/bitmap_reader.cpp
+++ b/modules/jpeg_io/bitmap_reader.cpp
@@ -28,7 +28,12 @@
 #include <k3dsdk/options.h>
 #include <k3dsdk/path.h>
 
+#include <boost/version.hpp>
+#if BOOST_VERSION < 106900
+#include <boost/gil/extension/io/jpeg_io.hpp>
+#else
 #include <boost/gil/extension/io/jpeg.hpp>
+#endif
 
 namespace module
 {
@@ -66,7 +71,11 @@ public:
 		try
 		{
 			k3d::log() << info << "Reading " << file.native_console_string() << " using " << get_factory().name() << std::endl;
+#if BOOST_VERSION < 106900
+			boost::gil::jpeg_read_and_convert_image(file.native_filesystem_string(), Output);
+#else
 			boost::gil::read_and_convert_image(file.native_filesystem_string(), Output, boost::gil::jpeg_tag());
+#endif
 		}
 		catch(std::exception& e)
 		{
diff --git a/modules/jpeg_io/bitmap_writer.cpp b/modules/jpeg_io/bitmap_writer.cpp
index 6720b659..8169010f 100644
--- a/modules/jpeg_io/bitmap_writer.cpp
+++ b/modules/jpeg_io/bitmap_writer.cpp
@@ -26,7 +26,12 @@
 #include <k3dsdk/document_plugin_factory.h>
 #include <k3dsdk/node.h>
 
+#include <boost/version.hpp>
+#if BOOST_VERSION < 106900
+#include <boost/gil/extension/io/jpeg_io.hpp>
+#else
 #include <boost/gil/extension/io/jpeg.hpp>
+#endif
 
 namespace module
 {
@@ -78,7 +83,11 @@ public:
 		try
 		{
 			k3d::log() << info << "Writing " << file.native_console_string() << " using " << get_factory().name() << std::endl;
+#if BOOST_VERSION < 106900
+			boost::gil::jpeg_write_view(file.native_filesystem_string(), boost::gil::color_converted_view<boost::gil::rgb8_pixel_t>(view(*bitmap), extract_rgb()));
+#else
 			boost::gil::write_view(file.native_filesystem_string(), boost::gil::color_converted_view<boost::gil::rgb8_pixel_t>(view(*bitmap), extract_rgb()), boost::gil::jpeg_tag());
+#endif
 		}
 		catch(std::exception& e)
 		{
diff --git a/modules/png_io/bitmap_importer.cpp b/modules/png_io/bitmap_importer.cpp
index 617f82c2..66d2c185 100644
--- a/modules/png_io/bitmap_importer.cpp
+++ b/modules/png_io/bitmap_importer.cpp
@@ -29,8 +29,13 @@
 #define png_infopp_NULL (png_infopp)NULL
 #define int_p_NULL (int*)NULL
 
+#include <boost/version.hpp>
 #include <boost/assign/list_of.hpp>
+#if BOOST_VERSION < 106900
+#include <boost/gil/extension/io/png_io.hpp>
+#else
 #include <boost/gil/extension/io/png.hpp>
+#endif
 
 namespace module
 {
@@ -57,7 +62,11 @@ public:
 		try
 		{
 			k3d::log() << info << "Reading " << File.native_console_string() << " using " << get_factory().name() << std::endl;
+#if BOOST_VERSION < 106900
+			boost::gil::png_read_and_convert_image(File.native_filesystem_string(), Bitmap);
+#else
 			boost::gil::read_and_convert_image(File.native_filesystem_string(), Bitmap, boost::gil::png_tag());
+#endif
 			return true;
 		}
 		catch(std::exception& e)
diff --git a/modules/png_io/bitmap_reader.cpp b/modules/png_io/bitmap_reader.cpp
index 297b282c..df7ee346 100644
--- a/modules/png_io/bitmap_reader.cpp
+++ b/modules/png_io/bitmap_reader.cpp
@@ -31,7 +31,12 @@
 #define png_infopp_NULL (png_infopp)NULL
 #define int_p_NULL (int*)NULL
 
+#include <boost/version.hpp>
+#if BOOST_VERSION < 106900
+#include <boost/gil/extension/io/png_io.hpp>
+#else
 #include <boost/gil/extension/io/png.hpp>
+#endif
 
 namespace module
 {
@@ -69,7 +74,11 @@ public:
 		try
 		{
 			k3d::log() << info << "Reading " << file.native_console_string() << " using " << get_factory().name() << std::endl;
+#if BOOST_VERSION < 106900
+			boost::gil::png_read_and_convert_image(file.native_filesystem_string(), Output);
+#else
 			boost::gil::read_and_convert_image(file.native_filesystem_string(), Output, boost::gil::png_tag());
+#endif
 		}
 		catch(std::exception& e)
 		{
diff --git a/modules/png_io/bitmap_writer.cpp b/modules/png_io/bitmap_writer.cpp
index dce0287c..a8d1ee2e 100644
--- a/modules/png_io/bitmap_writer.cpp
+++ b/modules/png_io/bitmap_writer.cpp
@@ -29,7 +29,12 @@
 #define png_infopp_NULL (png_infopp)NULL
 #define int_p_NULL (int*)NULL
 
+#include <boost/version.hpp>
+#if BOOST_VERSION < 106900
+#include <boost/gil/extension/io/png_io.hpp>
+#else
 #include <boost/gil/extension/io/png.hpp>
+#endif
 
 namespace module
 {
@@ -76,7 +81,11 @@ public:
 				throw std::runtime_error("bitmap with zero height");
 
 			k3d::log() << info << "Writing " << file.native_console_string() << " using " << get_factory().name() << std::endl;
+#if BOOST_VERSION < 106900
+			boost::gil::png_write_view(file.native_filesystem_string(), boost::gil::color_converted_view<boost::gil::rgba8_pixel_t>(view(*bitmap)));
+#else
 			boost::gil::write_view(file.native_filesystem_string(), boost::gil::color_converted_view<boost::gil::rgba8_pixel_t>(view(*bitmap)), boost::gil::png_tag());
+#endif
 		}
 		catch(std::exception& e)
 		{
diff --git a/modules/tiff_io/bitmap_exporter.cpp b/modules/tiff_io/bitmap_exporter.cpp
index 83e2dd76..778cdf21 100644
--- a/modules/tiff_io/bitmap_exporter.cpp
+++ b/modules/tiff_io/bitmap_exporter.cpp
@@ -28,7 +28,12 @@
 #include <k3dsdk/path.h>
 #include <k3dsdk/string_modifiers.h>
 
+#include <boost/version.hpp>
+#if BOOST_VERSION < 106900
+#include <boost/gil/extension/io/tiff_io.hpp>
+#else
 #include <boost/gil/extension/io/tiff.hpp>
+#endif
 
 namespace module
 {
@@ -55,7 +60,11 @@ public:
 		try
 		{
 			k3d::log() << info << "Writing " << Path.native_console_string() << " using " << get_factory().name() << std::endl;
+#if BOOST_VERSION < 106900
+			boost::gil::tiff_write_view(Path.native_filesystem_string(), boost::gil::color_converted_view<boost::gil::rgb8_pixel_t>(const_view(Bitmap)));
+#else
 			boost::gil::write_view(Path.native_filesystem_string(), boost::gil::color_converted_view<boost::gil::rgb8_pixel_t>(const_view(Bitmap)), boost::gil::tiff_tag());
+#endif
 			return true;
 		}
 		catch(std::exception& e)
diff --git a/modules/tiff_io/bitmap_importer.cpp b/modules/tiff_io/bitmap_importer.cpp
index a5d32195..55a6ff3d 100644
--- a/modules/tiff_io/bitmap_importer.cpp
+++ b/modules/tiff_io/bitmap_importer.cpp
@@ -27,8 +27,13 @@
 #include <k3dsdk/path.h>
 #include <k3dsdk/string_modifiers.h>
 
+#include <boost/version.hpp>
 #include <boost/assign/list_of.hpp>
+#if BOOST_VERSION < 106900
+#include <boost/gil/extension/io/tiff_io.hpp>
+#else
 #include <boost/gil/extension/io/tiff.hpp>
+#endif
 
 namespace module
 {
@@ -55,7 +60,11 @@ public:
 		try
 		{
 			k3d::log() << info << "Reading " << Path.native_console_string() << " using " << get_factory().name() << std::endl;
+#if BOOST_VERSION < 106900
+			boost::gil::tiff_read_and_convert_image(Path.native_filesystem_string(), Bitmap);
+#else
 			boost::gil::read_and_convert_image(Path.native_filesystem_string(), Bitmap, boost::gil::tiff_tag());
+#endif
 			return true;
 		}
 		catch(std::exception& e)
diff --git a/modules/tiff_io/bitmap_reader.cpp b/modules/tiff_io/bitmap_reader.cpp
index 373c7de4..ad9d0c6c 100644
--- a/modules/tiff_io/bitmap_reader.cpp
+++ b/modules/tiff_io/bitmap_reader.cpp
@@ -28,7 +28,12 @@
 #include <k3dsdk/options.h>
 #include <k3dsdk/path.h>
 
+#include <boost/version.hpp>
+#if BOOST_VERSION < 106900
+#include <boost/gil/extension/io/tiff_io.hpp>
+#else
 #include <boost/gil/extension/io/tiff.hpp>
+#endif
 
 namespace module
 {
@@ -66,7 +71,11 @@ public:
 		try
 		{
 			k3d::log() << info << "Reading " << file.native_console_string() << " using " << get_factory().name() << std::endl;
+#if BOOST_VERSION < 106900
+			boost::gil::tiff_read_and_convert_image(file.native_filesystem_string(), Output);
+#else
 			boost::gil::read_and_convert_image(file.native_filesystem_string(), Output, boost::gil::tiff_tag());
+#endif
 		}
 		catch(std::exception& e)
 		{
diff --git a/modules/tiff_io/bitmap_writer.cpp b/modules/tiff_io/bitmap_writer.cpp
index d58aafd2..69fcfa36 100644
--- a/modules/tiff_io/bitmap_writer.cpp
+++ b/modules/tiff_io/bitmap_writer.cpp
@@ -26,7 +26,12 @@
 #include <k3dsdk/document_plugin_factory.h>
 #include <k3dsdk/node.h>
 
+#include <boost/version.hpp>
+#if BOOST_VERSION < 106900
+#include <boost/gil/extension/io/tiff_io.hpp>
+#else
 #include <boost/gil/extension/io/tiff.hpp>
+#endif
 
 namespace module
 {
@@ -78,7 +83,11 @@ public:
 		try
 		{
 			k3d::log() << info << "Writing " << file.native_console_string() << " using " << get_factory().name() << std::endl;
+#if BOOST_VERSION < 106900
+			boost::gil::tiff_write_view(file.native_filesystem_string(), boost::gil::color_converted_view<boost::gil::rgb8_pixel_t>(view(*bitmap), extract_rgb()));
+#else
 			boost::gil::write_view(file.native_filesystem_string(), boost::gil::color_converted_view<boost::gil::rgb8_pixel_t>(view(*bitmap), extract_rgb()), boost::gil::tiff_tag());
+#endif
 		}
 		catch(std::exception& e)
 		{
-- 
2.20.1