Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into remove-copy-n
Browse files Browse the repository at this point in the history
  • Loading branch information
mloskot committed Jun 25, 2022
2 parents 0ce4215 + 151fd9c commit 46497d0
Show file tree
Hide file tree
Showing 18 changed files with 273 additions and 105 deletions.
5 changes: 3 additions & 2 deletions include/boost/gil/extension/image_processing/diffusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef BOOST_GIL_IMAGE_PROCESSING_DIFFUSION_HPP
#define BOOST_GIL_IMAGE_PROCESSING_DIFFUSION_HPP
#ifndef BOOST_GIL_EXTENSION_IMAGE_PROCESSING_DIFFUSION_HPP
#define BOOST_GIL_EXTENSION_IMAGE_PROCESSING_DIFFUSION_HPP

#include <boost/gil/detail/math.hpp>
#include <boost/gil/algorithm.hpp>
Expand All @@ -19,6 +19,7 @@
#include <boost/gil/pixel.hpp>
#include <boost/gil/point.hpp>
#include <boost/gil/typedefs.hpp>

#include <functional>
#include <numeric>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_GIL_IMAGE_PROCESSING_HOUGH_PARAMETER_HPP
#define BOOST_GIL_IMAGE_PROCESSING_HOUGH_PARAMETER_HPP
#ifndef BOOST_GIL_EXTENSION_IMAGE_PROCESSING_HOUGH_PARAMETER_HPP
#define BOOST_GIL_EXTENSION_IMAGE_PROCESSING_HOUGH_PARAMETER_HPP

#include "boost/gil/point.hpp"

#include <cmath>
#include <cstddef>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_GIL_IMAGE_PROCESSING_HOUGH_TRANSFORM_HPP
#define BOOST_GIL_IMAGE_PROCESSING_HOUGH_TRANSFORM_HPP
#ifndef BOOST_GIL_EXTENSION_IMAGE_PROCESSING_HOUGH_TRANSFORM_HPP
#define BOOST_GIL_EXTENSION_IMAGE_PROCESSING_HOUGH_TRANSFORM_HPP

#include <algorithm>
#include <boost/gil/extension/image_processing/hough_parameter.hpp>
#include <boost/gil/extension/rasterization/circle.hpp>

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <iterator>
Expand Down
37 changes: 19 additions & 18 deletions include/boost/gil/extension/io/tiff/detail/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <boost/gil/io/device.hpp>

