Blender V4.3
metadata.cc File Reference
#include <cstdlib>
#include <cstring>
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_idprop.hh"
#include "DNA_ID.h"
#include "IMB_imbuf_types.hh"
#include "IMB_metadata.hh"

Go to the source code of this file.

Functions

void IMB_metadata_ensure (IDProperty **metadata)
 
void IMB_metadata_free (IDProperty *metadata)
 
bool IMB_metadata_get_field (const IDProperty *metadata, const char *key, char *value, const size_t value_maxncpy)
 
void IMB_metadata_copy (ImBuf *ibuf_dst, const ImBuf *ibuf_src)
 
void IMB_metadata_set_field (IDProperty *metadata, const char *key, const char *value)
 
void IMB_metadata_foreach (ImBuf *ibuf, IMBMetadataForeachCb callback, void *userdata)
 

Function Documentation

◆ IMB_metadata_copy()

◆ IMB_metadata_ensure()

void IMB_metadata_ensure ( IDProperty ** metadata)

The metadata is a list of key/value pairs (both char *) that can me saved in the header of several image formats. Apart from some common keys like 'Software' and 'Description' (PNG standard) we'll use keys within the Blender namespace, so should be called 'Blender::StampInfo' or 'Blender::FrameNum' etc...

The keys & values are stored in ID properties, in the group "metadata". Ensure that the metadata property is a valid IDProperty object. This is a no-op when *metadata != NULL.

Definition at line 24 of file metadata.cc.

References blender::bke::idprop::create_group().

Referenced by BKE_imbuf_stamp_info(), BKE_stamp_info_from_imbuf(), blend_file_thumb_from_camera(), blend_file_thumb_from_screenshot(), blender::imbuf::get_oiio_ibuf(), ibJpegImageFromCinfo(), IMB_anim_load_metadata(), IMB_anim_previewframe(), imb_load_openexr(), IMB_thumb_load_image(), and thumb_create_ex().

◆ IMB_metadata_foreach()

◆ IMB_metadata_free()

void IMB_metadata_free ( IDProperty * metadata)

Definition at line 33 of file metadata.cc.

References IDP_FreeProperty().

Referenced by IMB_free_anim(), IMB_freeImBuf(), and IMB_metadata_copy().

◆ IMB_metadata_get_field()

bool IMB_metadata_get_field ( const IDProperty * metadata,
const char * key,
char * value,
size_t value_maxncpy )

Read the field from the image info into the field.

Parameters
metadatathe IDProperty that contains the metadata
keythe key of the field
valuethe data in the field, first one found with key is returned, memory has to be allocated by user.
lenlength of value buffer allocated by user.
Returns
1 (true) if metadata is present and value for the key found, 0 (false) otherwise.

Definition at line 42 of file metadata.cc.

References BLI_strncpy(), IDP_GetPropertyFromGroup(), IDP_STRING, IDP_String, and IDProperty::type.

Referenced by file_draw_tooltip_custom_func(), IMB_thumb_manage(), metadata_get_field(), metadata_is_valid(), and uiTemplateRecentFiles_tooltip_func().

◆ IMB_metadata_set_field()

void IMB_metadata_set_field ( IDProperty * metadata,
const char * key,
const char * value )

Set user data in the metadata. If the field already exists its value is overwritten, otherwise the field will be added with the given value.

Parameters
metadatathe IDProperty that contains the metadata
keythe key of the field
valuethe data to be written to the field. zero terminated string

Definition at line 69 of file metadata.cc.

References BLI_assert, blender::bke::idprop::create(), IDP_AddToGroup(), IDP_AssignString(), IDP_FreeFromGroup(), IDP_GetPropertyFromGroup(), IDP_STRING, and IDProperty::type.

Referenced by blend_file_thumb_from_camera(), blend_file_thumb_from_screenshot(), blender::imbuf::get_oiio_ibuf(), ibJpegImageFromCinfo(), IMB_anim_load_metadata(), IMB_anim_previewframe(), imb_load_openexr(), IMB_thumb_load_image(), metadata_set_field(), and thumb_create_ex().