Changeset 49

Show
Ignore:
Timestamp:
01/20/09 19:07:40 (3 years ago)
Author:
mirko
Message:

animation and index sketches

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/clutter-experiments/main.cc

    r48 r49  
    3232} 
    3333 
     34#if 0 
     35/** 
     36 * The index class will contain methods to show all the pages in an 
     37 * index page, to hilight a different page and to restore the selected 
     38 * page in full screen. 
     39 * 
     40 */ 
     41class index 
     42{ 
     43  // ... 
     44} 
     45/** 
     46 * @brief Abstract animator class. 
     47 * 
     48 * Animations are for transitions between two pages. They start from 
     49 * one page and go to another one. The prepare() method whoud be 
     50 * called before starting and is indended to render the hi resolution 
     51 * version of the needed pages and to setup the scene 
     52 * graph. render(frame) is used to position the actors for the given 
     53 * frame number and unprepare() will free the unneded hi-res versions. 
     54 */ 
     55class animator 
     56{ 
     57  virtual ~animator() {} 
     58 
     59  void 
     60  prepare() = 0; 
     61   
     62  void 
     63  render(int frame) = 0; 
     64 
     65  void 
     66  unprepare() = 0; 
     67}; 
     68 
     69class replace_animator : public animator 
     70{ 
     71  replace_animator(pdfcube::document& doc, int page_no); 
     72  // ... 
     73} 
     74 
     75class cube_animator : public animator 
     76{ 
     77  replace_animator(pdfcube::document& doc, int page_no); 
     78  // ... 
     79} 
     80 
     81/** 
     82 * An animator factory returns an animator for the give page number of 
     83 * a document. 
     84 * 
     85 */ 
     86class animator_factory 
     87{ 
     88  animator* make_animator(pdfcube::document& doc, int page_no) 
     89  { 
     90    switch(doc.page(page_no).transition_type()) 
     91      { 
     92      case POPPLER_PAGE_TRANSITION_REPLACE: 
     93        return new replace_animator(doc, page_no); 
     94      case POPPLER_PAGE_TRANSITION_BOX: 
     95        return new cube_animator(doc, page_no); 
     96      } 
     97    return NULL; 
     98  } 
     99} 
     100#endif 
     101 
     102// a main to quick-test some clutter api 
    34103int main(int argc, char* argv[]) 
    35104{ 
     
    65134  clutter_stage_set_color(CLUTTER_STAGE(stage), &stage_color); 
    66135 
     136  // poppler needs an URI (e.g. file:///....) 
    67137  pdoc = poppler_document_new_from_file(*pdfcube_filename, NULL, NULL); 
    68138  if(pdoc == NULL)