1 /* -*- Mode: C; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3 -*- */
2 
3 /*
4  * GImageView
5  * Copyright (C) 2001-2002 Takuro Ashie
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  *
21  * $Id: gimv_anim.h,v 1.8 2004/03/07 11:53:30 makeinu Exp $
22  */
23 
24 #ifndef __GIMV_ANIM_H__
25 #define __GIMV_ANIM_H__
26 
27 #include "gimv_image.h"
28 
29 
30 #define GIMV_TYPE_ANIM            (gimv_anim_get_type ())
31 #define GIMV_ANIM(obj)            (GTK_CHECK_CAST (obj, gimv_anim_get_type (), GimvAnim))
32 #define GIMV_ANIM_CLASS(klass)    (GTK_CHECK_CLASS_CAST (klass, gimv_anim_get_type, GimvAnimClass))
33 #define GIMV_IS_ANIM(obj)         (GTK_CHECK_TYPE (obj, gimv_anim_get_type ()))
34 #define GIMV_IS_ANIM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMV_TYPE_ANIM))
35 
36 
37 typedef struct GimvAnim_Tag          GimvAnim;
38 typedef struct GimvAnimClass_Tag     GimvAnimClass;
39 typedef struct GimvAnimFuncTable_Tag GimvAnimFuncTable;
40 
41 
42 struct GimvAnim_Tag
43 {
44    GimvImage          parent;
45 
46    gpointer           anim;
47    gint               current_frame_idx;
48    GimvAnimFuncTable *table;
49 };
50 
51 
52 struct GimvAnimClass_Tag
53 {
54    GimvImageClass parent_class;
55 };
56 
57 
58 struct GimvAnimFuncTable_Tag
59 {
60    gint     (*get_length)   (GimvAnim    *anim);
61    gint     (*get_idx)      (GimvAnim    *anim);
62    gint     (*get_interval) (GimvAnim    *anim);
63    gint     (*iterate)      (GimvAnim    *anim);
64    gboolean (*seek)         (GimvAnim    *anim,
65                              gint         idx);
66    void     (*delete)       (GimvAnim    *anim);
67 };
68 
69 
70 GtkType    gimv_anim_get_type     (void);
71 GimvAnim  *gimv_anim_new          (void);
72 
73 /* public */
74 gint       gimv_anim_get_length   (GimvAnim    *anim);
75 gint       gimv_anim_iterate      (GimvAnim    *anim);
76 gboolean   gimv_anim_seek         (GimvAnim    *anim,
77                                    gint         idx);
78 gint       gimv_anim_get_interval (GimvAnim    *anim);
79 
80 /* used by child */
81 gboolean   gimv_anim_update_frame (GimvAnim *anim,
82                                    guchar   *frame,
83                                    gint      width,
84                                    gint      height,
85                                    gboolean  has_alpha);
86 
87 #endif /* __GIMV_ANIM_H__ */
88