コード例 #1
0
ファイル: FileFormatInstance.cpp プロジェクト: aleixpuig/PCL
bool FileFormatInstance::Open( ImageDescriptionArray& images,
                               const String& filePath, const IsoString& hints )
{
   images.Clear();

   if ( (*API->FileFormat->OpenImageFileEx)( handle, filePath.c_str(), hints.c_str(), 0/*flags*/ ) == api_false )
      return false;

   for ( uint32 i = 0, n = (*API->FileFormat->GetImageCount)( handle ); i < n; ++i )
   {
      IsoString id;
      size_type len = 0;
      (*API->FileFormat->GetImageId)( handle, 0, &len, i );
      if ( len > 0 )
      {
         id.SetLength( len );
         if ( (*API->FileFormat->GetImageId)( handle, id.Begin(), &len, i ) == api_false )
            throw APIFunctionError( "GetImageId" );
         id.ResizeToNullTerminated();
      }

      api_image_info info;
      api_image_options options;
      if ( (*API->FileFormat->GetImageDescription)( handle, &info, &options, i ) == api_false )
         throw APIFunctionError( "GetImageDescription" );

      ImageDescription d;
      d.id = id;
      APIImageInfoToPCL( d.info, info );
      APIImageOptionsToPCL( d.options, options );
      images.Add( d );
   }

   return true;
}
コード例 #2
0
ファイル: JPEGInstance.cpp プロジェクト: SunGong1993/PCL
ImageDescriptionArray JPEGInstance::Open( const String& filePath, const IsoString& /*hints*/ )
{
   Close();

   try
   {
      Exception::EnableConsoleOutput();

      reader = new JPEGReader;
      reader->Open( filePath );

      ImageDescriptionArray a;
      a.Add( ImageDescription( reader->Info(), reader->Options() ) );
      return a;
   }
   catch ( ... )
   {
      if ( reader != 0 )
         delete reader, reader = 0;
      throw;
   }
}