Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:59

0001 //
0002 // Copyright 2010 Christian Henning
0003 //
0004 // Distributed under the Boost Software License, Version 1.0
0005 // See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt
0007 //
0008 #ifndef BOOST_GIL_EXTENSION_IO_TARGA_OLD_HPP
0009 #define BOOST_GIL_EXTENSION_IO_TARGA_OLD_HPP
0010 
0011 #include <boost/gil/extension/io/targa.hpp>
0012 
0013 namespace boost { namespace gil {
0014 
0015 /// \ingroup BMP_IO
0016 /// \brief Returns the width and height of the BMP file at the specified location.
0017 /// Throws std::ios_base::failure if the location does not correspond to a valid BMP file
0018 template<typename String>
0019 inline point_t targa_read_dimensions(String const& filename)
0020 {
0021     using backend_t = typename get_reader_backend<String, targa_tag>::type;
0022     backend_t backend = read_image_info(filename, targa_tag());
0023     return { backend._info._width, backend._info._height };
0024 }
0025 
0026 /// \ingroup BMP_IO
0027 /// \brief Loads the image specified by the given targa image file name into the given view.
0028 /// 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.
0029 /// Throws std::ios_base::failure if the file is not a valid BMP file, or if its color space or channel depth are not
0030 /// compatible with the ones specified by View, or if its dimensions don't match the ones of the view.
0031 template< typename String
0032         , typename View
0033         >
0034 inline
0035 void targa_read_view( const String& filename
0036                     , const View&   view
0037                     )
0038 {
0039     read_view( filename
0040              , view
0041              , targa_tag()
0042              );
0043 }
0044 
0045 /// \ingroup BMP_IO
0046 /// \brief Allocates a new image whose dimensions are determined by the given bmp image file, and loads the pixels into it.
0047 /// 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.
0048 /// Throws std::ios_base::failure if the file is not a valid BMP file, or if its color space or channel depth are not
0049 /// compatible with the ones specified by Image
0050 template< typename String
0051         , typename Image
0052         >
0053 inline
0054 void targa_read_image( const String& filename
0055                      , Image&        img
0056                      )
0057 {
0058     read_image( filename
0059               , img
0060               , targa_tag()
0061               );
0062 }
0063 
0064 /// \ingroup BMP_IO
0065 /// \brief Loads and color-converts the image specified by the given targa image file name into the given view.
0066 /// 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.
0067 template< typename String
0068         , typename View
0069         , typename CC
0070         >
0071 inline
0072 void targa_read_and_convert_view( const String& filename
0073                                 , const View&   view
0074                                 , CC            cc
0075                                 )
0076 {
0077     read_and_convert_view( filename
0078                          , view
0079                          , cc
0080                          , targa_tag()
0081                          );
0082 }
0083 
0084 /// \ingroup BMP_IO
0085 /// \brief Loads and color-converts the image specified by the given targa image file name into the given view.
0086 /// 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.
0087 template< typename String
0088         , typename View
0089         >
0090 inline
0091 void targa_read_and_convert_view( const String& filename
0092                                 , const View&   view
0093                                 )
0094 {
0095     read_and_convert_view( filename
0096                          , view
0097                          , targa_tag()
0098                          );
0099 }
0100 
0101 /// \ingroup BMP_IO
0102 /// \brief Allocates a new image whose dimensions are determined by the given targa image file, loads and color-converts the pixels into it.
0103 /// Throws std::ios_base::failure if the file is not a valid BMP file
0104 template< typename String
0105         , typename Image
0106         , typename CC
0107         >
0108 inline
0109 void targa_read_and_convert_image( const String& filename
0110                                  , Image&        img
0111                                  , CC            cc
0112                                  )
0113 {
0114     read_and_convert_image( filename
0115                           , img
0116                           , cc
0117                           , targa_tag()
0118                           );
0119 }
0120 
0121 /// \ingroup BMP_IO
0122 /// \brief Allocates a new image whose dimensions are determined by the given targa image file, loads and color-converts the pixels into it.
0123 /// Throws std::ios_base::failure if the file is not a valid BMP file
0124 template< typename String
0125         , typename Image
0126         >
0127 inline
0128 void targa_read_and_convert_image( const String filename
0129                                  , Image&       img
0130                                  )
0131 {
0132     read_and_convert_image( filename
0133                           , img
0134                           , targa_tag()
0135                           );
0136 }
0137 
0138 
0139 /// \ingroup BMP_IO
0140 /// \brief Saves the view to a targa file specified by the given targa image file name.
0141 /// 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.
0142 /// Throws std::ios_base::failure if it fails to create the file.
0143 template< typename String
0144         , typename View
0145         >
0146 inline
0147 void targa_write_view( const String& filename
0148                      , const View&   view
0149                      )
0150 {
0151     write_view( filename
0152               , view
0153               , targa_tag()
0154               );
0155 }
0156 
0157 } // namespace gil
0158 } // namespace boost
0159 
0160 #endif