]> git.draconx.ca Git - liblbx.git/blobdiff - src/image.c
liblbx: Kill lbx_numfiles.
[liblbx.git] / src / image.c
index a5a4bffcc2a4f9cf5956c4c4da719f46eac97b59..4a0fdd88080be4d68d9ad3ac8e7cc0235568cefe 100644 (file)
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-#ifdef HAVE_CONFIG_H
-#      include "config.h"
-#endif
-
+#include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
@@ -61,7 +58,7 @@ struct lbx_image {
        unsigned long offsets[];
 };
 
-static struct lbx_image *lbximg_init(unsigned char hdr[static HDR_LEN])
+static struct lbx_image *lbx_img_init(unsigned char hdr[static HDR_LEN])
 {
        unsigned short nframes = unpack_16_le(hdr+6);
        struct lbx_image *img;
@@ -88,8 +85,8 @@ static struct lbx_image *lbximg_init(unsigned char hdr[static HDR_LEN])
        return img;
 }
 
-struct lbx_image *lbximg_open(void *f, const struct lbx_file_ops *fops,
-                              int (*destructor)(void *))
+struct lbx_image *lbx_img_open(void *f, const struct lbx_file_ops *fops,
+                               int (*destructor)(void *))
 {
        unsigned char hdr_buf[HDR_LEN];
        struct lbx_image *img;
@@ -100,7 +97,7 @@ struct lbx_image *lbximg_open(void *f, const struct lbx_file_ops *fops,
                return NULL;
        }
 
-       img = lbximg_init(hdr_buf);
+       img = lbx_img_init(hdr_buf);
        if (!img)
                return NULL;
 
@@ -172,7 +169,7 @@ static int file_close(void *f)
        return fclose((FILE *)f);
 }
 
-struct lbx_image *lbximg_fopen(const char *file)
+struct lbx_image *lbx_img_fopen(const char *file)
 {
        struct lbx_pipe_state *p;
        FILE *f;
@@ -182,7 +179,7 @@ struct lbx_image *lbximg_fopen(const char *file)
                return NULL;
 
        if (fseek(f, 0, SEEK_CUR) == 0)
-               return lbximg_open(f, &lbx_default_fops, file_close);
+               return lbx_img_open(f, &lbx_default_fops, file_close);
 
        p = malloc(sizeof *p);
        if (!p) {
@@ -191,7 +188,7 @@ struct lbx_image *lbximg_fopen(const char *file)
        }
 
        *p = (struct lbx_pipe_state) { .f = f };
-       return lbximg_open(p, &lbx_pipe_fops, pipe_close);
+       return lbx_img_open(p, &lbx_pipe_fops, pipe_close);
 }
 
 static int _lbx_drawrow(int first, struct lbx_image *img)
@@ -323,7 +320,7 @@ static unsigned char **read_raw_frame(struct lbx_image *img, int frame)
        return img->framedata;
 }
 
-unsigned char **lbximg_getframe(struct lbx_image *img, int frame)
+unsigned char **lbx_img_getframe(struct lbx_image *img, int frame)
 {
        if (frame >= img->frames || frame < 0) {
                lbx_error_raise(LBX_ENOENT);
@@ -360,7 +357,7 @@ unsigned char **lbximg_getframe(struct lbx_image *img, int frame)
 
                /* We must have previous frame decoded to continue. */
                if (frame > img->currentframe + 1) {
-                       if (!lbximg_getframe(img, frame-1))
+                       if (!lbx_img_getframe(img, frame-1))
                                return NULL;
                }
        }
@@ -390,8 +387,8 @@ unsigned char **lbximg_getframe(struct lbx_image *img, int frame)
 }
 
 int
-lbximg_loadpalette(void *f, const struct lbx_file_ops *fops,
-                   struct lbx_colour palette[static 256])
+lbx_img_loadpalette(void *f, const struct lbx_file_ops *fops,
+                    struct lbx_colour palette[static 256])
 {
        unsigned char entry[4];
        int i;
@@ -420,7 +417,7 @@ lbximg_loadpalette(void *f, const struct lbx_file_ops *fops,
 }
 
 int
-lbximg_getpalette(struct lbx_image *img, struct lbx_colour palette[static 256])
+lbx_img_getpalette(struct lbx_image *img, struct lbx_colour palette[static 256])
 {
        unsigned char entry[4];
        unsigned int i;
@@ -460,7 +457,7 @@ readerr:
        return -1;
 }
 
-void lbximg_getinfo(struct lbx_image *img, struct lbx_imginfo *info)
+void lbx_img_getinfo(struct lbx_image *img, struct lbx_imginfo *info)
 {
        *info = (struct lbx_imginfo) {
                .width      = img->width,
@@ -480,12 +477,12 @@ void lbximg_getinfo(struct lbx_image *img, struct lbx_imginfo *info)
        }
 }
 
-unsigned char **lbximg_getmask(struct lbx_image *img)
+unsigned char **lbx_img_getmask(struct lbx_image *img)
 {
        return img->mask;
 }
 
-int lbximg_close(struct lbx_image *img)
+int lbx_img_close(struct lbx_image *img)
 {
        int rc = 0;