mirror of
https://github.com/boostorg/gil.git
synced 2026-02-01 20:42:10 +00:00
Group include directives, sort within group: * In headers of GIL core and extensions: 1. boost/gil/extension/* 2. boost/gil/* 3. boost/* 4. C++ standard library headers * In programs: 1. boost/gil/* 2. boost/* 3. C++ standard library headers 4. "xxx.hpp" for local headers Add basic guidelines to CONTRIBUTING.md. Add/Remove #include <boost/config.hpp> or std headers un/necessary. Rename gil_concept.hpp to concepts.hpp. Remove gil_all.hpp - we already have all-in-one boost/gil.hpp. Tidy up and unify copyright and license header. Tidy up formatting and excessive whitespaces in some comments. Remove Doxygen block with file description, author, date, etc. Remove dead or commented pragmas and directives. Trim trailing whitespaces.
35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
//
|
|
// Copyright 2005-2007 Adobe Systems Incorporated
|
|
//
|
|
// 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
|
|
//
|
|
#include <boost/gil.hpp>
|
|
#include <boost/gil/extension/io/jpeg.hpp>
|
|
#include <boost/gil/extension/numeric/sampler.hpp>
|
|
#include <boost/gil/extension/numeric/resample.hpp>
|
|
|
|
// Example for resample_pixels() in the numeric extension
|
|
|
|
int main()
|
|
{
|
|
namespace gil = boost::gil;
|
|
|
|
gil::rgb8_image_t img;
|
|
gil::read_image("test.jpg", img, gil::jpeg_tag());
|
|
|
|
// test resample_pixels
|
|
// Transform the image by an arbitrary affine transformation using nearest-neighbor resampling
|
|
gil::rgb8_image_t transf(gil::rgb8_image_t::point_t(gil::view(img).dimensions() * 2));
|
|
gil::fill_pixels(gil::view(transf), gil::rgb8_pixel_t(255, 0, 0)); // the background is red
|
|
|
|
gil::matrix3x2<double> mat =
|
|
gil::matrix3x2<double>::get_translate(-gil::point2<double>(200,250)) *
|
|
gil::matrix3x2<double>::get_rotate(-15*3.14/180.0);
|
|
gil::resample_pixels(const_view(img), gil::view(transf), mat, gil::nearest_neighbor_sampler());
|
|
gil::write_view("out-affine.jpg", gil::view(transf), gil::jpeg_tag());
|
|
|
|
return 0;
|
|
}
|