Logo Search packages:      
Sourcecode: djvulibre version File versions

void DjVuImage::decode ( ByteStream str,
DjVuInterface *  notifier = 0 

This function is here for backward compatibility. Now, with the introduction of multipage DjVu documents, the decoding is handled by {DjVuFile} and {DjVuDocument} classes. For single page documents though, we still have this wrapper.

Definition at line 498 of file DjVuImage.cpp.

References DataPool::create(), DjVuDocument::create_wait(), ByteStream::EndOfFile, and ByteStream::read().

  DEBUG_MSG("DjVuImage::decode(): decoding old way...\n");
  if (file) 
    G_THROW( ERR_MSG("DjVuImage.bad_call") );
  GP<DjVuImageNotifier> pport = new DjVuImageNotifier(notifier);
  // Get all the data first
  int length;
  char buffer[1024];
  while((length=str.read(buffer, 1024)))
    pport->stream_pool->add_data(buffer, length);
  GP<DjVuDocument> doc = DjVuDocument::create_wait(pport->stream_url, (DjVuImageNotifier*)pport);
  GP<DjVuImage> dimg=doc->get_page(-1, true, (DjVuImageNotifier*)pport);
  if (file->is_decode_stopped())
    G_THROW( DataPool::Stop );
  if (file->is_decode_failed())
    G_THROW( ByteStream::EndOfFile ); // guess
  if (!file->is_decode_ok())
    G_THROW( ERR_MSG("DjVuImage.mult_error") );
  DEBUG_MSG("decode DONE\n");

Generated by  Doxygen 1.6.0   Back to index