Ejemplo n.º 1
0
   void t_write_bmp::write( string const& fn, tImgViewLinear const& img )   {
      if( !img.is_mono8() &&  !img.is_rgb() &&  !img.is_rgba() ) {
         throw tImgWriteEx( bmp::msg_image_format_not_supported );
      }

      return bmp_write_local::write( fn, img );
   }
Ejemplo n.º 2
0
 void write_raw_data( string const& fn, tImgViewLinear const& img ) {
    try {
       bin_data::tWriteBin()( fn, img.data_ptr(), img.bytes() );
    }  catch( bin_data::tBinWriteEx& ) {
       throw;
    }
 }
Ejemplo n.º 3
0
      void RGB_LineTo_BGR( tImgViewLinear const& img, size_t y, vector<uint8_t>& v ) {
         tRGB const* source = ( tRGB const* )( img.row_ptr( y ) );
         v.resize( img.pitch() );
         tBGR* target = ( tBGR* )&v[0];
         size_t count = img.size().x();

         while( count-- ) {
            *target++ = *source++;
         }
      }
Ejemplo n.º 4
0
      void write( string const& fn, tImgViewLinear const& img )  {
         try {
            vector<uint8_t> buf;

            if( img.is_mono8() ) {
               buf.resize( offsetpixeldata8 + img.bytes() );
               write_mono8( buf, img.size(), img.rows() );
            }

            if( img.is_rgb() ) {
               uint32_t aligned_line_size = bmp_intern::align32( img.size().x()  * sizeof( tBGR ) );
               uint32_t filesize = header_size +  aligned_line_size  * img.size().y();
               buf.resize( filesize );
               write_rgb( buf, img.size(), img.rows() );
            }

            if( img.is_rgba() ) {
               uint32_t aligned_line_size = bmp_intern::align32( img.size().x()  * sizeof( tBGRA ) );
               uint32_t filesize = header_size +  aligned_line_size  * img.size().y();
               buf.resize( filesize );
               write_rgba( buf, img.size(), img.rows() );
            }

            bin_data::tWriteBin()( fn, buf );
         } catch( bin_data::tBinWriteEx& ) {
            throw  tImgWriteEx( bin_data::msg::write_file( fn ) );
         }
      }