1 /*****************************************************************************
2 * This file is part of gfxprim library. *
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. *
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. *
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 *
19 * Copyright (C) 2009-2014 Cyril Hrubis <metan@ucw.cz> *
21 *****************************************************************************/
25 PNG support using libpng library.
29 #ifndef LOADERS_GP_PNG_H
30 #define LOADERS_GP_PNG_H
32 #include "loaders/GP_Loader.h"
35 * Loads a PNG image from a file.
37 GP_Pixmap
*GP_LoadPNG(const char *src_path
, GP_ProgressCallback
*callback
);
40 * Extended load function.
42 int GP_ReadPNGEx(GP_IO
*io
, GP_Pixmap
**img
,
43 GP_DataStorage
*storage
, GP_ProgressCallback
*callback
);
44 int GP_LoadPNGEx(const char *src_path
, GP_Pixmap
**img
,
45 GP_DataStorage
*storage
, GP_ProgressCallback
*callback
);
48 * Reads a PNG from an IO stream.
50 * Returns newly allocated pixmap cotaining the loaded image or in case of
51 * failure NULL and errno is set.
53 GP_Pixmap
*GP_ReadPNG(GP_IO
*io
, GP_ProgressCallback
*callback
);
56 * Writes PNG into an I/O stream.
58 int GP_SavePNG(const GP_Pixmap
*src
, const char *dst_path
,
59 GP_ProgressCallback
*callback
);
62 * Saves PNG to a file.
64 int GP_SavePNG(const GP_Pixmap
*src
, const char *dst_path
,
65 GP_ProgressCallback
*callback
);
68 * Looks for PNG file signature. Returns non-zero if found.
70 int GP_MatchPNG(const void *buf
);
72 extern GP_Loader GP_PNG
;
74 #endif /* LOADERS_GP_PNG_H */