Logo Search packages:      
Sourcecode: djvulibre version File versions

int DjVuDocEditor::get_thumbnails_size ( void   )  const

Returns the size of the first encountered thumbnail image. Since thumbnails can currently be generated by {generate_thumbnails}() only, all thumbnail images should be of the same size. Thus, the number returned is actually the size of {all} document thumbnails.

The function will return #-1# if there are no thumbnails.

Definition at line 1529 of file DjVuDocEditor.cpp.

References GMapTemplate< KTYPE, VTYPE, TI >::contains(), IW44Image::create_decode(), DjVuDocument::get_pages_num(), and page_to_id().

{
   DEBUG_MSG("DjVuDocEditor::remove_thumbnails(): doing it\n");
   DEBUG_MAKE_INDENT(3);

   GCriticalSectionLock lock((GCriticalSection *) &thumb_lock);

   int pages_num=get_pages_num();
   for(int page_num=0;page_num<pages_num;page_num++)
   {
     const GPosition pos(thumb_map.contains(page_to_id(page_num)));
     if (pos)
     {
       const GP<ByteStream> gstr(thumb_map[pos]->get_stream());
       GP<IW44Image> iwpix=IW44Image::create_decode(IW44Image::COLOR);
       iwpix->decode_chunk(gstr);
      
       int width=iwpix->get_width();
       int height=iwpix->get_height();
       return width<height ? width : height;
    }
  }
  return -1;
}


Generated by  Doxygen 1.6.0   Back to index