Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port TuttleOFX extension : pattern #581

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/boost/gil/extension/toolbox/metafunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
#include <boost/gil/extension/toolbox/metafunctions/is_homogeneous.hpp>
#include <boost/gil/extension/toolbox/metafunctions/is_similar.hpp>
#include <boost/gil/extension/toolbox/metafunctions/pixel_bit_size.hpp>
#include <boost/gil/extension/toolbox/metafunctions/pattern.hpp>

#endif
64 changes: 64 additions & 0 deletions include/boost/gil/extension/toolbox/metafunctions/pattern.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright Tom Brinkman 2008. 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)

#ifndef _pattern_hpp_
#define _pattern_hpp_
meshtag marked this conversation as resolved.
Show resolved Hide resolved

#include <boost/gil.hpp>

namespace boost { namespace gil {

/// \brief Repeatedly copies smaller image view passed through the struct constructor in subimage
/// views of the larger image view passed through overloaded '()' operator.
template <typename view_t>
meshtag marked this conversation as resolved.
Show resolved Hide resolved
struct pattern
{
view_t v2;
pattern(view_t v2)
: v2(v2)
{
}

void operator()(view_t& view)
{
using namespace boost::gil;
meshtag marked this conversation as resolved.
Show resolved Hide resolved

std::size_t h = v2.height(), w = v2.width();
meshtag marked this conversation as resolved.
Show resolved Hide resolved

// For ensuring that view passed through '()' operator has dimensions greater than or
// equal to the dimensions of view passed through constructor.
if (h > view.height() || w > view.width())
{
throw std::length_error("Image view passed through overloaded '()' operator must have"
" dimensions greater than or equal to the dimensions of image view passed through"
" struct constructor");
}

for (std::ptrdiff_t x = 0; x < view.width(); x += w)
{
for (std::ptrdiff_t y = 0; y < view.height(); y += h)
{
std::ptrdiff_t aw = w;
if (x + w > view.width())
{
std::ptrdiff_t t = x + w - view.width();
aw = w - t;
}

std::ptrdiff_t ah = h;
if (y + h > view.height())
{
std::ptrdiff_t t = y + h - view.height();
ah = h - t;
}

view_t v3 = subimage_view(view, x, y, aw, ah);
view_t v4 = subimage_view(v2, 0, 0, aw, ah);
copy_pixels(v4, v3);
}
}
}
}; // pattern
}} // namespace boost::gil
#endif
3 changes: 2 additions & 1 deletion test/extension/toolbox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ foreach(_name
is_bit_aligned
is_homogeneous
pixel_bit_size
subchroma_image)
subchroma_image
pattern)
meshtag marked this conversation as resolved.
Show resolved Hide resolved
set(_test t_ext_toolbox_${_name})
set(_target test_ext_toolbox_${_name})

Expand Down
1 change: 1 addition & 0 deletions test/extension/toolbox/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ run color_convert_lab.cpp ;
run color_convert_luminance.cpp ;
run color_convert_xyz.cpp ;
run indexed_image.cpp ;
run pattern.cpp ;

# TODO: Add subchroma_image.cpp after fixing run-time failure,
# for details see https://github.com/boostorg/gil/pull/164
Expand Down
237 changes: 237 additions & 0 deletions test/extension/toolbox/pattern.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
//
// Copyright 2021 Prathamesh Tagore <[email protected]>
//
// 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)
//

// Reference for test case was taken from
// https://github.com/tuttleofx/TuttleOFX/blob/develop/libraries/boostHack/boost/gil/extension/toolbox/pattern.tests.cpp

#include <boost/gil/extension/toolbox/metafunctions.hpp>
#include <boost/core/lightweight_test.hpp>
#include <vector>

namespace gil = boost::gil;

// This function helps us fill pixels of a rgb view given as 2nd argument with
// elements of the vector given as 1st argument.
void pixel_fill_rgb(std::vector<std::vector<std::vector<int>>>& vec,
gil::rgb8_image_t& img)
{
for (std::ptrdiff_t view_row = 0; view_row < view(img).height(); ++view_row)
{
for (std::ptrdiff_t view_col = 0; view_col < view(img).width(); ++view_col)
{
gil::view(img)(view_col, view_row) = gil::rgb8_pixel_t(vec[view_row][view_col][0],
vec[view_row][view_col][1], vec[view_row][view_col][2]);
}
}
}

int main()
{
std::vector<std::vector<std::vector<int>>> original_img_vector {
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}}
};

std::vector<std::vector<std::vector<int>>> expected_img_vector {
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, { 0, 0, 0}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, { 0, 0, 0}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0} ,{ 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, { 0, 0, 0}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, { 0, 0, 0}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, { 0, 0, 0}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, { 0, 0, 0}},
{{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, { 0, 0, 0}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0}, {255, 255, 255}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}},
{{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255},
{255, 255, 255}, {255, 255, 255}, {255, 255, 255}}
};

gil::rgb8_image_t original_img(16, 16), expected_img(33, 17), obtained_img(33, 17);
gil::rgb8_view_t original_img_view = gil::view(original_img);
gil::rgb8_view_t obtained_img_view = gil::view(obtained_img);

pixel_fill_rgb(original_img_vector, original_img);
pixel_fill_rgb(expected_img_vector, expected_img);

gil::pattern<gil::rgb8_view_t> pattern(original_img_view);
pattern(obtained_img_view);

BOOST_TEST(gil::equal_pixels(obtained_img_view, gil::view(expected_img)));

return boost::report_errors();
}