MUAN
imglist.h
Go to the documentation of this file.
00001 
00005 /*
00006  * Copyright (C) 2006  Lab. Visgraf/IMPA and AnimaMundi
00007  * 
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License
00010  * as published by the Free Software Foundation; either version 2
00011  * of the License, or (at your option) any later version.
00012  * 
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  * 
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00021  * 
00022 */
00023 #ifndef IMGLIST_H
00024 #define IMGLIST_H
00025 
00026 extern "C"{
00027 #include "image.h"
00028 #include "jpeg.h"
00029 #include <string.h>
00030 #include <stdint.h>
00031 }
00032 #include "frame.h"
00033 #include "video.h"
00034 
00035 void setMessage(const char* m);
00036 
00040 typedef struct ImgNode{
00041   struct ImgNode *next, *prev;
00042   int delay;
00043   int time_stamp;
00044   int frame_number;     // posicao (na lista) do frame capturado 
00045   int frame_pos;        // posicao (na animacao) considerando duracao
00046   int frame_duration;
00047   Frame *frame;
00048 } ImgNode;
00049 
00053 typedef struct ImgList{
00054   ImgNode *head, *current;
00055   int totFrames;       // total de capturas (frames sem considerar duracao) 
00056   int totRealFrames;   // total de frames da lista considerando duracao
00057   int img_w, img_h;
00058 } ImgList;
00059 
00060 // The ImageNode methods signature.
00061 ImgNode *imgnode_alloc( Frame *f, int delay, int frame_duration );
00062 void imgnode_dispose( ImgNode *i );
00063 ImgNode *imgnode_copy( ImgNode *i );
00064 
00065 //The ImageList methods signature.
00066 ImgList *imglist_alloc( int w, int h );
00067 void imglist_clear( ImgList *q );
00068 void imglist_dispose( ImgList *q );
00069 int  imglist_isempty( ImgList *q );
00070 Frame* imglist_peek_current_frame( ImgList *q );
00071 void imglist_insert( ImgList *q, ImgNode *i );
00072 void imglist_insert( ImgList *q, ImgList *c, bool invert);
00073 void imglist_removeInRange( ImgList *q, int begin, int end );
00074 void imglist_step( ImgList *q, int step);
00075 void imglist_step_foward( ImgList *q );
00076 void imglist_step_backward( ImgList *q );
00077 void imglist_rew( ImgList *q );
00078 void imglist_go_to_end( ImgList *q );
00079 void imglist_update_frames( ImgList *q );
00080 void imglist_go_to_frame( ImgList *q, int frameNumber );
00081 int imglist_getTotalFrames(ImgList *q);
00082 int imglist_getTotalRealFrames(ImgList *q);
00083 void imglist_setFrameDuration(ImgList *q, int begin, int end, int duration);
00084 int imglist_getCurrentFnum(ImgList *q);
00085 
00086 void insert_frame_from_imagefile(ImgList *imgl, char *fname);
00087 void insert_frame_from_jpgfile(ImgList *imgl, char *fname);
00088 
00089 #define imglist_addimg imglist_insert
00090 #define imglist_addlist imglist_insert
00091 
00092 #endif