Rename GP_Context -> GP_Pixmap
[gfxprim.git] / demos / spiv / image_loader.h
blob5d2223ee1c7fb8a2927efbeee189188a51818d55
1 /*****************************************************************************
2 * This file is part of gfxprim library. *
3 * *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
8 * *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
18 * *
19 * Copyright (C) 2009-2013 Cyril Hrubis <metan@ucw.cz> *
20 * *
21 *****************************************************************************/
25 Image loader.
27 This is abstraction on the top of the image list and image cache.
31 #ifndef __IMAGE_LOADER_H__
32 #define __IMAGE_LOADER_H__
34 #include <core/GP_Pixmap.h>
35 #include <core/GP_ProgressCallback.h>
38 * Initialize image loader.
40 int image_loader_init(const char *args[], unsigned int cache_max_bytes);
43 * Fills pointer to current image.
45 * Returns zero or, in case of failure, errno.
47 * Note that the callback may not be called when the image is cached.
49 GP_Pixmap *image_loader_get_image(GP_ProgressCallback *callback, int elevate);
52 * Retruns current image meta data or NULL there are none.
54 GP_DataStorage *image_loader_get_meta_data(void);
57 * Returns path to current image.
59 const char *image_loader_img_path(void);
62 * Returns image name.
64 * Note that in case of image containers this is different from the image path.
66 const char *image_loader_img_name(void);
69 enum img_seek_offset {
70 IMG_FIRST,
71 IMG_LAST,
72 IMG_CUR,
74 * Seeks to the last image in the directory if whence > 0
75 * to the first image in dir otherwise.
77 IMG_DIR,
81 * Changes position in image list.
83 void image_loader_seek(enum img_seek_offset offset, int whence);
86 * Drops image cache.
88 void image_loader_drop_cache(void);
91 * Free all memory, close all files.
93 void image_loader_destroy(void);
96 * Counts images in the image list.
98 unsigned int image_loader_count(void);
101 * Returns current position.
103 unsigned int image_loader_pos(void);
107 * Returns non-zero if we are in diretory.
109 int image_loader_is_in_dir(void);
112 * Counts number of images in current directory.
114 unsigned int image_loader_dir_count(void);
117 * Returns current position in directory.
119 unsigned int image_loader_dir_pos(void);
121 #endif /* __IMAGE_LOADER_H__ */