gdk-pixbuf-animation.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
  2. /* GdkPixbuf library - Animation support
  3. *
  4. * Copyright (C) 1999 The Free Software Foundation
  5. *
  6. * Authors: Mark Crichton <crichton@gimp.org>
  7. * Miguel de Icaza <miguel@gnu.org>
  8. * Federico Mena-Quintero <federico@gimp.org>
  9. * Havoc Pennington <hp@redhat.com>
  10. *
  11. * This library is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU Lesser General Public
  13. * License as published by the Free Software Foundation; either
  14. * version 2 of the License, or (at your option) any later version.
  15. *
  16. * This library is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * Lesser General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public
  22. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  23. */
  24. #ifndef GDK_PIXBUF_ANIMATION_H
  25. #define GDK_PIXBUF_ANIMATION_H
  26. #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
  27. #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
  28. #endif
  29. #include <glib-object.h>
  30. #include <gdk-pixbuf/gdk-pixbuf-core.h>
  31. G_BEGIN_DECLS
  32. /* Animation support */
  33. /**
  34. * GdkPixbufAnimation:
  35. *
  36. * An opaque struct representing an animation.
  37. */
  38. typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
  39. /**
  40. * GdkPixbufAnimationIter:
  41. *
  42. * An opaque struct representing an iterator which points to a
  43. * certain position in an animation.
  44. */
  45. typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter;
  46. #define GDK_TYPE_PIXBUF_ANIMATION (gdk_pixbuf_animation_get_type ())
  47. #define GDK_PIXBUF_ANIMATION(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimation))
  48. #define GDK_IS_PIXBUF_ANIMATION(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANIMATION))
  49. #define GDK_TYPE_PIXBUF_ANIMATION_ITER (gdk_pixbuf_animation_iter_get_type ())
  50. #define GDK_PIXBUF_ANIMATION_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIter))
  51. #define GDK_IS_PIXBUF_ANIMATION_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANIMATION_ITER))
  52. GType gdk_pixbuf_animation_get_type (void) G_GNUC_CONST;
  53. #ifndef __GTK_DOC_IGNORE__
  54. #ifdef G_OS_WIN32
  55. #define gdk_pixbuf_animation_new_from_file gdk_pixbuf_animation_new_from_file_utf8
  56. #endif
  57. #endif
  58. GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename,
  59. GError **error);
  60. GdkPixbufAnimation *gdk_pixbuf_animation_new_from_stream (GInputStream *stream,
  61. GCancellable *cancellable,
  62. GError **error);
  63. void gdk_pixbuf_animation_new_from_stream_async (GInputStream *stream,
  64. GCancellable *cancellable,
  65. GAsyncReadyCallback callback,
  66. gpointer user_data);
  67. GdkPixbufAnimation *gdk_pixbuf_animation_new_from_stream_finish (GAsyncResult*async_result,
  68. GError **error);
  69. GdkPixbufAnimation *gdk_pixbuf_animation_new_from_resource(const char *resource_path,
  70. GError **error);
  71. #ifndef GDK_PIXBUF_DISABLE_DEPRECATED
  72. G_DEPRECATED_FOR(g_object_ref)
  73. GdkPixbufAnimation *gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation);
  74. G_DEPRECATED_FOR(g_object_unref)
  75. void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation);
  76. #endif
  77. int gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation);
  78. int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation);
  79. gboolean gdk_pixbuf_animation_is_static_image (GdkPixbufAnimation *animation);
  80. GdkPixbuf *gdk_pixbuf_animation_get_static_image (GdkPixbufAnimation *animation);
  81. GdkPixbufAnimationIter *gdk_pixbuf_animation_get_iter (GdkPixbufAnimation *animation,
  82. const GTimeVal *start_time);
  83. GType gdk_pixbuf_animation_iter_get_type (void) G_GNUC_CONST;
  84. int gdk_pixbuf_animation_iter_get_delay_time (GdkPixbufAnimationIter *iter);
  85. GdkPixbuf *gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter);
  86. gboolean gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter);
  87. gboolean gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter,
  88. const GTimeVal *current_time);
  89. #ifdef GDK_PIXBUF_ENABLE_BACKEND
  90. /**
  91. * GdkPixbufAnimationClass:
  92. * @parent_class: the parent class
  93. * @is_static_image: returns whether the given animation is just a static image.
  94. * @get_static_image: returns a static image representing the given animation.
  95. * @get_size: fills @width and @height with the frame size of the animation.
  96. * @get_iter: returns an iterator for the given animation.
  97. *
  98. * Modules supporting animations must derive a type from
  99. * #GdkPixbufAnimation, providing suitable implementations of the
  100. * virtual functions.
  101. */
  102. typedef struct _GdkPixbufAnimationClass GdkPixbufAnimationClass;
  103. #define GDK_PIXBUF_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimationClass))
  104. #define GDK_IS_PIXBUF_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_ANIMATION))
  105. #define GDK_PIXBUF_ANIMATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimationClass))
  106. /* Private part of the GdkPixbufAnimation structure */
  107. struct _GdkPixbufAnimation {
  108. GObject parent_instance;
  109. };
  110. struct _GdkPixbufAnimationClass {
  111. GObjectClass parent_class;
  112. /*< public >*/
  113. gboolean (*is_static_image) (GdkPixbufAnimation *anim);
  114. GdkPixbuf* (*get_static_image) (GdkPixbufAnimation *anim);
  115. void (*get_size) (GdkPixbufAnimation *anim,
  116. int *width,
  117. int *height);
  118. GdkPixbufAnimationIter* (*get_iter) (GdkPixbufAnimation *anim,
  119. const GTimeVal *start_time);
  120. };
  121. /**
  122. * GdkPixbufAnimationIterClass:
  123. * @parent_class: the parent class
  124. * @get_delay_time: returns the time in milliseconds that the current frame
  125. * should be shown.
  126. * @get_pixbuf: returns the current frame.
  127. * @on_currently_loading_frame: returns whether the current frame of @iter is
  128. * being loaded.
  129. * @advance: advances the iterator to @current_time, possibly changing the
  130. * current frame.
  131. *
  132. * Modules supporting animations must derive a type from
  133. * #GdkPixbufAnimationIter, providing suitable implementations of the
  134. * virtual functions.
  135. */
  136. typedef struct _GdkPixbufAnimationIterClass GdkPixbufAnimationIterClass;
  137. #define GDK_PIXBUF_ANIMATION_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIterClass))
  138. #define GDK_IS_PIXBUF_ANIMATION_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_ANIMATION_ITER))
  139. #define GDK_PIXBUF_ANIMATION_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIterClass))
  140. struct _GdkPixbufAnimationIter {
  141. GObject parent_instance;
  142. };
  143. struct _GdkPixbufAnimationIterClass {
  144. GObjectClass parent_class;
  145. /*< public >*/
  146. int (*get_delay_time) (GdkPixbufAnimationIter *iter);
  147. GdkPixbuf* (*get_pixbuf) (GdkPixbufAnimationIter *iter);
  148. gboolean (*on_currently_loading_frame) (GdkPixbufAnimationIter *iter);
  149. gboolean (*advance) (GdkPixbufAnimationIter *iter,
  150. const GTimeVal *current_time);
  151. };
  152. GType gdk_pixbuf_non_anim_get_type (void) G_GNUC_CONST;
  153. GdkPixbufAnimation* gdk_pixbuf_non_anim_new (GdkPixbuf *pixbuf);
  154. #endif /* GDK_PIXBUF_ENABLE_BACKEND */
  155. G_END_DECLS
  156. #endif /* GDK_PIXBUF_ANIMATION_H */