diff options
author | scuri <scuri> | 2011-04-04 20:42:46 +0000 |
---|---|---|
committer | scuri <scuri> | 2011-04-04 20:42:46 +0000 |
commit | b2257ad3263f1eaf8dcf637edb480e0c8274fd73 (patch) | |
tree | a3838f5b4dccdc7c8bbae13a930e3e9d6738835b /src/im_attrib.cpp | |
parent | 128f620d057c076c445116d264947c993ea5187b (diff) |
# New: function imImageMergeAttributes.
Diffstat (limited to 'src/im_attrib.cpp')
-rw-r--r-- | src/im_attrib.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/im_attrib.cpp b/src/im_attrib.cpp index 10d4599..b2809bb 100644 --- a/src/im_attrib.cpp +++ b/src/im_attrib.cpp @@ -2,7 +2,7 @@ * \brief Attributes Table * * See Copyright Notice in im_lib.h - * $Id: im_attrib.cpp,v 1.3 2009/08/22 04:31:04 scuri Exp $ + * $Id: im_attrib.cpp,v 1.4 2011/04/04 20:42:47 scuri Exp $ */ #include <stdlib.h> @@ -305,6 +305,20 @@ void imAttribTableCopyFrom(imAttribTablePrivate* ptable_dst, const imAttribTable imAttribTableForEach(ptable_src, (void*)ptable_dst, iCopyFunc); } +static int iMergeFunc(void* user_data, int index, const char* name, int data_type, int count, const void* data) +{ + (void)index; + imAttribTablePrivate* ptable = (imAttribTablePrivate*)user_data; + if (!imAttribTableGet(ptable, name, NULL, NULL)) + imAttribTableSet(ptable, name, data_type, count, data); + return 1; +} + +void imAttribTableMergeFrom(imAttribTablePrivate* ptable_dst, const imAttribTablePrivate* ptable_src) +{ + imAttribTableForEach(ptable_src, (void*)ptable_dst, iMergeFunc); +} + static int iCopyArrayFunc(void* user_data, int index, const char* name, int data_type, int count, const void* data) { (void)index; |