2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program 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
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2005 Blender Foundation
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): Austin Benesh. Ton Roosendaal.
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file blender/imbuf/intern/IMB_metadata.h
33 #ifndef __IMB_METADATA_H__
34 #define __IMB_METADATA_H__
38 typedef struct ImMetaData {
39 struct ImMetaData *next, *prev;
45 /** The metadata is a list of key/value pairs (both char *) that can me
46 * saved in the header of several image formats.
47 * Apart from some common keys like
48 * 'Software' and 'Description' (png standard) we'll use keys within the
49 * Blender namespace, so should be called 'Blender::StampInfo' or 'Blender::FrameNum'
54 /* free blender ImMetaData struct */
55 void IMB_metadata_free(struct ImBuf *img);
57 /** read the field from the image info into the field
58 * \param img - the ImBuf that contains the image data
59 * \param key - the key of the field
60 * \param value - the data in the field, first one found with key is returned,
61 * memory has to be allocated by user.
62 * \param len - length of value buffer allocated by user.
63 * \return - 1 (true) if ImageInfo present and value for the key found, 0 (false) otherwise
65 bool IMB_metadata_get_field(struct ImBuf *img, const char *key, char *value, const size_t len);
67 /** set user data in the ImMetaData struct, which has to be allocated with IMB_metadata_create
68 * before calling this function.
69 * \param img - the ImBuf that contains the image data
70 * \param key - the key of the field
71 * \param value - the data to be written to the field. zero terminated string
72 * \return - 1 (true) if ImageInfo present, 0 (false) otherwise
74 bool IMB_metadata_add_field(struct ImBuf *img, const char *key, const char *value);
76 /** delete the key/field par in the ImMetaData struct.
77 * \param img - the ImBuf that contains the image data
78 * \param key - the key of the field
79 * \return - 1 (true) if delete the key/field, 0 (false) otherwise
81 bool IMB_metadata_del_field(struct ImBuf *img, const char *key);
83 #endif /* __IMB_METADATA_H__ */