#ifndef __GDAM_BUFFER_PIXMAP_H_
#define __GDAM_BUFFER_PIXMAP_H_

#include <gdam/client/gdamchannel.h>
#include <gdam/common/gdam-protocol.h>
#include <gdk/gdk.h>

/* number of unlocked profiles we keep around */
void       gdam_buffer_pixmap_set_cache_size (GdamChannel         *channel,
                                              int                  size);

/* forcibly remove from cache (may wait til lock count==0) */
void       gdam_buffer_pixmap_uncache        (GdamChannel         *channel,
                                              guint                buffer_id);

/* don't allow the pixmap to become uncached */
gboolean   gdam_buffer_pixmap_lock           (GdamChannel         *channel,
                                              guint                buffer_id);

/* re-allow the pixmap to become uncached */
void       gdam_buffer_pixmap_unlock         (GdamChannel         *channel,
                                              guint                buffer_id);

/* see if the pixmap can be produced from cached data - don't talk
 * to gdam server.
 */
gboolean   gdam_buffer_pixmap_get_cached     (GdamChannel         *channel,
                                              guint                buffer_id,
                                              GdamTime             start_time,
                                              GdamTime             length,
					      gboolean             filled,
                                              GdkPixmap           *dst_pixmap,
					      guint                left,
					      guint                top,
                                              guint                width,
                                              guint                height,
                                              GdkGC               *gc);

/* from within this callback, you may call
 * gdam_buffer_pixmap_get_cached() and it will return TRUE.
 */
typedef void (*GdamBufferPixmapFunc)   (GdamChannel  *channel,
                                        guint         buffer_id,
                                        gpointer      data);

/* if an error occurs, the `destroy' function will be called
 * without calling `func'.  Normally destroy is run immediately after
 * `func'.
 */
void       gdam_buffer_pixmap_get            (GdamChannel         *channel,
                                              guint                buffer_id,
                                              GdamBufferPixmapFunc func,
                                              gpointer             data,
                                              GDestroyNotify       destroy);
#endif
