]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/gil/extension/io/targa/old.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / gil / extension / io / targa / old.hpp
1 //
2 // Copyright 2010 Christian Henning
3 //
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
7 //
8 #ifndef BOOST_GIL_EXTENSION_IO_TARGA_OLD_HPP
9 #define BOOST_GIL_EXTENSION_IO_TARGA_OLD_HPP
10
11 #include <boost/gil/extension/io/targa.hpp>
12
13 namespace boost { namespace gil {
14
15 /// \ingroup BMP_IO
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)
20 {
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 };
24 }
25
26 /// \ingroup BMP_IO
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
32 , typename View
33 >
34 inline
35 void targa_read_view( const String& filename
36 , const View& view
37 )
38 {
39 read_view( filename
40 , view
41 , targa_tag()
42 );
43 }
44
45 /// \ingroup BMP_IO
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
51 , typename Image
52 >
53 inline
54 void targa_read_image( const String& filename
55 , Image& img
56 )
57 {
58 read_image( filename
59 , img
60 , targa_tag()
61 );
62 }
63
64 /// \ingroup BMP_IO
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
68 , typename View
69 , typename CC
70 >
71 inline
72 void targa_read_and_convert_view( const String& filename
73 , const View& view
74 , CC cc
75 )
76 {
77 read_and_convert_view( filename
78 , view
79 , cc
80 , targa_tag()
81 );
82 }
83
84 /// \ingroup BMP_IO
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
88 , typename View
89 >
90 inline
91 void targa_read_and_convert_view( const String& filename
92 , const View& view
93 )
94 {
95 read_and_convert_view( filename
96 , view
97 , targa_tag()
98 );
99 }
100
101 /// \ingroup BMP_IO
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
105 , typename Image
106 , typename CC
107 >
108 inline
109 void targa_read_and_convert_image( const String& filename
110 , Image& img
111 , CC cc
112 )
113 {
114 read_and_convert_image( filename
115 , img
116 , cc
117 , targa_tag()
118 );
119 }
120
121 /// \ingroup BMP_IO
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
125 , typename Image
126 >
127 inline
128 void targa_read_and_convert_image( const String filename
129 , Image& img
130 )
131 {
132 read_and_convert_image( filename
133 , img
134 , targa_tag()
135 );
136 }
137
138
139 /// \ingroup BMP_IO
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
144 , typename View
145 >
146 inline
147 void targa_write_view( const String& filename
148 , const View& view
149 )
150 {
151 write_view( filename
152 , view
153 , targa_tag()
154 );
155 }
156
157 } // namespace gil
158 } // namespace boost
159
160 #endif