From b2257ad3263f1eaf8dcf637edb480e0c8274fd73 Mon Sep 17 00:00:00 2001 From: scuri Date: Mon, 4 Apr 2011 20:42:46 +0000 Subject: # New: function imImageMergeAttributes. --- include/im_attrib.h | 4 ++++ include/im_attrib_flat.h | 1 + include/im_image.h | 10 +++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/im_attrib.h b/include/im_attrib.h index 76302ef..f7d5b0e 100644 --- a/include/im_attrib.h +++ b/include/im_attrib.h @@ -45,6 +45,10 @@ public: void CopyFrom(const imAttribTable& table) { imAttribTableCopyFrom(ptable, table.ptable); } + /** Merges the contents of the given table into this table. */ + void MergeFrom(const imAttribTable& table) + { imAttribTableMergeFrom(ptable, table.ptable); } + /** Inserts an attribute into the table. \n * If data_type is BYTE then count can be -1 to indicate a NULL terminated string. * Data is duplicated if not NULL, else data is initialized with zeros. diff --git a/include/im_attrib_flat.h b/include/im_attrib_flat.h index db6c2d8..8b5af2d 100644 --- a/include/im_attrib_flat.h +++ b/include/im_attrib_flat.h @@ -25,6 +25,7 @@ const void* imAttribTableGet(const imAttribTablePrivate* ptable, const char *nam void imAttribTableSet(imAttribTablePrivate* ptable, const char* name, int data_type, int count, const void* data); void imAttribTableUnSet(imAttribTablePrivate* ptable, const char *name); void imAttribTableCopyFrom(imAttribTablePrivate* ptable_dst, const imAttribTablePrivate* ptable_src); +void imAttribTableMergeFrom(imAttribTablePrivate* ptable_dst, const imAttribTablePrivate* ptable_src); void imAttribTableForEach(const imAttribTablePrivate* ptable, void* user_data, imAttribTableCallback attrib_func); imAttribTablePrivate* imAttribArrayCreate(int hash_size); diff --git a/include/im_image.h b/include/im_image.h index 6c1a084..bd13c24 100644 --- a/include/im_image.h +++ b/include/im_image.h @@ -136,12 +136,20 @@ void imImageCopy(const imImage* src_image, imImage* dst_image); void imImageCopyData(const imImage* src_image, imImage* dst_image); /** Copies the image attributes from src to dst. - * Includes the pallete when a MAP or GRAY image. + * Includes the pallete if defined in both images. * * \verbatim image:CopyAttributes(dst_image: imImage) [in Lua 5] \endverbatim * \ingroup imgclass */ void imImageCopyAttributes(const imImage* src_image, imImage* dst_image); +/** Merges the image attributes from src to dst. \n + * Attributes that exist in dst are not replaced. + * Doens NOT include the pallete. + * + * \verbatim image:MergeAttributes(dst_image: imImage) [in Lua 5] \endverbatim + * \ingroup imgclass */ +void imImageMergeAttributes(const imImage* src_image, imImage* dst_image); + /** Copy one image plane fom one image to another. \n * Images must have the same size and type. * -- cgit v1.2.3