2 // Copyright 2010 Christian Henning
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 #ifndef BOOST_GIL_EXTENSION_IO_TARGA_OLD_HPP
9 #define BOOST_GIL_EXTENSION_IO_TARGA_OLD_HPP
11 #include <boost/gil/extension/io/targa.hpp>
13 namespace boost { namespace gil {
16 /// \brief Returns the width and height of the BMP file at the specified location.
17 /// Throws std::ios_base::failure if the location does not correspond to a valid BMP file
18 template<typename String>
19 inline point_t targa_read_dimensions(String const& filename)
21 using backend_t = typename get_reader_backend<String, targa_tag>::type;
22 backend_t backend = read_image_info(filename, targa_tag());
23 return { backend._info._width, backend._info._height };
27 /// \brief Loads the image specified by the given targa image file name into the given view.
28 /// Triggers a compile assert if the view color space and channel depth are not supported by the BMP library or by the I/O extension.
29 /// Throws std::ios_base::failure if the file is not a valid BMP file, or if its color space or channel depth are not
30 /// compatible with the ones specified by View, or if its dimensions don't match the ones of the view.
31 template< typename String
35 void targa_read_view( const String& filename
46 /// \brief Allocates a new image whose dimensions are determined by the given bmp image file, and loads the pixels into it.
47 /// Triggers a compile assert if the image color space or channel depth are not supported by the BMP library or by the I/O extension.
48 /// Throws std::ios_base::failure if the file is not a valid BMP file, or if its color space or channel depth are not
49 /// compatible with the ones specified by Image
50 template< typename String
54 void targa_read_image( const String& filename
65 /// \brief Loads and color-converts the image specified by the given targa image file name into the given view.
66 /// Throws std::ios_base::failure if the file is not a valid BMP file, or if its dimensions don't match the ones of the view.
67 template< typename String
72 void targa_read_and_convert_view( const String& filename
77 read_and_convert_view( filename
85 /// \brief Loads and color-converts the image specified by the given targa image file name into the given view.
86 /// Throws std::ios_base::failure if the file is not a valid BMP file, or if its dimensions don't match the ones of the view.
87 template< typename String
91 void targa_read_and_convert_view( const String& filename
95 read_and_convert_view( filename
102 /// \brief Allocates a new image whose dimensions are determined by the given targa image file, loads and color-converts the pixels into it.
103 /// Throws std::ios_base::failure if the file is not a valid BMP file
104 template< typename String
109 void targa_read_and_convert_image( const String& filename
114 read_and_convert_image( filename
122 /// \brief Allocates a new image whose dimensions are determined by the given targa image file, loads and color-converts the pixels into it.
123 /// Throws std::ios_base::failure if the file is not a valid BMP file
124 template< typename String
128 void targa_read_and_convert_image( const String filename
132 read_and_convert_image( filename
140 /// \brief Saves the view to a targa file specified by the given targa image file name.
141 /// Triggers a compile assert if the view color space and channel depth are not supported by the BMP library or by the I/O extension.
142 /// Throws std::ios_base::failure if it fails to create the file.
143 template< typename String
147 void targa_write_view( const String& filename