#include <algorithm>
#include <cstdint>
#include <memory>
#include <sstream>
#include <type_traits>
Expand Down Expand Up @@ -192,7 +193,7 @@ class tiff_device_base
{
io_error_if( TIFFReadScanline( _tiff_file.get()
, reinterpret_cast< tdata_t >( &buffer.front() )
, (uint32) row
, static_cast<std::uint32_t>( row )
, plane ) == -1
, "Read error."
);
Expand All @@ -205,7 +206,7 @@ class tiff_device_base
{
io_error_if( TIFFReadScanline( _tiff_file.get()
, reinterpret_cast< tdata_t >( buffer )
, (uint32) row
, static_cast<std::uint32_t>( row )
, plane ) == -1
, "Read error."
);
Expand All @@ -221,9 +222,9 @@ class tiff_device_base
{
if( TIFFReadTile( _tiff_file.get()
, reinterpret_cast< tdata_t >( &buffer.front() )
, (uint32) x
, (uint32) y
, (uint32) z
, static_cast< std::uint32_t >( x )
, static_cast< std::uint32_t >( y )
, static_cast< std::uint32_t >( z )
, plane
) == -1 )
{
Expand All @@ -234,9 +235,9 @@ class tiff_device_base
}

template< typename Buffer >
void write_scaline( Buffer& buffer
, uint32 row
, tsample_t plane
void write_scaline( Buffer& buffer
, std::uint32_t row
, tsample_t plane
)
{
io_error_if( TIFFWriteScanline( _tiff_file.get()
Expand All @@ -248,9 +249,9 @@ class tiff_device_base
);
}

void write_scaline( byte_t* buffer
, uint32 row
, tsample_t plane
void write_scaline( byte_t* buffer
, std::uint32_t row
, tsample_t plane
)
{
io_error_if( TIFFWriteScanline( _tiff_file.get()
Expand All @@ -263,11 +264,11 @@ class tiff_device_base
}

template< typename Buffer >
void write_tile( Buffer& buffer
, uint32 x
, uint32 y
, uint32 z
, tsample_t plane
void write_tile( Buffer& buffer
, std::uint32_t x
, std::uint32_t y
, std::uint32_t z
, tsample_t plane
)
{
if( TIFFWriteTile( _tiff_file.get()
Expand Down Expand Up @@ -300,8 +301,8 @@ class tiff_device_base
)
{
bool result = true;
uint32 tw = static_cast< uint32 >( width );
uint32 th = static_cast< uint32 >( height );
std::uint32_t tw = static_cast< std::uint32_t >( width );
std::uint32_t th = static_cast< std::uint32_t >( height );

TIFFDefaultTileSize( _tiff_file.get()
, &tw
Expand Down
11 changes: 6 additions & 5 deletions include/boost/gil/extension/io/tiff/detail/write.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <boost/gil/io/detail/dynamic.hpp>

#include <algorithm>
#include <cstdint>
#include <string>
#include <type_traits>
#include <vector>
Expand Down Expand Up @@ -183,7 +184,7 @@ class writer< Device


this->_io_dev.write_scaline( row
, (uint32) y
, static_cast<std::uint32_t>( y )
, 0
);

Expand Down Expand Up @@ -211,7 +212,7 @@ class writer< Device


this->_io_dev.write_scaline( row
, (uint32) y
, static_cast<std::uint32_t>( y )
, 0
);

Expand Down Expand Up @@ -273,7 +274,7 @@ class writer< Device
);

this->_io_dev.write_scaline( row_addr
, (uint32) y
, static_cast<std::uint32_t>( y )
, 0
);

Expand Down Expand Up @@ -393,8 +394,8 @@ class writer< Device
}

this->_io_dev.write_tile( row
, static_cast< uint32 >( j )
, static_cast< uint32 >( i )
, static_cast< std::uint32_t >( j )
, static_cast< std::uint32_t >( i )
, 0
, 0
);
Expand Down
9 changes: 6 additions & 3 deletions include/boost/gil/extension/rasterization/circle.hpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
// Boost.GIL (Generic Image Library) - tests
//
// Copyright 2020 Olzhas Zhumabek <anonymous.from.applecity@gmail.com>
//
// 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_RASTERIZATION_CIRCLE_HPP
#define BOOST_GIL_RASTERIZATION_CIRCLE_HPP
#ifndef BOOST_GIL_EXTENSION_RASTERIZATION_CIRCLE_HPP
#define BOOST_GIL_EXTENSION_RASTERIZATION_CIRCLE_HPP

#include <boost/gil/detail/math.hpp>
#include <boost/gil/point.hpp>

#include <cmath>
#include <cstddef>

namespace boost { namespace gil {

/// \defgroup CircleRasterization
/// \ingroup Rasterization
/// \brief Circle rasterization algorithms
Expand Down Expand Up @@ -122,5 +123,7 @@ struct midpoint_circle_rasterizer
}
}
};

}} // namespace boost::gil

#endif
8 changes: 5 additions & 3 deletions include/boost/gil/extension/rasterization/ellipse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_GIL_RASTERIZATION_ELLIPSE_HPP
#define BOOST_GIL_RASTERIZATION_ELLIPSE_HPP
#ifndef BOOST_GIL_EXTENSION_RASTERIZATION_ELLIPSE_HPP
#define BOOST_GIL_EXTENSION_RASTERIZATION_ELLIPSE_HPP

#include <array>
#include <vector>
Expand Down Expand Up @@ -187,6 +187,8 @@ struct midpoint_elliptical_rasterizer
obtain_trajectory(semi_axes);
draw_curve(view, colour, center, trajectory_points);
}
}; // midpoint elliptical rasterizer
};

}} // namespace boost::gil

#endif
12 changes: 7 additions & 5 deletions include/boost/gil/extension/rasterization/line.hpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// Boost.GIL (Generic Image Library) - tests
//
// Copyright 2020 Olzhas Zhumabek <anonymous.from.applecity@gmail.com>
//
// 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_RASTERIZATION_LINE_HPP
#define BOOST_GIL_EXTENSION_RASTERIZATION_LINE_HPP

#include <boost/gil/point.hpp>

#include <cmath>
#include <cstddef>

namespace boost
{
namespace gil
{
namespace boost { namespace gil {

/// \defgroup Rasterization
/// \brief A set of functions to rasterize shapes
///
Expand Down Expand Up @@ -95,3 +95,5 @@ struct bresenham_line_rasterizer
};

}} // namespace boost::gil

#endif
9 changes: 4 additions & 5 deletions include/boost/gil/extension/toolbox/color_spaces/hsl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct default_color_converter_impl< rgb_t, hsl_t >
{

float32_t diff = max_color - min_color;
float32_t sum = max_color + min_color;

// lightness calculation

Expand All @@ -84,13 +85,11 @@ struct default_color_converter_impl< rgb_t, hsl_t >

if( lightness < 0.5f )
{
saturation = diff
/ ( min_color + max_color );
saturation = diff / ( sum );
}
else
{
saturation = ( max_color - min_color )
/ ( 2.f - diff );
saturation = diff / ( 2.f - sum );

}

Expand All @@ -115,7 +114,7 @@ struct default_color_converter_impl< rgb_t, hsl_t >
{
// max_color is blue
hue = 4.f
+ ( temp_red - temp_blue )
+ ( temp_red - temp_green )
/ diff;
}

Expand Down
1 change: 1 addition & 0 deletions include/boost/gil/histogram.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <boost/type_traits.hpp>
#include <boost/functional/hash.hpp>

#include <array>
#include <iostream>
#include <tuple>
#include <utility>
Expand Down
6 changes: 3 additions & 3 deletions include/boost/gil/io/detail/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@

#include <boost/config.hpp>

#if !defined(BOOST_GIL_IO_USE_BOOST_FILESYSTEM)
#if !defined(BOOST_NO_CXX17_HDR_FILESYSTEM) || defined(__cpp_lib_filesystem)
#if !defined(BOOST_GIL_IO_USE_BOOST_FILESYSTEM) && !defined(BOOST_NO_CXX17_HDR_FILESYSTEM)
#if defined(__cpp_lib_filesystem)
#include <filesystem>
#define BOOST_GIL_IO_USE_STD_FILESYSTEM
#elif defined(__cpp_lib_experimental_filesystem)
#include <experimental/filesystem>
#define BOOST_GIL_IO_USE_STD_FILESYSTEM
#define BOOST_GIL_IO_USE_STD_EXPERIMENTAL_FILESYSTEM
#endif
#endif // !BOOST_GIL_IO_USE_BOOST_FILESYSTEM
#endif // !BOOST_GIL_IO_USE_BOOST_FILESYSTEM && !BOOST_NO_CXX17_HDR_FILESYSTEM

#if !defined(BOOST_GIL_IO_USE_STD_FILESYSTEM)
// Disable warning: conversion to 'std::atomic<int>::__integral_type {aka int}' from 'long int' may alter its value
Expand Down
13 changes: 13 additions & 0 deletions test/extension/io/simple_all_formats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ void test_tiff()
gil::write_view(tiff_out + "simple_all_format.tif", gil::view(img), gil::tiff_tag());
}

void test_tiff_tiled()
{
gil::rgba8_image_t img;
gil::read_image(tiff_filename, img, gil::tiff_tag());

fs::create_directories(fs::path(tiff_out));
gil::image_write_info<gil::tiff_tag> info;
info._is_tiled = true;
info._tile_width = info._tile_length = 64; // must be multiples of 16
gil::write_view(tiff_out + "simple_all_format.tif", gil::view(img), info);
}

int main(int argc, char* argv[])
{
try
Expand All @@ -85,6 +97,7 @@ int main(int argc, char* argv[])
// TODO: test_raw()
test_targa();
test_tiff();
test_tiff_tiled();
}
catch (std::exception const& e)
{
Expand Down
Loading

0 comments on commit 46497d0

Please sign in to comment.