From 74ffdcb047558a990d484e39e9b96fa8fd54c29c Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Mon, 8 Jul 2024 10:40:31 +0200 Subject: [PATCH 01/42] chore: fix some typos (#751) --- CONTRIBUTING.md | 2 +- RELEASES.md | 2 +- doc/histogram/cumulative.rst | 2 +- example/affine.cpp | 2 +- example/anisotropic_diffusion.md | 2 +- example/hough_transform_circle.cpp | 2 +- example/hough_transform_circle.md | 2 +- example/morphology.cpp | 2 +- example/rasterizer_ellipse.md | 6 +++--- include/boost/gil/channel_algorithm.hpp | 2 +- .../boost/gil/channel_numeric_operations.hpp | 2 +- include/boost/gil/color_convert.hpp | 6 +++--- include/boost/gil/concepts/pixel_iterator.hpp | 2 +- .../extension/dynamic_image/dynamic_at_c.hpp | 2 +- include/boost/gil/extension/io/bmp/tags.hpp | 4 ++-- include/boost/gil/extension/io/png/tags.hpp | 2 +- .../gil/extension/io/pnm/detail/read.hpp | 2 +- include/boost/gil/extension/io/raw/tags.hpp | 4 ++-- include/boost/gil/extension/io/targa/tags.hpp | 2 +- .../extension/io/tiff/detail/is_allowed.hpp | 2 +- .../io/tiff/detail/writer_backend.hpp | 4 ++-- .../boost/gil/extension/numeric/sampler.hpp | 2 +- .../extension/toolbox/color_spaces/ycbcr.hpp | 4 ++-- .../boost/gil/image_processing/convolve.hpp | 20 +++++++++---------- .../histogram_equalization.hpp | 2 +- .../boost/gil/image_processing/numeric.hpp | 2 +- .../boost/gil/image_processing/scaling.hpp | 4 ++-- include/boost/gil/io/base.hpp | 2 +- include/boost/gil/io/io.hpp | 2 +- include/boost/gil/premultiply.hpp | 2 +- include/boost/gil/utilities.hpp | 2 +- test/core/image/empty_dimensions.cpp | 2 +- test/extension/io/bmp/bmp_make.cpp | 4 ++-- 33 files changed, 52 insertions(+), 52 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 78efc6134a..f8128ea13f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -465,7 +465,7 @@ Here is an example of such lightweight workflow in Linux environment (Debian-bas - option `-DBoost_ARCHITECTURE=-x64` to help CMake find Boost 1.66 and above add an architecture tag to the library file names in versioned build The option added in CMake 3.13.0. - - option `-DDBoost_ADDITIONAL_VERSIONS=` is especially usefull + - option `-DDBoost_ADDITIONAL_VERSIONS=` is especially useful when testing GIL with staged build of Boost from its `develop` branch. - if CMake is still failing to find Boost, you may try `-DBoost_DEBUG=ON` to get detailed diagnostics output from `FindBoost.cmake` module. diff --git a/RELEASES.md b/RELEASES.md index 56c517cfe2..ac577006ca 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -19,7 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fixed convolution in `convolve_2d` ([PR #723](https://github.com/boostorg/gil/pull/723)) - Normalize Gaussian 2D kernel to avoid darkening ([PR #725](https://github.com/boostorg/gil/pull/725)) -- Wrong buffer size in path string conversion functionss for `std::wstring` is fixed, avoiding buffer +- Wrong buffer size in path string conversion functions for `std::wstring` is fixed, avoiding buffer overflows when using I/O-related functions with `std::wstring` paths ([PR #746](https://github.com/boostorg/gil/pull/764)). ### Acknowledgements diff --git a/doc/histogram/cumulative.rst b/doc/histogram/cumulative.rst index a769f9ddde..29c088207b 100644 --- a/doc/histogram/cumulative.rst +++ b/doc/histogram/cumulative.rst @@ -8,7 +8,7 @@ Overview A cumulative histogram is a histogram in which each bin stores the count / frequency of itself as well as all the bins with keys 'smaller' than the particular bin. -As such, a notion of ordering among its keys should be existant in the histogram. +As such, a notion of ordering among its keys should be existent in the histogram. The GIL histogram class has the ability to convert itself into its cumulative version. diff --git a/example/affine.cpp b/example/affine.cpp index a078d17a2d..69a8fa947f 100644 --- a/example/affine.cpp +++ b/example/affine.cpp @@ -15,7 +15,7 @@ // This example relies on the matrices and functions available in GIL to define the operation, // in include/boost/gil/extension/numeric/affine.hpp -// and calls resample_pixels(), avaiable in the numeric extension, to apply it +// and calls resample_pixels(), available in the numeric extension, to apply it. int main() { diff --git a/example/anisotropic_diffusion.md b/example/anisotropic_diffusion.md index 770fa452c7..59d0cbdfb3 100644 --- a/example/anisotropic_diffusion.md +++ b/example/anisotropic_diffusion.md @@ -11,7 +11,7 @@ Anisotropic diffusion capabilities in GIL are demonstrated by the program `aniso - The fourth parameter is the number of iterations, which *must* be a positive integer - The fifth and last parameter is the value of the kappa constant -Note that both the input and the ouput images must be in the PNG format. +Note that both the input and the output images must be in the PNG format. ## Specific requirements diff --git a/example/hough_transform_circle.cpp b/example/hough_transform_circle.cpp index 44a739d62d..54dcbc3588 100644 --- a/example/hough_transform_circle.cpp +++ b/example/hough_transform_circle.cpp @@ -22,7 +22,7 @@ namespace gil = boost::gil; // The function hough_circle_transform_brute, defined in include/boost/gil/image_processing/hough_transform.cpp, // accepts a greyscale edge map, the three Hough parameters allowing to do the drawing and the voting, // an accumulator in the form of an iterator of views of the parameter space and a utility rasterizer to produce the points. -// The example outputs the voting cell of the centre of a circle drawn programatically. +// The example outputs the voting cell of the centre of a circle drawn programmatically. // See also: // hough_transform_line.cpp - Hough transform to detect lines diff --git a/example/hough_transform_circle.md b/example/hough_transform_circle.md index 9bcfcd6ff6..079cb9236e 100644 --- a/example/hough_transform_circle.md +++ b/example/hough_transform_circle.md @@ -8,7 +8,7 @@ Hough circle transform capabilities in GIL are demonstrated by the program `houg The program doesn't take any argument on the command line. -The program outputs the voting cell of the centre of a circle drawn programatically. +The program outputs the voting cell of the centre of a circle drawn programmatically. ## Specific requirements diff --git a/example/morphology.cpp b/example/morphology.cpp index 33f244ae7d..c8682dd55a 100644 --- a/example/morphology.cpp +++ b/example/morphology.cpp @@ -45,7 +45,7 @@ int main(int argc, char** argv) " " "" " \n"); - // User has to enter atleast one operation and they can enter maximum 8 + // User has to enter at least one operation and they can enter maximum 8 // operations considering binary conversion to be an // operation.Output_image_template argument is the common component which // will be added in names of all output images followed by a hyphen and diff --git a/example/rasterizer_ellipse.md b/example/rasterizer_ellipse.md index 345219bc7c..332e2963d9 100644 --- a/example/rasterizer_ellipse.md +++ b/example/rasterizer_ellipse.md @@ -9,9 +9,9 @@ Ellipse rasterization capabilities in GIL are demonstrated by the program `raste The program doesn't take any argument on the command line. `rasterizer_ellipse` produces three images in the current directory: -- `rasterized_ellipse_gray.jpg`, in the JPEG format, wich is a greyscale image of an ellipse -- `rasterized_ellipse_rgb.jpg`, in the JPEG format, wich is an RGB image of an ellipse -- `rasterized_ellipse_rgb_out_of_bound.jpg`, in the JPEG format, wich is an RGB image of an ellipse bigger than the containinig view. +- `rasterized_ellipse_gray.jpg`, in the JPEG format, which is a greyscale image of an ellipse +- `rasterized_ellipse_rgb.jpg`, in the JPEG format, which is an RGB image of an ellipse +- `rasterized_ellipse_rgb_out_of_bound.jpg`, in the JPEG format, which is an RGB image of an ellipse bigger than the containinig view. ## Specific requirements diff --git a/include/boost/gil/channel_algorithm.hpp b/include/boost/gil/channel_algorithm.hpp index 47496662fc..447056d186 100644 --- a/include/boost/gil/channel_algorithm.hpp +++ b/include/boost/gil/channel_algorithm.hpp @@ -485,7 +485,7 @@ namespace detail return (tmp + (tmp >> 8)) >> 8; } - // fast integer divison by 32768 + // fast integer division by 32768 inline auto div32768(uint32_t in) -> uint32_t { return (in + 16384) >> 15; diff --git a/include/boost/gil/channel_numeric_operations.hpp b/include/boost/gil/channel_numeric_operations.hpp index 703854710f..ba44d446ca 100644 --- a/include/boost/gil/channel_numeric_operations.hpp +++ b/include/boost/gil/channel_numeric_operations.hpp @@ -148,7 +148,7 @@ struct channel_minus_scalar_t /// \param scalar - subtrahend operand of the subtraction. auto operator()(ChannelRef channel, Scalar const& scalar) const -> ChannelResult { - // TODO: Convertion after subtraction vs conversion of operands in channel_minus_t? + // TODO: Conversion after subtraction vs conversion of operands in channel_minus_t? return ChannelResult(channel - scalar); } }; diff --git a/include/boost/gil/color_convert.hpp b/include/boost/gil/color_convert.hpp index cd125e4bd3..eb47c1cf5d 100644 --- a/include/boost/gil/color_convert.hpp +++ b/include/boost/gil/color_convert.hpp @@ -37,7 +37,7 @@ template struct channel_type; //////////////////////////////////////////////////////////////////////////////////////// /// \ingroup ColorConvert -/// \brief Color Convertion function object. To be specialized for every src/dst color space +/// \brief Color Conversion function object. To be specialized for every src/dst color space template struct default_color_converter_impl { @@ -47,7 +47,7 @@ struct default_color_converter_impl }; /// \ingroup ColorConvert -/// \brief When the color space is the same, color convertion performs channel depth conversion +/// \brief When the color space is the same, color conversion performs channel depth conversion template struct default_color_converter_impl { template @@ -319,7 +319,7 @@ struct default_color_converter_impl { } }; -/// @defgroup ColorConvert Color Space Converion +/// @defgroup ColorConvert Color Space Conversion /// \ingroup ColorSpaces /// \brief Support for conversion between pixels of different color spaces and channel depths diff --git a/include/boost/gil/concepts/pixel_iterator.hpp b/include/boost/gil/concepts/pixel_iterator.hpp index 52255dfb28..1f0952ef41 100644 --- a/include/boost/gil/concepts/pixel_iterator.hpp +++ b/include/boost/gil/concepts/pixel_iterator.hpp @@ -100,7 +100,7 @@ struct RandomAccessIteratorIsMemoryBasedConcept ignore_unused_variable_warning(bd); memunit_advance(it,3); - // for performace you may also provide a customized implementation of memunit_advanced_ref + // for performance you may also provide a customized implementation of memunit_advanced_ref } Iterator it; }; diff --git a/include/boost/gil/extension/dynamic_image/dynamic_at_c.hpp b/include/boost/gil/extension/dynamic_image/dynamic_at_c.hpp index 37625e700d..23bc02a01d 100644 --- a/include/boost/gil/extension/dynamic_image/dynamic_at_c.hpp +++ b/include/boost/gil/extension/dynamic_image/dynamic_at_c.hpp @@ -17,7 +17,7 @@ namespace boost { namespace gil { -// Constructs for static-to-dynamic integer convesion +// Constructs for static-to-dynamic integer conversion #define BOOST_GIL_AT_C_VALUE(z, N, text) mp11::mp_at_c::value, #define BOOST_GIL_DYNAMIC_AT_C_LIMIT 226 // size of the maximum vector to handle diff --git a/include/boost/gil/extension/io/bmp/tags.hpp b/include/boost/gil/extension/io/bmp/tags.hpp index c3ba18fb8e..1d025ddee6 100644 --- a/include/boost/gil/extension/io/bmp/tags.hpp +++ b/include/boost/gil/extension/io/bmp/tags.hpp @@ -72,7 +72,7 @@ static const uint32_t bmp_signature = 0x4D42; /// Constant signature for bmp fil template<> struct image_read_info< bmp_tag > { - /// Default contructor. + /// Default constructor. image_read_info() : _top_down(false) , _valid( false ) @@ -118,7 +118,7 @@ struct image_read_info< bmp_tag > bmp_top_down::type _top_down; - /// Used internaly to identify is the header has been read. + /// Used internally to identify is the header has been read. bool _valid; }; diff --git a/include/boost/gil/extension/io/png/tags.hpp b/include/boost/gil/extension/io/png/tags.hpp index 77ad0366fb..29c145e9c2 100644 --- a/include/boost/gil/extension/io/png/tags.hpp +++ b/include/boost/gil/extension/io/png/tags.hpp @@ -410,7 +410,7 @@ struct png_info_base png_bitdepth::type _bit_depth; /// The color space type. png_color_type::type _color_type; - /// The interlace methos. + /// The interlace method. png_interlace_method::type _interlace_method; /// The compression method. png_compression_method::type _compression_method; diff --git a/include/boost/gil/extension/io/pnm/detail/read.hpp b/include/boost/gil/extension/io/pnm/detail/read.hpp index d25866bc86..d27866e906 100644 --- a/include/boost/gil/extension/io/pnm/detail/read.hpp +++ b/include/boost/gil/extension/io/pnm/detail/read.hpp @@ -232,7 +232,7 @@ class reader< Device 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. + // aren't compatible. Though, read_and_no_convert::read(...) won't work. copy_data< View_Dst , View_Src >( dst , src diff --git a/include/boost/gil/extension/io/raw/tags.hpp b/include/boost/gil/extension/io/raw/tags.hpp index f9365a7814..f8129add8e 100644 --- a/include/boost/gil/extension/io/raw/tags.hpp +++ b/include/boost/gil/extension/io/raw/tags.hpp @@ -122,7 +122,7 @@ struct raw_unpack_function_name : property_base< std::string > {}; template<> struct image_read_info< raw_tag > { - /// Default contructor. + /// Default constructor. image_read_info() : _valid( false ) {} @@ -164,7 +164,7 @@ struct image_read_info< raw_tag > raw_libraw_version::type _libraw_version; raw_unpack_function_name::type _unpack_function_name; - /// Used internaly to identify if the header has been read. + /// Used internally to identify if the header has been read. bool _valid; }; diff --git a/include/boost/gil/extension/io/targa/tags.hpp b/include/boost/gil/extension/io/targa/tags.hpp index faee40461a..2c56dd3004 100644 --- a/include/boost/gil/extension/io/targa/tags.hpp +++ b/include/boost/gil/extension/io/targa/tags.hpp @@ -76,7 +76,7 @@ struct targa_screen_origin_bit : property_base< bool > {}; template<> struct image_read_info< targa_tag > { - /// Default contructor. + /// Default constructor. image_read_info() : _screen_origin_bit(false) , _valid( false ) diff --git a/include/boost/gil/extension/io/tiff/detail/is_allowed.hpp b/include/boost/gil/extension/io/tiff/detail/is_allowed.hpp index 87d08f8694..16a56260f2 100644 --- a/include/boost/gil/extension/io/tiff/detail/is_allowed.hpp +++ b/include/boost/gil/extension/io/tiff/detail/is_allowed.hpp @@ -130,7 +130,7 @@ struct Format_Type // return SAMPLEFORMAT_IEEEFP; // } // -// io_error( "Unkown channel format." ); +// io_error( "Unknown channel format." ); //} // The following two functions look the same but are different since one is using diff --git a/include/boost/gil/extension/io/tiff/detail/writer_backend.hpp b/include/boost/gil/extension/io/tiff/detail/writer_backend.hpp index 691825068d..4e81ae92eb 100644 --- a/include/boost/gil/extension/io/tiff/detail/writer_backend.hpp +++ b/include/boost/gil/extension/io/tiff/detail/writer_backend.hpp @@ -54,7 +54,7 @@ struct writer_backend< Device if(! this->_info._photometric_interpretation_user_defined ) { - // write photometric interpretion - Warning: This value is rather + // write photometric interpretation - Warning: This value is rather // subjective. The user should better set this value itself. There // is no way to decide if a image is PHOTOMETRIC_MINISWHITE or // PHOTOMETRIC_MINISBLACK. If the user has not manually set it, then @@ -86,7 +86,7 @@ struct writer_backend< Device // write bits per sample // @todo: Settings this value usually requires to write for each sample the bit - // value seperately in case they are different, like rgb556. + // value separately in case they are different, like rgb556. tiff_bits_per_sample::type bits_per_sample = detail::unsigned_integral_num_bits< channel_t >::value; this->_io_dev.template set_property( bits_per_sample ); diff --git a/include/boost/gil/extension/numeric/sampler.hpp b/include/boost/gil/extension/numeric/sampler.hpp index bc7fa351a6..16240fd24a 100644 --- a/include/boost/gil/extension/numeric/sampler.hpp +++ b/include/boost/gil/extension/numeric/sampler.hpp @@ -140,7 +140,7 @@ bool sample(bilinear_sampler, SrcView const& src, point const& p, DstP& resul } else if (p0.y+1::value> > >()(*loc, (1-frac.x)*(1-frac.y),mp); detail::add_dst_mul_src::value> > >()(loc.x()[1], frac.x *(1-frac.y),mp); ++loc.y(); diff --git a/include/boost/gil/extension/toolbox/color_spaces/ycbcr.hpp b/include/boost/gil/extension/toolbox/color_spaces/ycbcr.hpp index e19f64343a..dc01407a45 100644 --- a/include/boost/gil/extension/toolbox/color_spaces/ycbcr.hpp +++ b/include/boost/gil/extension/toolbox/color_spaces/ycbcr.hpp @@ -98,7 +98,7 @@ T const& clamp( template<> struct default_color_converter_impl { - // Note: the RGB_t channels range can be set later on by the users. We dont want to cast to uint8_t or anything here. + // Note: The RGB_t channels range can be set later on by the users. We don't want to cast to uint8_t or anything here. template < typename SRCP, typename DSTP > void operator()( const SRCP& src, DSTP& dst ) const { @@ -130,7 +130,7 @@ struct default_color_converter_impl src_channel_t cb = channel_convert( get_color(src, cb_t())); src_channel_t cr = channel_convert( get_color(src, cr_t())); - // The intermediate results of the formulas require at least 16bits of precission. + // The intermediate results of the formulas require at least 16 bits of precision. std::int_fast16_t c = y - 16; std::int_fast16_t d = cb - 128; std::int_fast16_t e = cr - 128; diff --git a/include/boost/gil/image_processing/convolve.hpp b/include/boost/gil/image_processing/convolve.hpp index 91384f1626..39a852e565 100644 --- a/include/boost/gil/image_processing/convolve.hpp +++ b/include/boost/gil/image_processing/convolve.hpp @@ -32,7 +32,7 @@ namespace boost { namespace gil { namespace detail { /// \brief Computes the cross-correlation of 1D kernel with rows of an image. -/// \tparam PixelAccum - Specifies tha data type which will be used for creating buffer container +/// \tparam PixelAccum - Specifies the data type which will be used for creating buffer container /// utilized for holding source image pixels after applying appropriate boundary manipulations. /// \tparam SrcView - Specifies the type of gil view of source image which is to be row correlated /// with the kernel. @@ -196,7 +196,7 @@ struct correlator_k /// \ingroup ImageAlgorithms /// \brief Correlate 1D variable-size kernel along the rows of image. -/// \tparam PixelAccum Specifies tha data type which will be used while creating buffer container +/// \tparam PixelAccum Specifies the data type which will be used while creating buffer container /// which is utilized for holding source image pixels after applying appropriate boundary /// manipulations. /// \tparam SrcView Models ImageViewConcept @@ -216,7 +216,7 @@ void correlate_rows( /// \ingroup ImageAlgorithms /// \brief Correlates 1D variable-size kernel along the columns of image. -/// \tparam PixelAccum Specifies tha data type which will be used for creating buffer container +/// \tparam PixelAccum Specifies the data type which will be used for creating buffer container /// utilized for holding source image pixels after applying appropriate boundary manipulations. /// \tparam SrcView Models ImageViewConcept /// \tparam Kernel Specifies the type of 1D kernel which will be column correlated with source @@ -236,7 +236,7 @@ void correlate_cols( /// \ingroup ImageAlgorithms /// \brief Convolves 1D variable-size kernel along the rows of image. -/// \tparam PixelAccum Specifies tha data type which will be used for creating buffer container +/// \tparam PixelAccum Specifies the data type which will be used for creating buffer container /// utilized for holding source image pixels after applying appropriate boundary manipulations. /// \tparam SrcView Models ImageViewConcept /// \tparam Kernel Specifies the type of 1D kernel which will be row convoluted with source image. @@ -254,7 +254,7 @@ void convolve_rows( /// \ingroup ImageAlgorithms /// \brief Convolves 1D variable-size kernel along the columns of image. -/// \tparam PixelAccum Specifies tha data type which will be used for creating buffer container +/// \tparam PixelAccum Specifies the data type which will be used for creating buffer container /// utilized for holding source image pixels after applying appropriate boundary manipulations. /// \tparam SrcView Models ImageViewConcept /// \tparam Kernel Specifies the type of 1D kernel which will be column convoluted with source @@ -274,7 +274,7 @@ void convolve_cols( /// \ingroup ImageAlgorithms /// \brief Correlate 1D fixed-size kernel along the rows of image. -/// \tparam PixelAccum Specifies tha data type which will be used for creating buffer container +/// \tparam PixelAccum Specifies the data type which will be used for creating buffer container /// utilized for holding source image pixels after applying appropriate boundary manipulations. /// \tparam SrcView Models ImageViewConcept /// \tparam Kernel Specifies the type of 1D kernel which will be row correlated with source image. @@ -293,7 +293,7 @@ void correlate_rows_fixed( /// \ingroup ImageAlgorithms /// \brief Correlate 1D fixed-size kernel along the columns of image -/// \tparam PixelAccum Specifies tha data type which will be used for creating buffer container +/// \tparam PixelAccum Specifies the data type which will be used for creating buffer container /// utilized for holding source image pixels after applying appropriate boundary manipulations. /// \tparam SrcView Models ImageViewConcept /// \tparam Kernel Specifies the type of 1D kernel which will be column correlated with source @@ -313,7 +313,7 @@ void correlate_cols_fixed( /// \ingroup ImageAlgorithms /// \brief Convolve 1D fixed-size kernel along the rows of image -/// \tparam PixelAccum Specifies tha data type which will be used for creating buffer container +/// \tparam PixelAccum Specifies the data type which will be used for creating buffer container /// utilized for holding source image pixels after applying appropriate boundary manipulations. /// \tparam SrcView Models ImageViewConcept /// \tparam Kernel Specifies the type of 1D kernel which will be row convolved with source image. @@ -331,7 +331,7 @@ void convolve_rows_fixed( /// \ingroup ImageAlgorithms /// \brief Convolve 1D fixed-size kernel along the columns of image -/// \tparam PixelAccum Specifies tha data type which will be used for creating buffer container +/// \tparam PixelAccum Specifies the data type which will be used for creating buffer container /// utilized for holding source image pixels after applying appropriate boundary manipulations. /// \tparam SrcView Models ImageViewConcept /// \tparam Kernel Specifies the type of 1D kernel which will be column convolved with source @@ -354,7 +354,7 @@ namespace detail /// \ingroup ImageAlgorithms /// \brief Convolve 1D variable-size kernel along both rows and columns of image -/// \tparam PixelAccum Specifies tha data type which will be used for creating buffer container +/// \tparam PixelAccum Specifies the data type which will be used for creating buffer container /// utilized for holding source image pixels after applying appropriate boundary manipulations. /// \tparam SrcView Models ImageViewConcept /// \tparam Kernel Specifies the type of 1D kernel which will be used for 1D row and column diff --git a/include/boost/gil/image_processing/histogram_equalization.hpp b/include/boost/gil/image_processing/histogram_equalization.hpp index fba98f87ce..7625db79ea 100644 --- a/include/boost/gil/image_processing/histogram_equalization.hpp +++ b/include/boost/gil/image_processing/histogram_equalization.hpp @@ -28,7 +28,7 @@ namespace boost { namespace gil { /// 1. If histogram A is to be equalized compute the cumulative histogram of A. /// 2. Let CFD(A) refer to the cumulative histogram of A /// 3. For a uniform histogram A', CDF(A') = A' -/// 4. We need to transfrom A to A' such that +/// 4. We need to transform A to A' such that /// 5. CDF(A') = CDF(A) => A' = CDF(A) /// 6. Hence the pixel transform , px => histogram_of_ith_channel[px]. /// diff --git a/include/boost/gil/image_processing/numeric.hpp b/include/boost/gil/image_processing/numeric.hpp index 5500c7a96e..cf9bcdd8ae 100644 --- a/include/boost/gil/image_processing/numeric.hpp +++ b/include/boost/gil/image_processing/numeric.hpp @@ -14,7 +14,7 @@ #include #include #include -// fixes ambigious call to std::abs, https://stackoverflow.com/a/30084734/4593721 +// fixes ambiguous call to std::abs, https://stackoverflow.com/a/30084734/4593721 #include #include diff --git a/include/boost/gil/image_processing/scaling.hpp b/include/boost/gil/image_processing/scaling.hpp index 69cc950f98..44ca8f9177 100644 --- a/include/boost/gil/image_processing/scaling.hpp +++ b/include/boost/gil/image_processing/scaling.hpp @@ -16,13 +16,13 @@ namespace boost { namespace gil { /// \defgroup ScalingAlgorithms -/// \brief Algorthims suitable for rescaling +/// \brief Algorithms suitable for rescaling /// /// These algorithms are used to improve image quality after image resizing is made. /// /// \defgroup DownScalingAlgorithms /// \ingroup ScalingAlgorithms -/// \brief Algorthims suitable for downscaling +/// \brief Algorithms suitable for downscaling /// /// These algorithms provide best results when used for downscaling. Using for upscaling will /// probably provide less than good results. diff --git a/include/boost/gil/io/base.hpp b/include/boost/gil/io/base.hpp index fd649a371b..523069ee8c 100644 --- a/include/boost/gil/io/base.hpp +++ b/include/boost/gil/io/base.hpp @@ -71,7 +71,7 @@ struct image_read_settings_base /** * Boolean meta function, std::true_type 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. + * \todo the name is_supported is to generic, pick something more I/O-related. */ // Depending on image type the parameter Pixel can be a reference type // for bit_aligned images or a pixel for byte images. diff --git a/include/boost/gil/io/io.hpp b/include/boost/gil/io/io.hpp index 86c32e7541..ae235065c5 100644 --- a/include/boost/gil/io/io.hpp +++ b/include/boost/gil/io/io.hpp @@ -68,7 +68,7 @@ * * \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 + * The IODevice was added as a template parameter 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. * diff --git a/include/boost/gil/premultiply.hpp b/include/boost/gil/premultiply.hpp index 078c311111..bdccdc6c30 100644 --- a/include/boost/gil/premultiply.hpp +++ b/include/boost/gil/premultiply.hpp @@ -27,7 +27,7 @@ struct channel_premultiply template void operator()(Channel /* channel */) const { - // TODO: Explain why 'channel' input paramater is not used, or used as tag only. + // TODO: Explain why 'channel' input parameter is not used, or used as tag only. // @todo: need to do a "channel_convert" too, in case the channel types aren't the same? get_color(dst_, Channel()) = channel_multiply(get_color(src_,Channel()), alpha_or_max(src_)); diff --git a/include/boost/gil/utilities.hpp b/include/boost/gil/utilities.hpp index 988efc3209..9e5c25862c 100644 --- a/include/boost/gil/utilities.hpp +++ b/include/boost/gil/utilities.hpp @@ -244,7 +244,7 @@ struct dec T operator()(T x) const { return --x; } }; -/// \brief Returns the index corresponding to the first occurrance of a given given type in +/// \brief Returns the index corresponding to the first occurrence of a given given type in // a given Boost.MP11-compatible list (or size if the type is not present) template struct type_to_index : mp11::mp_find diff --git a/test/core/image/empty_dimensions.cpp b/test/core/image/empty_dimensions.cpp index 9a665e490f..9500e054e8 100644 --- a/test/core/image/empty_dimensions.cpp +++ b/test/core/image/empty_dimensions.cpp @@ -16,7 +16,7 @@ namespace gil = boost::gil; namespace fixture = boost::gil::test::fixture; -// Test cases of memory leak potential for image created with empty dimesions, +// Test cases of memory leak potential for image created with empty dimensions, // see https://github.com/boostorg/gil/pull/649 // The main goal of these test cases is to trigger any memory leak detectors. diff --git a/test/extension/io/bmp/bmp_make.cpp b/test/extension/io/bmp/bmp_make.cpp index 1746264398..1637c2f5a2 100644 --- a/test/extension/io/bmp/bmp_make.cpp +++ b/test/extension/io/bmp/bmp_make.cpp @@ -167,7 +167,7 @@ void test_make_dynamic_image_reader() void test_make_writer() { - // Empty files may be created, but noo image data is written. + // Empty files may be created, but no image data is written. { using writer_t = gil::get_writer::type; @@ -220,7 +220,7 @@ void test_make_writer() void test_make_dynamic_image_writer() { - // Empty files may be created, but noo image data is written. + // Empty files may be created, but no image data is written. { gil::get_dynamic_image_writer::type writer_char = gil::make_dynamic_image_writer( From 32eabbc5534dd1dc867dfe0967446a17ae8be0cc Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Tue, 23 Jul 2024 09:40:16 +0200 Subject: [PATCH 02/42] chore: fix more typos (#753) --- doc/tutorial/histogram.rst | 2 +- .../gil/extension/io/jpeg/detail/write.hpp | 4 +- .../gil/extension/io/tiff/detail/read.hpp | 2 +- .../io/tiff/detail/scanline_read.hpp | 2 +- .../boost/gil/image_processing/convolve.hpp | 2 +- .../image_processing/histogram_matching.hpp | 4 +- .../boost/gil/image_processing/threshold.hpp | 2 +- .../io/tiff/tiff_file_format_test.cpp | 54 +++++++++---------- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/doc/tutorial/histogram.rst b/doc/tutorial/histogram.rst index 4ce849edd4..0701c5a857 100644 --- a/doc/tutorial/histogram.rst +++ b/doc/tutorial/histogram.rst @@ -7,7 +7,7 @@ Tutorial: Histogram This is a short tutorial presenting an example of a very simple sample of code from an existing code base that calculates histogram of an image. -Next, the program is rewritten using GIL featres. +Next, the program is rewritten using GIL features. Original implementation ----------------------- diff --git a/include/boost/gil/extension/io/jpeg/detail/write.hpp b/include/boost/gil/extension/io/jpeg/detail/write.hpp index e4534b3d58..35ac8b72c8 100644 --- a/include/boost/gil/extension/io/jpeg/detail/write.hpp +++ b/include/boost/gil/extension/io/jpeg/detail/write.hpp @@ -103,7 +103,7 @@ class writer< Device , TRUE ); - // Needs to be done after jpeg_set_defaults() since it's overridding this value back to slow. + // Needs to be done after jpeg_set_defaults() since it's overriding this value back to slow. this->get()->dct_method = this->_info._dct_method; @@ -138,7 +138,7 @@ class writer< Device }; /// -/// JPEG Dyamic Image Writer +/// JPEG Dynamic Image Writer /// template< typename Device > class dynamic_image_writer< Device diff --git a/include/boost/gil/extension/io/tiff/detail/read.hpp b/include/boost/gil/extension/io/tiff/detail/read.hpp index 13ce23d618..1424e2f7f0 100644 --- a/include/boost/gil/extension/io/tiff/detail/read.hpp +++ b/include/boost/gil/extension/io/tiff/detail/read.hpp @@ -277,7 +277,7 @@ class reader< Device break; } - case PHOTOMETRIC_SEPARATED: // CYMK + case PHOTOMETRIC_SEPARATED: // CMYK { switch( this->_info._bits_per_sample ) { diff --git a/include/boost/gil/extension/io/tiff/detail/scanline_read.hpp b/include/boost/gil/extension/io/tiff/detail/scanline_read.hpp index f3369c4714..6e4cb946e0 100644 --- a/include/boost/gil/extension/io/tiff/detail/scanline_read.hpp +++ b/include/boost/gil/extension/io/tiff/detail/scanline_read.hpp @@ -326,7 +326,7 @@ class scanline_reader< Device break; } - case PHOTOMETRIC_SEPARATED: // CYMK + case PHOTOMETRIC_SEPARATED: // CMYK { switch( this->_info._bits_per_sample ) { diff --git a/include/boost/gil/image_processing/convolve.hpp b/include/boost/gil/image_processing/convolve.hpp index 39a852e565..bda11f4a73 100644 --- a/include/boost/gil/image_processing/convolve.hpp +++ b/include/boost/gil/image_processing/convolve.hpp @@ -27,7 +27,7 @@ namespace boost { namespace gil { -// 2D spatial seperable convolutions and cross-correlations +// 2D spatial separable convolutions and cross-correlations namespace detail { diff --git a/include/boost/gil/image_processing/histogram_matching.hpp b/include/boost/gil/image_processing/histogram_matching.hpp index 1b947c426f..765188c344 100644 --- a/include/boost/gil/image_processing/histogram_matching.hpp +++ b/include/boost/gil/image_processing/histogram_matching.hpp @@ -30,7 +30,7 @@ namespace boost { namespace gil { /// Algorithm :- /// 1. Calculate histogram A(pixel) of input image and G(pixel) of reference image. /// 2. Compute the normalized cumulative(CDF) histograms of A and G. -/// 3. Match the histograms using transofrmation => CDF(A(px)) = CDF(G(px')) +/// 3. Match the histograms using transformation => CDF(A(px)) = CDF(G(px')) /// => px' = Inv-CDF (CDF(px)) /// @@ -73,7 +73,7 @@ auto histogram_matching( std::is_integral::value && std::is_integral::value && std::is_integral::value, - "Source, Refernce or Destination histogram type is not appropriate."); + "Source, Reference or Destination histogram type is not appropriate."); using value_t = typename histogram::value_type; dst_hist.clear(); diff --git a/include/boost/gil/image_processing/threshold.hpp b/include/boost/gil/image_processing/threshold.hpp index b3b56356fc..6dceaf976a 100644 --- a/include/boost/gil/image_processing/threshold.hpp +++ b/include/boost/gil/image_processing/threshold.hpp @@ -161,7 +161,7 @@ void threshold_binary( /// \ingroup ImageProcessing /// \brief Applies truncating threshold to each pixel of image view. -/// Takes an image view and performs truncating threshold operation on each chennel. +/// Takes an image view and performs truncating threshold operation on each channel. /// If mode is threshold and direction is regular: /// values greater than threshold_value will be set to threshold_value else no change /// If mode is threshold and direction is inverse: diff --git a/test/extension/io/tiff/tiff_file_format_test.cpp b/test/extension/io/tiff/tiff_file_format_test.cpp index 4264312f74..3040ba5f82 100644 --- a/test/extension/io/tiff/tiff_file_format_test.cpp +++ b/test/extension/io/tiff/tiff_file_format_test.cpp @@ -346,8 +346,8 @@ void test_thirty_two_bit_contiguous_rgb_image() #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES } -// flower-rgb-planar-02.tif 73x43 2-bit seperated RGB image -void test_two_bit_seperated_rgb_image() +// flower-rgb-planar-02.tif 73x43 2-bit separated RGB image +void test_two_bit_separated_rgb_image() { std::string filename(tiff_in + "libtiffpic/depth/flower-rgb-planar-02.tif"); @@ -360,8 +360,8 @@ void test_two_bit_seperated_rgb_image() #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES } -// flower-rgb-planar-04.tif 73x43 4-bit seperated RGB image -void test_four_bit_seperated_rgb_image() +// flower-rgb-planar-04.tif 73x43 4-bit separated RGB image +void test_four_bit_separated_rgb_image() { std::string filename(tiff_in + "libtiffpic/depth/flower-rgb-planar-04.tif"); @@ -374,8 +374,8 @@ void test_four_bit_seperated_rgb_image() #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES } -// flower-rgb-planar-08.tif 73x43 8-bit seperated RGB image -void test_eight_bit_seperated_rgb_image() +// flower-rgb-planar-08.tif 73x43 8-bit separated RGB image +void test_eight_bit_separated_rgb_image() { std::string filename(tiff_in + "libtiffpic/depth/flower-rgb-planar-08.tif"); @@ -388,8 +388,8 @@ void test_eight_bit_seperated_rgb_image() #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES } -// flower-rgb-planar-10.tif 73x43 10-bit seperated RGB image -void test_ten_bit_seperated_rgb_image() +// flower-rgb-planar-10.tif 73x43 10-bit separated RGB image +void test_ten_bit_separated_rgb_image() { std::string filename(tiff_in + "libtiffpic/depth/flower-rgb-planar-10.tif"); @@ -402,8 +402,8 @@ void test_ten_bit_seperated_rgb_image() #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES } -// flower-rgb-planar-12.tif 73x43 12-bit seperated RGB image -void test_twelve_bit_seperated_rgb_image() +// flower-rgb-planar-12.tif 73x43 12-bit separated RGB image +void test_twelve_bit_separated_rgb_image() { std::string filename(tiff_in + "libtiffpic/depth/flower-rgb-planar-12.tif"); @@ -416,8 +416,8 @@ void test_twelve_bit_seperated_rgb_image() #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES } -// flower-rgb-planar-14.tif 73x43 14-bit seperated RGB image -void test_fourteen_bit_seperated_rgb_image() +// flower-rgb-planar-14.tif 73x43 14-bit separated RGB image +void test_fourteen_bit_separated_rgb_image() { std::string filename(tiff_in + "libtiffpic/depth/flower-rgb-planar-14.tif"); @@ -430,8 +430,8 @@ void test_fourteen_bit_seperated_rgb_image() #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES } -// flower-rgb-planar-16.tif 73x43 16-bit seperated RGB image -void test_sixteen_bit_seperated_rgb_image() +// flower-rgb-planar-16.tif 73x43 16-bit separated RGB image +void test_sixteen_bit_separated_rgb_image() { std::string filename(tiff_in + "libtiffpic/depth/flower-rgb-planar-16.tif"); @@ -444,8 +444,8 @@ void test_sixteen_bit_seperated_rgb_image() #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES } -// flower-rgb-planar-24.tif 73x43 24-bit seperated RGB image -void test_twenty_four_bit_seperated_rgb_image() +// flower-rgb-planar-24.tif 73x43 24-bit separated RGB image +void test_twenty_four_bit_separated_rgb_image() { std::string filename(tiff_in + "libtiffpic/depth/flower-rgb-planar-24.tif"); @@ -458,8 +458,8 @@ void test_twenty_four_bit_seperated_rgb_image() #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES } -// flower-rgb-planar-32.tif 73x43 32-bit seperated RGB image -void test_thirty_two_bit_seperated_rgb_image() +// flower-rgb-planar-32.tif 73x43 32-bit separated RGB image +void test_thirty_two_bit_separated_rgb_image() { std::string filename(tiff_in + "libtiffpic/depth/flower-rgb-planar-32.tif"); @@ -609,15 +609,15 @@ int main() test_sixteen_bit_contiguous_rgb_image(); test_twenty_four_bit_contiguous_rgb_image(); test_thirty_two_bit_contiguous_rgb_image(); - test_two_bit_seperated_rgb_image(); - test_four_bit_seperated_rgb_image(); - test_eight_bit_seperated_rgb_image(); - test_ten_bit_seperated_rgb_image(); - test_twelve_bit_seperated_rgb_image(); - test_fourteen_bit_seperated_rgb_image(); - test_sixteen_bit_seperated_rgb_image(); - test_twenty_four_bit_seperated_rgb_image(); - test_thirty_two_bit_seperated_rgb_image(); + test_two_bit_separated_rgb_image(); + test_four_bit_separated_rgb_image(); + test_eight_bit_separated_rgb_image(); + test_ten_bit_separated_rgb_image(); + test_twelve_bit_separated_rgb_image(); + test_fourteen_bit_separated_rgb_image(); + test_sixteen_bit_separated_rgb_image(); + test_twenty_four_bit_separated_rgb_image(); + test_thirty_two_bit_separated_rgb_image(); test_eight_bit_contiguous_cmyk_image(); test_sixteen_bit_contiguous_cmyk_image(); test_eight_bit_separated_cmyk_image(); From 91e2dcc9a4318d15833881b1d9d07c0abebba540 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Tue, 23 Jul 2024 15:57:13 +0200 Subject: [PATCH 03/42] ci: update codecov/codecov-action in GitHub Actions workflow to v4 (#755) --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3e9b878dd9..5d262906a5 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -49,6 +49,6 @@ jobs: lcov --list coverage.info - name: Upload to Codecov - uses: codecov/codecov-action@v1.2.1 + uses: codecov/codecov-action@v4 with: files: ../boost-root/coverage.info From f56c4c65a8afc51df57e2e2653c5e35ed29a2423 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Tue, 23 Jul 2024 15:58:12 +0200 Subject: [PATCH 04/42] tests: add test cases for wide character path conversions (#754) --- test/core/CMakeLists.txt | 1 + test/core/Jamfile | 1 + test/core/io/CMakeLists.txt | 25 ++++++++++++++++ test/core/io/Jamfile | 13 ++++++++ test/core/io/path_spec.cpp | 59 +++++++++++++++++++++++++++++++++++++ 5 files changed, 99 insertions(+) create mode 100644 test/core/io/CMakeLists.txt create mode 100644 test/core/io/Jamfile create mode 100644 test/core/io/path_spec.cpp diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index 2b70482aa0..ee09332906 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -41,3 +41,4 @@ add_subdirectory(image_view) add_subdirectory(algorithm) add_subdirectory(image_processing) add_subdirectory(histogram) +add_subdirectory(io) diff --git a/test/core/Jamfile b/test/core/Jamfile index 9305b8762c..25156392e4 100644 --- a/test/core/Jamfile +++ b/test/core/Jamfile @@ -33,3 +33,4 @@ build-project image_view ; build-project algorithm ; build-project image_processing ; build-project histogram ; +build-project io ; diff --git a/test/core/io/CMakeLists.txt b/test/core/io/CMakeLists.txt new file mode 100644 index 0000000000..171e354854 --- /dev/null +++ b/test/core/io/CMakeLists.txt @@ -0,0 +1,25 @@ +# +# Copyright (c) 2024 Dirk Stolle +# +# Distributed under 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) +# +foreach(_name + path_spec) + set(_test t_core_io_${_name}) + set(_target test_core_io_${_name}) + + add_executable(${_target} "") + target_sources(${_target} PRIVATE ${_name}.cpp) + target_link_libraries(${_target} + PRIVATE + gil_compile_options + gil_include_directories + gil_dependencies) + add_test(NAME ${_test} COMMAND ${_target}) + + unset(_name) + unset(_target) + unset(_test) +endforeach() diff --git a/test/core/io/Jamfile b/test/core/io/Jamfile new file mode 100644 index 0000000000..f696d70763 --- /dev/null +++ b/test/core/io/Jamfile @@ -0,0 +1,13 @@ +# Boost.GIL (Generic Image Library) - tests +# +# Copyright (c) 2024 Dirk Stolle +# +# Distributed under 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) + +import testing ; + +compile path_spec.cpp ; + +run path_spec.cpp ; diff --git a/test/core/io/path_spec.cpp b/test/core/io/path_spec.cpp new file mode 100644 index 0000000000..8179512e6a --- /dev/null +++ b/test/core/io/path_spec.cpp @@ -0,0 +1,59 @@ +// +// Copyright 2024 Dirk Stolle +// +// Distributed under the Boost Software License, Version 1.0 +// See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include +#include +#include + +namespace gil = boost::gil; + +void test_convert_to_string_from_wstring() +{ + std::wstring const path = L"/some_path/傳/привет/qwerty"; + std::string const expected = "/some_path/\xE5\x82\xB3/\xD0\xBF\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82/qwerty"; + + std::string string = gil::detail::convert_to_string(path); + BOOST_TEST_EQ( 34, string.size() ); + BOOST_TEST_EQ( expected, string ); +} + +void test_convert_to_native_string_from_wchar_t_ptr() +{ + wchar_t const* path = L"/some_path/傳/привет/qwerty"; + char const* expected = "/some_path/\xE5\x82\xB3/\xD0\xBF\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82/qwerty"; + + char const* string = gil::detail::convert_to_native_string(path); + BOOST_TEST_EQ( 34, strlen(string) ); + BOOST_TEST_EQ( 0, std::strcmp(expected, string) ); + delete[] string; +} + +void test_convert_to_native_string_from_wstring() +{ + std::wstring const path = L"/some_path/傳/привет/qwerty"; + char const* expected = "/some_path/\xE5\x82\xB3/\xD0\xBF\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82/qwerty"; + + char const* string = gil::detail::convert_to_native_string(path); + BOOST_TEST_EQ( 34, strlen(string) ); + BOOST_TEST_EQ( 0, std::strcmp(expected, string) ); + delete[] string; +} + +int main() +{ + // Set global locale to one that uses UTF-8. Could be "en_US.UTF-8" or + // "C.UTF-8" or something similar, as long as it exists on the system. + std::locale::global(std::locale("C.UTF-8")); + + test_convert_to_string_from_wstring(); + test_convert_to_native_string_from_wchar_t_ptr(); + test_convert_to_native_string_from_wstring(); + + return boost::report_errors(); +} From 8fd5cc5b3287f6a1bbd250bc903a4452410ffa27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Ferdinand=20Rivera=20Morell?= Date: Tue, 20 Aug 2024 08:03:19 -0500 Subject: [PATCH 05/42] Add support for modular build structure. (#752) * Make the library modular usable. * Add missing modular build.jam. And fix gitignore that caused it to be originally deleted! * Switch to library requirements instead of source. As source puts extra source in install targets. * Add missing import-search for cconfig/predef checks. * Add requires-b2 check to top-level build file. * Bump B2 require to 5.2 * Update copyright dates. * Move inter-lib dependencies to a project variable and into the build targets. * Update build deps. --- .gitignore | 2 ++ Jamfile | 11 ----------- build.jam | 34 ++++++++++++++++++++++++++++++++++ example/Jamfile | 4 +++- test/Jamfile | 17 ++++++----------- test/core/algorithm/Jamfile | 2 +- test/legacy/Jamfile | 2 +- 7 files changed, 47 insertions(+), 25 deletions(-) delete mode 100644 Jamfile create mode 100644 build.jam diff --git a/.gitignore b/.gitignore index f16ee331e4..450dee9c5e 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ graph_info.json # clangd compile_commands.json .clangd/ + +!build.jam diff --git a/Jamfile b/Jamfile deleted file mode 100644 index ee18a21f23..0000000000 --- a/Jamfile +++ /dev/null @@ -1,11 +0,0 @@ -# Boost.GIL Library Jamfile -# -# Copyright (c) 2018 James E. King III -# -# 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) - -# please order by name to ease maintenance -build-project example ; -build-project test ; diff --git a/build.jam b/build.jam new file mode 100644 index 0000000000..d5f59650b1 --- /dev/null +++ b/build.jam @@ -0,0 +1,34 @@ +# Copyright René Ferdinand Rivera Morell 2023-2024 +# Distributed under 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) + +require-b2 5.2 ; + +constant boost_dependencies : + /boost/assert//boost_assert + /boost/concept_check//boost_concept_check + /boost/config//boost_config + /boost/container_hash//boost_container_hash + /boost/core//boost_core + /boost/filesystem//boost_filesystem + /boost/integer//boost_integer + /boost/iterator//boost_iterator + /boost/mp11//boost_mp11 + /boost/preprocessor//boost_preprocessor + /boost/type_traits//boost_type_traits + /boost/variant2//boost_variant2 ; + +project /boost/gil + : common-requirements + include + ; + +explicit + [ alias boost_gil : : : : $(boost_dependencies) ] + [ alias all : boost_gil example test ] + ; + +call-if : boost-library gil + ; + diff --git a/example/Jamfile b/example/Jamfile index ba4a6e81c2..6953c1b66d 100644 --- a/example/Jamfile +++ b/example/Jamfile @@ -6,7 +6,8 @@ # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -import ../../config/checks/config : requires ; +import-search /boost/config/checks ; +import config : requires ; import regex ; using libjpeg : : : : true ; # work around bug on master @@ -22,6 +23,7 @@ local msvc-cxxs-with-experimental-fs = 14 ; project : requirements + /boost/gil//boost_gil [ requires cxx14_constexpr cxx14_return_type_deduction diff --git a/test/Jamfile b/test/Jamfile index 5c674a587f..ec206405e6 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -9,7 +9,8 @@ # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -import ../../config/checks/config : requires ; +import-search /boost/config/checks ; +import config : requires ; import os ; import path ; import regex ; @@ -26,6 +27,7 @@ local msvc-cxxs-with-experimental-fs = 14 ; project : requirements + /boost/gil//boost_gil [ requires cxx11_constexpr cxx11_defaulted_functions @@ -83,21 +85,14 @@ rule generate_self_contained_headers ( headers_subpath * : exclude_subpaths * ) # NOTE: All '/' in test names are replaced with '-' because apparently # test scripts have a problem with test names containing slashes. - local top_headers_path = [ path.make $(BOOST_ROOT)/libs/gil/include/boost/gil ] ; - local headers_path = $(top_headers_path) ; - if $(headers_subpath) - { - headers_path = $(top_headers_path)/$(headers_subpath) ; - } - - for local file in [ path.glob-tree $(headers_path) : *.hpp : $(exclude_subpaths) ] + for local file in [ glob-tree-ex ../include/boost/gil : *.hpp : $(exclude_subpaths) ] { local target_no = [ sequence.length $(targets) ] ; - local rel_file = [ path.relative-to $(top_headers_path) $(file) ] ; + local rel_file = [ path.relative-to ../include/boost/gil $(file) ] ; local target_name = [ regex.replace h/$(target_no)/$(rel_file) "/" "-" ] ; local target_name = [ regex.replace $(target_name) "\.hpp" "" ] ; targets += [ - compile $(BOOST_ROOT)/libs/gil/test/header/main.cpp + compile header/main.cpp : "BOOST_GIL_TEST_HEADER=$(rel_file)" $(file) : $(target_name) ] ; diff --git a/test/core/algorithm/Jamfile b/test/core/algorithm/Jamfile index 99436eca72..aa51fa435f 100644 --- a/test/core/algorithm/Jamfile +++ b/test/core/algorithm/Jamfile @@ -10,6 +10,6 @@ import testing ; run for_each_pixel.cpp ; -run std_fill.cpp ; +run std_fill.cpp : : : /boost/array//boost_array ; run std_uninitialized_fill.cpp ; run extend_boundary.cpp ; diff --git a/test/legacy/Jamfile b/test/legacy/Jamfile index 048ab8c496..c987dd6312 100644 --- a/test/legacy/Jamfile +++ b/test/legacy/Jamfile @@ -17,7 +17,7 @@ import testing ; -run image.cpp sample_image.cpp error_if.cpp : : gil_reference_checksums.txt ; +run image.cpp sample_image.cpp error_if.cpp : : gil_reference_checksums.txt : /boost/crc//boost_crc ; run channel.cpp error_if.cpp ; run pixel.cpp error_if.cpp ; run pixel_iterator.cpp error_if.cpp ; From e5f5bce2b953c49f964ddf677a3dc2a97bde3eb6 Mon Sep 17 00:00:00 2001 From: Samuel Debionne Date: Wed, 18 Sep 2024 20:57:06 +0200 Subject: [PATCH 06/42] Fix dynamic transposed_view (#756) Just a little typo --- .../gil/extension/dynamic_image/image_view_factory.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/gil/extension/dynamic_image/image_view_factory.hpp b/include/boost/gil/extension/dynamic_image/image_view_factory.hpp index a41dc32c54..3d01724d36 100644 --- a/include/boost/gil/extension/dynamic_image/image_view_factory.hpp +++ b/include/boost/gil/extension/dynamic_image/image_view_factory.hpp @@ -73,14 +73,14 @@ struct rotated90ccw_view_fn }; template -struct tranposed_view_fn +struct transposed_view_fn { using result_type = ResultView; template auto operator()(View const& src) const -> result_type { - return result_type{tranposed_view(src)}; + return result_type{transposed_view(src)}; } }; @@ -196,7 +196,7 @@ auto transposed_view(any_image_view const& src) -> typename dynamic_xy_step_transposed_type>::type { using result_view_t = typename dynamic_xy_step_transposed_type>::type; - return variant2::visit(detail::tranposed_view_fn(), src); + return variant2::visit(detail::transposed_view_fn(), src); } /// \ingroup ImageViewTransformations90CW From eb142a3659dbc2bd0a84abecfc2f763da630fc5a Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Sun, 8 Dec 2024 20:29:30 +0100 Subject: [PATCH 07/42] Fix node 20 issue on GHA CI (#758) * Update containers --- .github/workflows/ci.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 492b21d1c2..a3c256f311 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,10 +11,12 @@ on: env: LIBRARY: gil UBSAN_OPTIONS: print_stacktrace=1 - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true jobs: posix: + defaults: + run: + shell: bash strategy: fail-fast: false matrix: @@ -84,19 +86,27 @@ jobs: os: ubuntu-20.04 - toolset: clang cxxstd: "14,17" - os: macos-12 + os: macos-13 runs-on: ${{matrix.os}} - container: ${{matrix.container}} + container: + image: ${{matrix.container}} + volumes: + - /node20217:/node20217:rw,rshared + - ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }} steps: - - uses: actions/checkout@v3 - - name: Setup container environment if: matrix.container run: | apt-get -y update - apt-get -y install sudo python3 git g++ + apt-get -y install sudo python3 git g++ curl + if [[ "${{matrix.container}}" == "ubuntu:1"* ]]; then + # Node 20 doesn't work with Ubuntu 16/18 glibc: https://github.com/actions/checkout/issues/1590 + curl -sL https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20217 + fi + + - uses: actions/checkout@v4 - name: Install packages if: matrix.install From 7c554ac79d73ba2ca5e91716ce596fc82ec5e829 Mon Sep 17 00:00:00 2001 From: Sam Darwin Date: Mon, 9 Dec 2024 15:55:30 -0700 Subject: [PATCH 08/42] docs: modify logo variable (#759) [ci skip] --- doc/_templates/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/_templates/layout.html b/doc/_templates/layout.html index 17281c7352..59c30e401f 100644 --- a/doc/_templates/layout.html +++ b/doc/_templates/layout.html @@ -90,7 +90,7 @@

C++ Boost

+ alt="C++ Boost" src="{{ pathto('_static/' + 'gil.png', 1) }}" border="0"> From f018ebf79bcab2e56d988ce41b7375d361dab0f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=81oskot?= Date: Tue, 7 Jan 2025 15:38:18 +0100 Subject: [PATCH 09/42] chore: Remove executable bit from .cpp files [ci skip] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref https://github.com/boostorg/admin/issues/47#issuecomment-2575165830 Signed-off-by: Mateusz Łoskot --- test/core/image_processing/lanczos_scaling.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 test/core/image_processing/lanczos_scaling.cpp diff --git a/test/core/image_processing/lanczos_scaling.cpp b/test/core/image_processing/lanczos_scaling.cpp old mode 100755 new mode 100644 From dc07bcadcd7183172c0cbaa98d59c501b050f479 Mon Sep 17 00:00:00 2001 From: Samuel Debionne Date: Fri, 4 Apr 2025 16:33:23 +0200 Subject: [PATCH 10/42] fix is_floating_point: symbol is not a class template --- include/boost/gil/io/typedefs.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/gil/io/typedefs.hpp b/include/boost/gil/io/typedefs.hpp index 8f331ed23f..b7d93bdf20 100644 --- a/include/boost/gil/io/typedefs.hpp +++ b/include/boost/gil/io/typedefs.hpp @@ -29,7 +29,7 @@ using byte_vector_t = std::vector; }} // namespace boost::gil -namespace boost { +namespace std { template<> struct is_floating_point : std::true_type {}; template<> struct is_floating_point : std::true_type {}; From dc89ecd065ce108f9693f5228731221916e641c2 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Fri, 4 Apr 2025 19:00:12 +0200 Subject: [PATCH 11/42] ci: move Ubuntu 20.04 builds to container or newer Ubuntu version The Ubuntu 20.04 image on GitHub Actions will be unavailable by 2025-04-15. See for more information on the deprecation and removal. Therefore all build jobs that use the Ubuntu 20.04 runner image of GHA have to be either migrated to a newer runner image (if the compiler version is available on a newer image) or have to be moved to Docker containers using Ubuntu 20.04 (if the compiler version is not available on the newer runner images). And that's what this change tries to do. --- .github/workflows/ci.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3c256f311..b806252ed3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,18 +29,20 @@ jobs: - toolset: gcc-7 cxxstd: "14,17" install: g++-7 - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 - toolset: gcc-8 cxxstd: "14" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: g++-8 - toolset: gcc-9 cxxstd: "14,17" - os: ubuntu-20.04 + os: ubuntu-24.04 install: g++-9 - toolset: gcc-10 cxxstd: "14,17" - os: ubuntu-20.04 + os: ubuntu-24.04 install: g++-10 - toolset: clang compiler: clang++-3.9 @@ -63,27 +65,33 @@ jobs: - toolset: clang compiler: clang++-6.0 cxxstd: "14,17" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: clang-6.0 - toolset: clang compiler: clang++-7 cxxstd: "14,17" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: clang-7 - toolset: clang compiler: clang++-8 cxxstd: "14,17" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: clang-8 - toolset: clang compiler: clang++-9 cxxstd: "14,17" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 install: clang-9 - toolset: clang compiler: clang++-10 cxxstd: "14,17" - os: ubuntu-20.04 + os: ubuntu-latest + container: ubuntu:20.04 + install: clang-10 - toolset: clang cxxstd: "14,17" os: macos-13 From dcce96467ab6bddfa4fcfb1f4c91e2df40174861 Mon Sep 17 00:00:00 2001 From: ckormanyos Date: Fri, 18 Apr 2025 19:41:10 +0200 Subject: [PATCH 12/42] Propose repair for issue 763 --- include/boost/gil/io/typedefs.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/gil/io/typedefs.hpp b/include/boost/gil/io/typedefs.hpp index b7d93bdf20..b906c9d81d 100644 --- a/include/boost/gil/io/typedefs.hpp +++ b/include/boost/gil/io/typedefs.hpp @@ -31,8 +31,8 @@ using byte_vector_t = std::vector; namespace std { -template<> struct is_floating_point : std::true_type {}; -template<> struct is_floating_point : std::true_type {}; +template<> struct is_floating_point<::boost::gil::float32_t> : std::true_type {}; +template<> struct is_floating_point<::boost::gil::float64_t> : std::true_type {}; } // namespace boost From 2956a0e9ef71f5c4f3163c8b8d675679e0fbaaff Mon Sep 17 00:00:00 2001 From: AnonymousPC Date: Thu, 3 Jul 2025 01:11:11 +0800 Subject: [PATCH 13/42] fix compile error on clang --- include/boost/gil/algorithm.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/gil/algorithm.hpp b/include/boost/gil/algorithm.hpp index 2b61068830..f09ddabd4a 100644 --- a/include/boost/gil/algorithm.hpp +++ b/include/boost/gil/algorithm.hpp @@ -1238,7 +1238,7 @@ struct inner_product_k_t BinaryOperation2 binary_op2) { init = binary_op1(init, binary_op2(*first1, *first2)); - return inner_product_k_t::template apply( + return inner_product_k_t::apply( first1 + 1, first2 + 1, init, binary_op1, binary_op2); } }; @@ -1285,7 +1285,7 @@ T inner_product_k( BinaryOperation1 binary_op1, BinaryOperation2 binary_op2) { - return detail::inner_product_k_t::template apply( + return detail::inner_product_k_t::apply( first1, first2, init, binary_op1, binary_op2); } From b438f7e813388b667903f5867fd22c09b3d9fadd Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Thu, 31 Jul 2025 18:11:31 +0200 Subject: [PATCH 14/42] ci: move GitHub Action's Windows builds to supported OS version The Windows Server 2019 runner image has been removed as of 2025-06-30, so it's not available anymore. For further information on that see . However, we can test on the newer Windows Server 2022 image instead. Unfortunately, the Windows Server 2019 image was the last one to have Visual Studio 2019, so from now on only Visual Studio 2022 can be used in the CI workflows for MSVC. --- .github/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b806252ed3..123c7acec9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,14 +156,10 @@ jobs: fail-fast: false matrix: include: - - toolset: msvc-14.2 - cxxstd: "14,17" - addrmd: 32,64 - os: windows-2019 - toolset: gcc cxxstd: "14,17" addrmd: 64 - os: windows-2019 + os: windows-2022 - toolset: msvc-14.3 cxxstd: "14,17" addrmd: 32,64 From df5f3f80a42edef34ac27a2305e148d28944a428 Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Thu, 31 Jul 2025 19:35:24 +0200 Subject: [PATCH 15/42] ci: add jobs for newer GCC versions --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b806252ed3..8ffe36ce08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,32 @@ jobs: cxxstd: "14,17" os: ubuntu-24.04 install: g++-10 + - toolset: gcc + compiler: g++-11 + cxxstd: "14,17" + os: ubuntu-24.04 + install: g++-11 + - toolset: gcc + compiler: g++-12 + cxxstd: "14,17,20" + os: ubuntu-24.04 + install: g++-12 + - toolset: gcc + compiler: g++-13 + cxxstd: "14,17,20" + os: ubuntu-24.04 + install: g++-13 + - toolset: gcc + compiler: g++-14 + cxxstd: "14,17,20" + os: ubuntu-24.04 + install: g++-14 + - toolset: gcc + compiler: g++-15 + cxxstd: "14,17,20" + os: ubuntu-latest + container: ubuntu:25.04 + install: g++-15 - toolset: clang compiler: clang++-3.9 cxxstd: "14" From c3435314a1f67cfb2f76422fab2ba07efe58080c Mon Sep 17 00:00:00 2001 From: Dirk Stolle Date: Sun, 3 Aug 2025 19:55:07 +0200 Subject: [PATCH 16/42] ci: add newer Clang versions --- .github/workflows/ci.yml | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc5a86e152..ffd050fd23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,6 +118,58 @@ jobs: os: ubuntu-latest container: ubuntu:20.04 install: clang-10 + - toolset: clang + compiler: clang++-11 + cxxstd: "14,17,20" + os: ubuntu-22.04 + install: clang-11 + - toolset: clang + compiler: clang++-12 + cxxstd: "14,17,20" + os: ubuntu-22.04 + install: clang-12 + - toolset: clang + compiler: clang++-13 + cxxstd: "14,17,20" + os: ubuntu-22.04 + install: clang-13 + - toolset: clang + compiler: clang++-14 + cxxstd: "14,17,20" + os: ubuntu-24.04 + install: clang-14 + - toolset: clang + compiler: clang++-15 + cxxstd: "14,17,20" + os: ubuntu-24.04 + install: clang-15 + - toolset: clang + compiler: clang++-16 + cxxstd: "14,17,20" + os: ubuntu-24.04 + install: clang-16 + - toolset: clang + compiler: clang++-17 + cxxstd: "14,17,20" + os: ubuntu-latest + container: ubuntu:24.04 + install: clang-17 + - toolset: clang + compiler: clang++-18 + cxxstd: "14,17,20,23" + os: ubuntu-24.04 + install: clang-18 + - toolset: clang + compiler: clang++-19 + cxxstd: "14,17,20,23" + os: ubuntu-24.04 + install: clang-19 + - toolset: clang + compiler: clang++-20 + cxxstd: "14,17,20,23" + os: ubuntu-latest + container: ubuntu:25.04 + install: clang-20 - toolset: clang cxxstd: "14,17" os: macos-13 From 06c421ae74062bfa112dc3bacaef7746a85467d2 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 25 Aug 2025 17:26:19 +0200 Subject: [PATCH 17/42] Update Link to regression test matrix in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b46d70a57d..78cc875f70 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ Documentation | GitHub Actions | AppVeyor | Regression | Codecov --------------|----------------|----------|------------|---------- -[![develop](https://img.shields.io/badge/doc-develop-blue.svg)](https://boostorg.github.io/gil/develop/) | [![GitHub Actions](https://github.com/boostorg/gil/workflows/CI/badge.svg?branch=develop)](https://github.com/boostorg/gil/actions?query=branch:develop) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/w4k19d8io2af168h/branch/develop?svg=true)](https://ci.appveyor.com/project/stefanseefeld/gil/branch/develop) | [![gil](https://img.shields.io/badge/gil-develop-blue.svg)](http://www.boost.org/development/tests/develop/developer/gil.html) | [![codecov](https://codecov.io/gh/boostorg/gil/branch/develop/graphs/badge.svg)](https://app.codecov.io/gh/boostorg/gil/branch/develop) -[![master](https://img.shields.io/badge/doc-master-blue.svg)](https://boostorg.github.io/gil/) | [![GitHub Actions](https://github.com/boostorg/gil/workflows/CI/badge.svg?branch=master)](https://github.com/boostorg/gil/actions?query=branch:master) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/w4k19d8io2af168h?svg=true)](https://ci.appveyor.com/project/stefanseefeld/gil/branch/master) | [![gil](https://img.shields.io/badge/gil-master-blue.svg)](http://www.boost.org/development/tests/master/developer/gil.html) | [![codecov](https://codecov.io/gh/boostorg/gil/branch/master/graphs/badge.svg)](https://app.codecov.io/gh/boostorg/gil/branch/master) +[![develop](https://img.shields.io/badge/doc-develop-blue.svg)](https://boostorg.github.io/gil/develop/) | [![GitHub Actions](https://github.com/boostorg/gil/workflows/CI/badge.svg?branch=develop)](https://github.com/boostorg/gil/actions?query=branch:develop) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/w4k19d8io2af168h/branch/develop?svg=true)](https://ci.appveyor.com/project/stefanseefeld/gil/branch/develop) | [![gil](https://img.shields.io/badge/gil-develop-blue.svg)](https://regression.boost.io/develop/developer/gil.html) | [![codecov](https://codecov.io/gh/boostorg/gil/branch/develop/graphs/badge.svg)](https://app.codecov.io/gh/boostorg/gil/branch/develop) +[![master](https://img.shields.io/badge/doc-master-blue.svg)](https://boostorg.github.io/gil/) | [![GitHub Actions](https://github.com/boostorg/gil/workflows/CI/badge.svg?branch=master)](https://github.com/boostorg/gil/actions?query=branch:master) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/w4k19d8io2af168h?svg=true)](https://ci.appveyor.com/project/stefanseefeld/gil/branch/master) | [![gil](https://img.shields.io/badge/gil-master-blue.svg)](https://regression.boost.io/master/developer/gil.html) | [![codecov](https://codecov.io/gh/boostorg/gil/branch/master/graphs/badge.svg)](https://app.codecov.io/gh/boostorg/gil/branch/master) # Boost.GIL From e2882c3b5f2eea0df1fc33305ba8489bf185119c Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 19:32:55 +0200 Subject: [PATCH 18/42] Update installation.rst --- doc/installation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/installation.rst b/doc/installation.rst index 41b910d3cd..716cfc7e1d 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -24,7 +24,7 @@ compiler with complete C++14 support. .. note:: - Boost.GIL requires C++14 compiler since ince Boost 1.80. + Boost.GIL requires C++14 compiler since Boost 1.80. For the actual list of currently tested compilers, check results of the library CI builds linked from the `README.md `_ From 817f0399786e17f418b7d0137dbdcd0815014c4d Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 19:38:11 +0200 Subject: [PATCH 19/42] Update histogram.rst --- doc/tutorial/histogram.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/tutorial/histogram.rst b/doc/tutorial/histogram.rst index 0701c5a857..582eb432e0 100644 --- a/doc/tutorial/histogram.rst +++ b/doc/tutorial/histogram.rst @@ -6,7 +6,7 @@ Tutorial: Histogram :depth: 1 This is a short tutorial presenting an example of a very simple sample of code -from an existing code base that calculates histogram of an image. +from an existing code base that calculates the histogram of an image. Next, the program is rewritten using GIL features. Original implementation @@ -58,7 +58,7 @@ GIL implementation grayimage_histogram(color_converted_view(img),hist); } -Using the Boost.Lambda library (or C++11 lambda) features it can written +Using the Boost.Lambda library (or C++11 lambda) features it can be written even simpler: .. code-block:: cpp From 8994e3c73e59395c2d35880f472983d2a3475202 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 20:47:20 +0200 Subject: [PATCH 20/42] Update gradient.rst --- doc/tutorial/gradient.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/tutorial/gradient.rst b/doc/tutorial/gradient.rst index 8d44d3ff2f..f1dabc9d0c 100644 --- a/doc/tutorial/gradient.rst +++ b/doc/tutorial/gradient.rst @@ -114,7 +114,7 @@ given location and we set it to the half-difference of its left and right neighbors. ``operator()`` returns a reference to a grayscale pixel. A grayscale pixel is convertible to its channel type (``unsigned char`` for ``src``) and it can be copy-constructed from a channel. -(This is only true for grayscale pixels). +(This is only true for grayscale pixels.) While the above code is easy to read, it is not very fast, because the binary ``operator()`` computes the location of the pixel in a 2D grid, which involves @@ -308,7 +308,7 @@ second one is mutable and that their color spaces are compatible GIL does not require using its own built-in constructs. You are free to use your own channels, color spaces, iterators, locators, views and images. However, to work with the rest of GIL they have to satisfy a -set of requirements; in other words, they have to \e model the +set of requirements; in other words, they have to \emph model the corresponding GIL *concept*. GIL's concepts are defined in the user guide. @@ -602,7 +602,7 @@ instead of references to pixels, pass to the generic function pixel locators. This allows for more powerful functions that can use the pixel neighbors through the passed locators. GIL algorithms iterate through the pixels using the more efficient two nested loops (as -opposed to the single loop using 1-D iterators) +opposed to the single loop using 1-D iterators). Color Conversion ---------------- @@ -610,7 +610,7 @@ Color Conversion Instead of computing the gradient of each color plane of an image, we often want to compute the gradient of the luminosity. In other words, we want to convert the color image to grayscale and compute the -gradient of the result. Here how to compute the luminosity gradient of +gradient of the result. Here is how to compute the luminosity gradient of a 32-bit float RGB image: .. code-block:: cpp @@ -866,7 +866,7 @@ view transformation functions also work with run-time instantiated image views and binary algorithms, such as ``copy_pixels`` can have either or both arguments be variants. -Lets make our ``x_luminosity_gradient`` algorithm take a variant image +Let's make our ``x_luminosity_gradient`` algorithm take a variant image view. For simplicity, let's assume that only the source view can be a variant. As an example of using multiple variants, see GIL's image view algorithm overloads taking multiple variants. @@ -952,7 +952,7 @@ view, whereas for image variants it returns a view variant. For example, the return type of ``view(runtime_image)`` is ``any_image_view`` where ``Views`` enumerates four views corresponding to the four image types. ``const_view(runtime_image)`` -returns a ``any_image_view`` of the four read-only view types, etc. +returns an ``any_image_view`` of the four read-only view types, etc. A warning about using variants: instantiating an algorithm with a variant effectively instantiates it with every possible type the From a5286447401bf3c43e48341d8faf336c4c699f94 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 20:51:01 +0200 Subject: [PATCH 21/42] Update naming.rst --- doc/naming.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/naming.rst b/doc/naming.rst index 509f70d351..08f74487fc 100644 --- a/doc/naming.rst +++ b/doc/naming.rst @@ -17,7 +17,7 @@ where: For example, ``rgb``, ``bgr``, ``cmyk``, ``rgba``. - ``BitDepth`` indicates the bit depth of the color channel. - For example, ``8``,``16``,``32``. + For example, ``8``, ``16``, ``32``. - By default, type of channel is unsigned integral. The ``s`` tag indicates signed integral. @@ -29,14 +29,14 @@ where: - ``_planar`` indicates planar organization (as opposed to interleaved). - ``_step`` indicates special image views, locators and iterators which - traverse the data in non-trivial way. For example, backwards or every other + traverse the data in a non-trivial way. For example, backwards or every other pixel. - ``ClassType`` is ``_image`` (image), ``_view`` (image view), ``_loc`` (pixel 2D locator) ``_ptr`` (pixel iterator), ``_ref`` (pixel reference), ``_pixel`` (pixel value). -- ``_t`` suffix indicaes it is a name of a type. +- ``_t`` suffix indicates it is a name of a type. For example: From f31aab3f6410751f01e75f38ac1b21f89a35dc9d Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 21:04:16 +0200 Subject: [PATCH 22/42] Update channel.rst --- doc/design/channel.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/design/channel.rst b/doc/design/channel.rst index bbcc025fea..75608c3f78 100644 --- a/doc/design/channel.rst +++ b/doc/design/channel.rst @@ -26,7 +26,7 @@ value. GIL channels model the following concept: static const bool is_mutable; // use channel_traits::is_mutable to access it static T min_value(); // use channel_traits::min_value to access it - static T max_value(); // use channel_traits::min_value to access it + static T max_value(); // use channel_traits::max_value to access it }; concept MutableChannelConcept : Swappable, Assignable {}; @@ -182,7 +182,7 @@ transformation between the ranges of the source and destination channel. It maps precisely the minimum to the minimum and the maximum to the maximum. (For example, to convert from uint8_t to uint16_t GIL does not do a bit shift because it will not properly match the maximum values. Instead GIL multiplies -the source by 257). +the source by 257.) All channel models that GIL provides are convertible from/to an integral or floating point type. Thus they support arithmetic operations. Here are the From 5a66d23e3455c9c12001ee12736d8ff19e978aff Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 21:56:22 +0200 Subject: [PATCH 23/42] Update pixel_locator.rst --- doc/design/pixel_locator.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/design/pixel_locator.rst b/doc/design/pixel_locator.rst index dfad531e90..30eb263c4a 100644 --- a/doc/design/pixel_locator.rst +++ b/doc/design/pixel_locator.rst @@ -177,7 +177,7 @@ GIL provides two models of ``PixelLocatorConcept`` - a memory-based locator, The ``memory_based_2d_locator`` is a locator over planar or interleaved images that have their pixels in memory. It takes a model of ``StepIteratorConcept`` over pixels as a template parameter. (When instantiated with a model of -``MutableStepIteratorConcept``, it models ``MutablePixelLocatorConcept``). +``MutableStepIteratorConcept``, it models ``MutablePixelLocatorConcept``.) .. code-block:: cpp @@ -200,7 +200,7 @@ choices: - ``pixel*`` - for interleaved images - ``planar_pixel_iterator`` - for planar images - ``memory_based_step_iterator*>`` - for interleaved images with - non-standard step) + non-standard step - ``memory_based_step_iterator >`` - for planar images with non-standard step @@ -223,7 +223,7 @@ a 2D pixel locator, as the diagram indicates: The ``memory_based_2d_locator`` also offers `cached_location_t` as mechanism to store relative locations for optimized repeated access of neighborhood pixels. The 2D coordinates of relative locations are cached as 1-dimensional -raw byte offsets. This provides efficient access if a neighboring locations +raw byte offsets. This provides efficient access if neighboring locations relative to a given locator are read or written frequently (e.g. in filters). The ``virtual_2d_locator`` is a locator that is instantiated with a function @@ -299,5 +299,5 @@ row. For fast operations, such as pixel copy, this second check adds about GIL overrides some STL algorithms, such as ``std::copy`` and ``std::fill``, when invoked with ``iterator_from_2d``-s, to go through each row using their base x-iterators, and, if the image has no padding (i.e. -``iterator_from_2d::is_1d_traversable()`` returns true) to simply iterate +``iterator_from_2d::is_1d_traversable()`` returns true), to simply iterate using the x-iterators directly. From 9af3cc512ca8d9ce51eae71c2fd95e7e2e4c1c56 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 22:14:33 +0200 Subject: [PATCH 24/42] Update image_view.rst --- doc/design/image_view.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/design/image_view.rst b/doc/design/image_view.rst index c40d2ab859..9a82c30c89 100644 --- a/doc/design/image_view.rst +++ b/doc/design/image_view.rst @@ -165,7 +165,7 @@ Models GIL provides a model for ``ImageViewConcept`` called ``image_view``. It is templated over a model of ``PixelLocatorConcept``. (If instantiated with a model of ``MutablePixelLocatorConcept``, it models -``MutableImageViewConcept``). Synopsis: +``MutableImageViewConcept``.) Synopsis: .. code-block:: cpp @@ -183,7 +183,7 @@ model of ``MutablePixelLocatorConcept``, it models }; Image views are lightweight objects. A regular interleaved view is typically -16 bytes long - two integers for the width and height (inside dimensions) one +16 bytes long - two integers for the width and height (inside dimensions), one for the number of bytes between adjacent rows (inside the locator) and one pointer to the beginning of the pixel block. @@ -253,7 +253,7 @@ to get the derived types: typedef ... type; }; -GIL Provides the following view transformations: +GIL provides the following view transformations: .. code-block:: cpp From 9aafcd3a0f35a25904ba96817612c3156c42856e Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 22:16:58 +0200 Subject: [PATCH 25/42] Update image.rst --- doc/design/image.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/design/image.rst b/doc/design/image.rst index d62ac2eecd..d1451ee75e 100644 --- a/doc/design/image.rst +++ b/doc/design/image.rst @@ -8,7 +8,7 @@ Image Overview -------- -An image is a container that owns the pixels of a given image view +An image is a container that owns the pixels of a given image view. It allocates them in its constructor and deletes them in the destructor. It has a deep assignment operator and copy constructor. Images are used rarely, just when data ownership is important. Most STL algorithms operate on From f7e26345dba124ec85968b5ba0ec51102f066003 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 22:30:53 +0200 Subject: [PATCH 26/42] Update metafunctions.rst --- doc/design/metafunctions.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/design/metafunctions.rst b/doc/design/metafunctions.rst index 21a9a55bda..92d6a03a09 100644 --- a/doc/design/metafunctions.rst +++ b/doc/design/metafunctions.rst @@ -19,7 +19,7 @@ They follow this pattern:: where *ColorSpace* also indicates the ordering of components. Examples are ``rgb``, ``bgr``, ``cmyk``, ``rgba``. *BitDepth* can be, for -example, ``8``,``16``,``32``. By default the bits are unsigned integral type. +example, ``8``, ``16``, ``32``. By default the bits are unsigned integral type. Append ``s`` to the bit depth to indicate signed integral, or ``f`` to indicate floating point. ``c`` indicates object whose associated pixel reference is immutable. ``_planar`` indicates planar organization (as opposed @@ -33,9 +33,9 @@ Here are examples: .. code-block:: cpp bgr8_image_t i; // 8-bit unsigned (unsigned char) interleaved BGR image - cmyk16_pixel_t; x; // 16-bit unsigned (unsigned short) CMYK pixel value; - cmyk16sc_planar_ref_t p(x); // const reference to a 16-bit signed integral (signed short) planar CMYK pixel x. - rgb32f_planar_step_ptr_t ii; // step iterator to a floating point 32-bit (float) planar RGB pixel. + cmyk16_pixel_t; x; // 16-bit unsigned (unsigned short) CMYK pixel value + cmyk16sc_planar_ref_t p(x); // const reference to a 16-bit signed integral (signed short) planar CMYK pixel x + rgb32f_planar_step_ptr_t ii; // step iterator to a floating point 32-bit (float) planar RGB pixel Homogeneous memory-based images ------------------------------- From c2b27ceee8f15a8e0d0decc824daddbe63676d44 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 22:47:59 +0200 Subject: [PATCH 27/42] Update examples.rst --- doc/design/examples.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/design/examples.rst b/doc/design/examples.rst index c64ad74e22..a8d2ad4415 100644 --- a/doc/design/examples.rst +++ b/doc/design/examples.rst @@ -116,7 +116,7 @@ is how to simplify this code using the ``copy_pixels`` algorithm: } (Note also that ``image::recreate`` is more efficient than ``operator=``, as -the latter will do an unnecessary copy construction). Not only does the above +the latter will do an unnecessary copy construction.) Not only does the above example work for planar and interleaved images of any color space and pixel depth; it is also optimized. GIL overrides ``std::copy`` - when called on two identical interleaved images with no padding at the end of rows, it simply @@ -124,7 +124,7 @@ does a ``memmove``. For planar images it does ``memmove`` for each channel. If one of the images has padding, (as in our case) it will try to do ``memmove`` for each row. When an image has no padding, it will use its lightweight horizontal iterator (as opposed to the more complex 1D image -iterator that has to check for the end of rows). It choses the fastest method, +iterator that has to check for the end of rows). It chooses the fastest method, taking into account both static and run-time parameters. Histogram From fa2cbf4d45d9424598d030be7595be407d539dc8 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 22:55:59 +0200 Subject: [PATCH 28/42] Update extending.rst --- doc/design/extending.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/design/extending.rst b/doc/design/extending.rst index 88669b894d..8870eb8d38 100644 --- a/doc/design/extending.rst +++ b/doc/design/extending.rst @@ -161,6 +161,6 @@ from the source view: (The actual color convert view transformation is slightly more complicated, as it takes an optional color conversion object, which -allows users to specify their own color conversion methods). See the +allows users to specify their own color conversion methods.) See the GIL tutorial for an example of creating a virtual image view that defines the Mandelbrot set. From 3851f768149c7e6bed7ce0bc64c5f83c0299d3bb Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 23:04:25 +0200 Subject: [PATCH 29/42] Update basics.rst --- doc/image_processing/basics.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/image_processing/basics.rst b/doc/image_processing/basics.rst index bbec6271cf..15ff3546ba 100644 --- a/doc/image_processing/basics.rst +++ b/doc/image_processing/basics.rst @@ -18,7 +18,7 @@ Filters, kernels, weights Those three words usually mean the same thing, unless context is clear about a different usage. Simply put, they are matrices, that are used to -achieve certain effects on the image. Lets consider a simple one, 3 by 3 +achieve certain effects on the image. Let's consider a simple one, 3 by 3 Scharr filter ``ScharrX = [1,0,-1][1,0,-1][1,0,-1]`` @@ -46,9 +46,9 @@ Curvature The word, when used alone, will mean the curvature that would be generated if values of an image would be plotted in 3D graph. X and Z -axises (which form horizontal plane) will correspond to X and Y indices +axes (which form horizontal plane) will correspond to X and Y indices of an image, and Y axis will correspond to value at that pixel. By -little stretch of an imagination, filters (another names are kernels, +little stretch of an imagination, filters (other names are kernels, weights) could be considered an image (or any 2D matrix). A mean filter would draw a flat plane, whereas Gaussian filter would draw a hill that -gets sharper depending on it's sigma value. +gets sharper depending on its sigma value. From b262e06cda8b6060eaa3759757da4c0a2052391c Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 23:09:21 +0200 Subject: [PATCH 30/42] Update affine-region-detectors.rst --- doc/image_processing/affine-region-detectors.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/image_processing/affine-region-detectors.rst b/doc/image_processing/affine-region-detectors.rst index 3ecb69aaee..ab7d1ccc72 100644 --- a/doc/image_processing/affine-region-detectors.rst +++ b/doc/image_processing/affine-region-detectors.rst @@ -28,7 +28,7 @@ Algorithm steps Harris and Hessian ^^^^^^^^^^^^^^^^^^ -Both are derived from a concept called Moravec window. Lets have a look +Both are derived from a concept called Moravec window. Let's have a look at the image below: .. figure:: ./Moravec-window-corner.png @@ -37,7 +37,7 @@ at the image below: Moravec window corner case As can be noticed, moving the yellow window in any direction will cause -very big change in intensity. Now, lets have a look at the edge case: +very big change in intensity. Now, let's have a look at the edge case: .. figure:: ./Moravec-window-edge.png :alt: Moravec window edge case @@ -54,7 +54,7 @@ The algorithms have the same structure: 1. Compute image derivatives -2. Compute Weighted sum +2. Compute weighted sum 3. Compute response @@ -103,7 +103,7 @@ Harris it will be in order of 100000000 and for Hessian will be in order of 10000. For simpler images values in order of 100s and 1000s should be enough. The numbers assume ``uint8_t`` gray image. -To get deeper explanation please refer to following **paper**: +To get a deeper explanation please refer to the following **papers**: `Harris, Christopher G., and Mike Stephens. "A combined corner and edge detector." In Alvey vision conference, vol. 15, no. 50, pp. 10-5244. From f2ede74c87be8227f50e7473ff3a7b66cbb78a8a Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 23:11:49 +0200 Subject: [PATCH 31/42] Update overview.rst --- doc/image_processing/contrast_enhancement/overview.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/image_processing/contrast_enhancement/overview.rst b/doc/image_processing/contrast_enhancement/overview.rst index 4677055112..66c6933894 100644 --- a/doc/image_processing/contrast_enhancement/overview.rst +++ b/doc/image_processing/contrast_enhancement/overview.rst @@ -3,7 +3,7 @@ Overview Contrast Enhancement is a significant part of image processing algorithms. Too dark or too light images don't look good to the human eyes. Hence while the primary focus of these -algorithms is to enhance visual beauty, some applications of this in medical research is also +algorithms is to enhance visual beauty, some applications of this in medical research are also prevalent. We have a few contrast enhancement algorithms in the GIL image processing suite as well. From bc9307bb20777d7f5994e94ffd0d5be965d281b4 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 23:13:36 +0200 Subject: [PATCH 32/42] Update overview.rst --- doc/image_processing/contrast_enhancement/overview.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/image_processing/contrast_enhancement/overview.rst b/doc/image_processing/contrast_enhancement/overview.rst index 66c6933894..aa7d2a13e7 100644 --- a/doc/image_processing/contrast_enhancement/overview.rst +++ b/doc/image_processing/contrast_enhancement/overview.rst @@ -7,7 +7,7 @@ algorithms is to enhance visual beauty, some applications of this in medical res prevalent. We have a few contrast enhancement algorithms in the GIL image processing suite as well. -These include : +These include: #. :ref:`he` #. :ref:`hm` #. :ref:`ahe` From aaab5fe11fdefd201b7bd3d3141cd3f4a901cc97 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 23:20:41 +0200 Subject: [PATCH 33/42] Update overview.rst --- doc/histogram/overview.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/histogram/overview.rst b/doc/histogram/overview.rst index 8b222659e8..cb2d045601 100644 --- a/doc/histogram/overview.rst +++ b/doc/histogram/overview.rst @@ -9,7 +9,7 @@ Description ----------- The histogram class is built on top of std::unordered_map to keep it compatible with other -STL algorithms. It can support any number of axes (known at compile time i.e. during class +STL algorithms. It can support any number of axes (known at compile time, i.e. during class instantiation). Suitable conversion routines from GIL image constructs to the histogram bin key are shipped with the class itself. From 30441b56b59afdd04565a207111d70a785d30472 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Tue, 26 Aug 2025 23:22:29 +0200 Subject: [PATCH 34/42] Update extend.rst --- doc/histogram/extend.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/histogram/extend.rst b/doc/histogram/extend.rst index 3197af7841..4a9393791a 100644 --- a/doc/histogram/extend.rst +++ b/doc/histogram/extend.rst @@ -10,8 +10,8 @@ Extending the class User defined Axes ----------------- -In case you need a histogram with an axes of an arbitrary type that is not identified by -the C++ Standard Library, you need to provide a overload for the hashing function that is +In case you need a histogram with an axis of an arbitrary type that is not identified by +the C++ Standard Library, you need to provide an overload for the hashing function that is used in the histogram class. GIL's histogram class uses ``boost::hash_combine`` in a sub routine to generate a hash from @@ -47,14 +47,14 @@ For example, let's consider you need a histogram with an axis over class Test. } } -Now lets get to the usage example. +Now let's get to the usage example. .. code-block:: cpp #include #include #include - // Mind the order of include i.e. test.hpp before boost/gil.hpp + // Mind the order of include, i.e. test.hpp before boost/gil.hpp using namespace boost::gil; From ba1b528977f0301f75eb2b3653e4795709867702 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Wed, 27 Aug 2025 00:12:11 +0200 Subject: [PATCH 35/42] Update io.rst --- doc/io.rst | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/io.rst b/doc/io.rst index 6f47371675..cbf864c947 100644 --- a/doc/io.rst +++ b/doc/io.rst @@ -76,7 +76,7 @@ then the above call would look as follows:: ); The image_read_settings class will provide the user with image format -independent reading setting but can also serves as a pointer for format +independent reading setting but can also serve as a pointer for format dependent settings. Please see the specific image format sections [link gil.io.using_io.supported_image_formats Supported Image Formats] @@ -151,7 +151,7 @@ Reading and writing in-memory buffers are supported as well. See as follows:: write_view( out, view( dst ), tiff_tag() ); In case the user is using his own stream classes he has to make sure it -has the common interface read, write, seek, close, etc. Interface. +has the common interface read, write, seek, close, etc. interface. Using IO -------- @@ -218,11 +218,11 @@ The second parameter is either an image or view type depending on the The third and last parameter is either an instance of the ``image_read_settings`` or just the ``FormatTag``. The settings can be various depending on the format which is being read. -But the all share settings for reading a partial image area. +But they all share settings for reading a partial image area. The first point describes the top left image coordinate whereas the second are the dimensions in x and y directions. -Here an example of setting up partial read:: +Here is an example of setting up partial read:: read_image( filename , img @@ -312,14 +312,14 @@ unless ``BOOST_GIL_IO_USE_BOOST_FILESYSTEM`` macro is defined that forces preference of the Boost.Filesystem. Devices could be ``FILE*``, ``std::ifstream``, and ``TIFF*`` for TIFF images. -The second parameter is an view object to image being written. +The second parameter is a view object to image being written. The third and last parameter is either a tag or an ``image_write_info`` object containing more settings. One example for instance is the JPEG quality. Refer to the format specific sections under 3.3. to have a list of all the possible settings. -Writing an any_image<...> is supported. See the following example:: +Writing an any_image<...> is supported. See the following example: any_image< gray8_image_t , gray16_image_t @@ -373,14 +373,14 @@ For a general overview of the BMP image file format go to the following BMP_Wiki_. Please note, the code has not been tested on X Windows System variations -of the BMP format which are usually referred to XBM and XPM formats. +of the BMP format which are usually referred to as XBM and XPM formats. Here, only the MS Windows and OS/2 format is relevant. Currently the code is able to read and write the following image types: -:Read: ``gray1_image_t``, ``gray4_image_t``, ``gray8_image_t``, ``rgb8_image_t`` and, ``rgba8_image_t`` -:Write: ``rgb8_image_t`` and, ``rgba8_image_t`` +:Read: ``gray1_image_t``, ``gray4_image_t``, ``gray8_image_t``, ``rgb8_image_t`` and ``rgba8_image_t`` +:Write: ``rgb8_image_t`` and ``rgba8_image_t`` The lack of having an indexed image type in gil restricts the current interface to only write out non-indexed images. @@ -408,7 +408,7 @@ Currently the code is able to read and write the following image types: Reading YCbCr or YCCK images is possible but might result in inaccuracies since both color spaces aren't available yet for gil. -For now these color space are read as rgb images. +For now these color spaces are read as rgb images. This is subject to change soon. PNG @@ -498,7 +498,7 @@ For a complete set of options please consult the following websites: The author of this extension is not claiming all tiff formats are supported. This extension is likely to be a moving target adding new features with each -new milestone. Here is an incomplete lists: +new milestone. Here is an incomplete list: * Multi-page TIFF - read only * Strip TIFF - read and write support @@ -521,8 +521,8 @@ straightforward. Before adding I would recommend to have a look at existing implementations and then trying to follow a couple of guidelines: * Create the following files for your new xxx format - * ``xxx_read.hpp`` - Only includes read code - * ``xxx_write.hpp`` - Only includes write code + * ``xxx_read.hpp`` - only includes read code + * ``xxx_write.hpp`` - only includes write code * ``xxx_all.hpp`` - includes xxx_read.hpp and xxx_write.hpp * Add the code to the ``boost::gil::detail`` namespace * Create a tag type for the new format. Like this:: @@ -530,13 +530,13 @@ implementations and then trying to follow a couple of guidelines: struct xxx_tag : format_tag {}; * Create the image_read_info for the new format. It contains all the - information that are necessary to read an image. It should be filled + information that is necessary to read an image. It should be filled and returned by the ``get_info`` member of the reader class. See below:: template<> struct image_read_info< xxx_tag > {}; * Create the image_write_info for the new format. It contains all the - information that are necessary to write an image:: + information that is necessary to write an image:: template<> struct image_write_info< xxx_tag > {}; From eff1fbabd88a73c035ddc71b8281e34cc4862020 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Wed, 27 Aug 2025 00:17:38 +0200 Subject: [PATCH 36/42] Update io.rst --- doc/io.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/io.rst b/doc/io.rst index cbf864c947..9dded96713 100644 --- a/doc/io.rst +++ b/doc/io.rst @@ -319,7 +319,7 @@ One example for instance is the JPEG quality. Refer to the format specific sections under 3.3. to have a list of all the possible settings. -Writing an any_image<...> is supported. See the following example: +Writing an any_image<...> is supported. See the following example:: any_image< gray8_image_t , gray16_image_t From 9d25fc0197e7f82a1bfc3c39e46c35930e7f5558 Mon Sep 17 00:00:00 2001 From: Samuel Debionne Date: Tue, 25 Nov 2025 21:40:19 +0100 Subject: [PATCH 37/42] ci: drop clang++=5 stdcxx=1z build variant --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffd050fd23..a7b4ae3304 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,7 +84,7 @@ jobs: install: clang-4.0 - toolset: clang compiler: clang++-5.0 - cxxstd: "14,1z" + cxxstd: "14" os: ubuntu-latest container: ubuntu:18.04 install: clang-5.0 From 3d8dcb68bf9e982a25576429db384015f2bf5786 Mon Sep 17 00:00:00 2001 From: Samuel Debionne Date: Tue, 25 Nov 2025 21:40:19 +0100 Subject: [PATCH 38/42] Omit pmr image tests on apple clang 15 --- test/core/image/test_fixture.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/core/image/test_fixture.hpp b/test/core/image/test_fixture.hpp index a7c95617ad..de3dc328aa 100644 --- a/test/core/image/test_fixture.hpp +++ b/test/core/image/test_fixture.hpp @@ -35,7 +35,12 @@ using image_types = std::tuple gil::rgba32_image_t >; -#if defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE) +// Workaround until we have the proper defect test in Boost.Config +#if defined(__APPLE__) && (__clang_major__ == 15) +#define BOOST_NO_CXX17_DEFAULT_RESOURCE +#endif + +#if defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE) || defined(BOOST_NO_CXX17_DEFAULT_RESOURCE) using pmr_image_types = std::tuple<>; #else using pmr_image_types = std::tuple From 82fb0899dd0145efe61b15838439034ef4c26400 Mon Sep 17 00:00:00 2001 From: Samuel Debionne Date: Tue, 25 Nov 2025 21:40:19 +0100 Subject: [PATCH 39/42] ci: drop deprecated macos 13 and add macos 14 and 15 --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7b4ae3304..fd8cd781a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -171,8 +171,11 @@ jobs: container: ubuntu:25.04 install: clang-20 - toolset: clang - cxxstd: "14,17" - os: macos-13 + cxxstd: "14,17,20" + os: macos-14 + - toolset: clang + cxxstd: "14,17,20" + os: macos-15 runs-on: ${{matrix.os}} container: From 8dc4f659a13dbd707b0d44b602166a4413012d26 Mon Sep 17 00:00:00 2001 From: Processor228 Date: Sat, 11 Oct 2025 00:27:06 +0300 Subject: [PATCH 40/42] Fix cases when png reader ended up in an infinite loop. #774 Additionally, throw exceptions directly, instead of handling errors by longjumps. Longjumps lead to segfaults under compiler optimizations. Besides, setjmp setups always ended up throwing exceptions, so why not throwing them right away instead? --- .../gil/extension/io/png/detail/read.hpp | 12 ------ .../io/png/detail/reader_backend.hpp | 37 ++++++++++--------- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/include/boost/gil/extension/io/png/detail/read.hpp b/include/boost/gil/extension/io/png/detail/read.hpp index 089caf9fe6..e49da4b88e 100644 --- a/include/boost/gil/extension/io/png/detail/read.hpp +++ b/include/boost/gil/extension/io/png/detail/read.hpp @@ -84,12 +84,6 @@ class reader< Device template< typename View > void apply( const View& view ) { - // guard from errors in the following functions - if (setjmp( png_jmpbuf( this->get_struct() ))) - { - io_error("png is invalid"); - } - // The info structures are filled at this point. // Now it's time for some transformations. @@ -237,12 +231,6 @@ class reader< Device > void read_rows( const View& view ) { - // guard from errors in the following functions - if (setjmp( png_jmpbuf( this->get_struct() ))) - { - io_error("png is invalid"); - } - using row_buffer_helper_t = detail::row_buffer_helper_view; using it_t = typename row_buffer_helper_t::iterator_t; diff --git a/include/boost/gil/extension/io/png/detail/reader_backend.hpp b/include/boost/gil/extension/io/png/detail/reader_backend.hpp index 3f49070f3b..793a8ab1dc 100644 --- a/include/boost/gil/extension/io/png/detail/reader_backend.hpp +++ b/include/boost/gil/extension/io/png/detail/reader_backend.hpp @@ -87,7 +87,7 @@ struct reader_backend< Device // was compiled with a compatible version of the library. REQUIRED get()->_struct = png_create_read_struct( PNG_LIBPNG_VER_STRING , nullptr // user_error_ptr - , nullptr // user_error_fn + , this_t::error_fn // user_error_fn , nullptr // user_warning_fn ); @@ -118,20 +118,6 @@ struct reader_backend< Device 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( get_struct() ))) - { - //free all of the memory associated with the png_ptr and info_ptr - png_destroy_read_struct( &get()->_struct - , &get()->_info - , nullptr - ); - - io_error( "png is invalid" ); - } - png_set_read_fn( get_struct() , static_cast< png_voidp >( &this->_io_dev ) , this_t::read_data @@ -625,13 +611,30 @@ struct reader_backend< Device protected: + static void error_fn( png_structrp _ + , png_const_charp error_message + ) + { + io_error(error_message); + } + 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 ); + auto check = static_cast(png_get_io_ptr(png_ptr) )->read( data + , length ); + if (check != length) + { + if (!check) { + png_error( png_ptr, "read error" ); + } else { + png_warning(png_ptr, "read less than required"); + /* prevent infinite looping in libpng */ + memset(data + check, 0, length - check); + } + } } static void flush( png_structp png_ptr ) From 628165368ff2cd4c17d213aab9f0845b0dc9be73 Mon Sep 17 00:00:00 2001 From: Processor228 Date: Fri, 5 Dec 2025 18:59:42 +0300 Subject: [PATCH 41/42] Provide testcase that shows the fix in action --- .../png/EdgeCases/invalid-last-tEXt-length.png | Bin 0 -> 3041 bytes test/extension/io/png/png_read_test.cpp | 14 ++++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 test/extension/io/images/png/EdgeCases/invalid-last-tEXt-length.png diff --git a/test/extension/io/images/png/EdgeCases/invalid-last-tEXt-length.png b/test/extension/io/images/png/EdgeCases/invalid-last-tEXt-length.png new file mode 100644 index 0000000000000000000000000000000000000000..45df133ecdf0bdb4f9a118fc45d166c7c78ad48e GIT binary patch literal 3041 zcmZ{mc{J2*8^?b#_A!L)q^y}RW6$m}%AS3Dgu&RCp|KW&BD+w@7A9drMakY+$G#`a zJl1Ss5DE$Jbk2L;bKdiw_mAuTp8NXVpYy%{xX-z-L{pPn%#6H@001!S>mkf3YW=6^ zDGPvB*ML$)$W_nW7yu%~03iAy0Q{n~qSpZ+7zO|v&H$kD900h``Hg036yt)6;VlGk z{wRHbK-n>%_3Z8f0HpIzQ9Xr1_$W;}jJ~lh-8vI96aVGU7N|Z7)D~fBi!n!r3Za7n z+`W8JLYQzgN+`?^4FGzHPp!4t@?hZR%}bH7Qqyc|kD?obOS?4)P^z{P5#tUmHW9-n zsGSx8dxpDww49&f_H2UIFxTp!c!E(JRpqVXofTJAmEP@&>Nqt^p2v&TUeD}v!PDQT z6TpKNc{r`B@gM9t=IJG3b$x3L46_Cld)ywl6idG_k`q6F`(BZ~F2e)J#Z`QL>?Nl* z8{@{(wQH6mnQeX`3ibuPe8gM1peKv`=KX!qeRru8%Aab}EBh7(C6k`y6>0dUAgAGCt2; zr9f@!MOkrdg*5s>1R5mep9$$wdpeK}VtD=|4aJq8vioGS7>ClE++tBdp$)Yr0%s%;%oZ&G#v|kaWeV zP6t%L&ob07x!r2g7WHv25DFSP%C5!V7!Q`dA zX>XZ|g5`e3R%)VxhLVRVbv%v4-rAl<7hxf^|7MBdV%xsb>RLIvvq)}Way_LKQl!PFf(0+Y6k zL6OY$S(X!Z2Tft^esS8goRO5J+~>bspVJjinf7=cZMh5TJWAJAG_RnE<-4HKO`e>&OnC=8$9iJD(~#Tu1V zgk{?h31L%BEa*Iwd56oOmH@hdD_Zcch~4=H*Vty5Fb=6dnwebhGm2vr>;`{jUc&|$ z+4bdSFgQ-|YKXxsLf=sVBhGAIvB+qPxnNJ~)`|YUvZUyp+8gt-mZDP;a5Ye?r^^;6 zIIZ^Tb_V%bV_!oBx zbDhq@^pY?cp7?mh%b`9oiVmMY9WNgfz`XVwtIFvg95C0?lI150(}-CkW;0p;DF1Jw_V&1h zkZWE`m@uL+?8Pv+X3dex1xB0qw!QZDMS8~OGU}pZY5s5ZZ`LpUP~r0U^1_-Q4DI)v zsa(I}NK)GWl0fzMZ5O=pd*Vv3G%x0Wt6W`<1Ec+$IXJ^4fYGtXK=4FSa?0^uY5l{1 zZ6lfCJY)?@?c&jZrIP`xtRb@d~D-@|MLXDg#klB0jd{3Y@BM8Yxzk~p}e zjYyBqHeFhWYgRIRJs_fjTdU7V9d;XS>k*4PBSl+{si4f!d%?PXQc!ViG8`W_^qOzX2( z=arTioh3|BuaNU4&pE;eR2|c_Mx@mepN=&b#NKX>sIrY4!FD4apUXW7pK&^W$*hk} zryliNi9ZMOfr6Z3kjJ^z(h2NC2qr~P}fQc8F9_B=l^^C>L7%Yu|P_c?Kr zLkAh4D6*=97`$rQ62+Pc7Tw*Xu2GJpd4leDCMmJeJJ{myZLo|lEc9~gMG|gu%aV=|oSBbx9M<{h9S$Uqs$A8daLORHU89yYdkU*J~)0p$Y_{7jg%HAH>^%_yWxO%uJaBiRMo;WtiE3yK?h^|%B~`>lM>c9zBFY_4f?lv zFV4EFet&*vVr+TFumX84Fhn(MpVgz9G2!%%$ynLiyYr8!?`>%~z;#s#mD4fO`wQwZ z>dN-!%YiD!2DQVT48Q!c1lvlHoGygc2$6O^yFXKEW%!;WJz?w%dM zC10{r-EKRp4h=lkLB<`LXxW>bMmVx@aa=T@iq`66m6uvx6koI^g$qg)b-9Ez-Pp8P z>qDhX*%*@f_~t@4{(^On`aMeZ(P%>Ff2+?3{Za0A`oL+g3RG~QXHf%kp5k_@VibVE z7b@)Mr@oEzl5-AsuC|LPr)l;mg?LMrkAn~(02B+_A#Je`&9!5SZ-Y>`pq6adhJ1*b z9?vUtd0ozR>dg-J-83nOu`2q8RQq&C&S?d19&|E-v?F;{knu$4>u62xIp6in>TD8; zz5cy5V{~WfQM;ff>|_F7u{R?xrTNkm2%BEpZe%tfs&%F>IbT>^VZTy=H)#HXv8{fy zUBEa=&0p z;Ic&B$#DGv{o^8w2LjPS;L$;&#^AzyEyZ_%2P znVW>U{p@wqoq_~%m9N{(lR(Q&xvArKhquZ~dKt(VECEbe+( zBbuocSIQ77iqW;jxFInp71tmXMF3ftth^K)E(Mpfgu_*2l~v$yC=8|ogGpUGss1m( zFTl;qJ^cRz4j3I~3Lx>H1dNv->MjOJnP&edMDE`q`Uuop3d8n?LA$xDXdk!=nB4pO zR35taNyKhgo%4|5y8dykhMOaw{JHXmAGXaR9AAj^4?zk^n4|pNP(i4mYs2A@4=85= NeO(j8o4=f6{{`8LecAv3 literal 0 HcmV?d00001 diff --git a/test/extension/io/png/png_read_test.cpp b/test/extension/io/png/png_read_test.cpp index 0217aa9d67..3788268b02 100644 --- a/test/extension/io/png/png_read_test.cpp +++ b/test/extension/io/png/png_read_test.cpp @@ -690,6 +690,19 @@ void test_gamma() // G25N3P04 - paletted, file-gamma = 2.50 test_file("G25N3P04.PNG"); } + +void test_invalid_png_read() +{ + auto test_read_and_convert = [](const std::string &path) { + gil::rgb8_image_t image; + gil::read_and_convert_image(path, image, gil::png_tag{}); + }; + + // if any other edge cases found by fuzzing or by accident, + // you may add them here + const std::string edge_cases_path = png_base_in + "EdgeCases/"; + BOOST_TEST_THROWS (test_read_and_convert(edge_cases_path + "invalid-last-tEXt-length.png"), std::ios_base::failure); +} #endif // BOOST_GIL_IO_USE_PNG_TEST_SUITE_IMAGES void test_corrupted_png_read() @@ -755,6 +768,7 @@ int main() test_background(); test_transparency(); test_gamma(); + test_invalid_png_read(); #endif return boost::report_errors(); From 942196bedc936ad83a3a03540dd3c3d5e735e5fa Mon Sep 17 00:00:00 2001 From: Samuel Debionne Date: Wed, 19 Nov 2025 14:34:22 +0100 Subject: [PATCH 42/42] docs: logo was removed since Sphinx 6 and replaced by logo_url --- doc/_templates/layout.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/_templates/layout.html b/doc/_templates/layout.html index 59c30e401f..90a6f71030 100644 --- a/doc/_templates/layout.html +++ b/doc/_templates/layout.html @@ -90,9 +90,8 @@

C++ Boost

+ alt="C++ Boost" src="{{ pathto(logo_url, 1) }}" border="0"> -