From 7c0c85a86aa73c0c495523f994f8412e377a8195 Mon Sep 17 00:00:00 2001 From: Pixel Date: Mon, 14 Jun 2010 23:47:31 -0700 Subject: Upgrading im to 3.6 --- im/include/im.h | 2 +- im/include/im_binfile.h | 2 +- im/include/im_image.h | 28 +++++++++++++++++++++------- im/include/im_lib.h | 10 +++++----- im/include/im_math.h | 8 ++++---- im/include/im_process_loc.h | 6 ++++-- im/include/im_process_pon.h | 22 ++++++++++++++++++---- im/include/imlua.h | 14 +++----------- 8 files changed, 57 insertions(+), 35 deletions(-) (limited to 'im/include') diff --git a/im/include/im.h b/im/include/im.h index a324199..307e0a3 100755 --- a/im/include/im.h +++ b/im/include/im.h @@ -235,7 +235,7 @@ int imFileWriteImageData(imFile* ifile, void* data); * \ingroup format */ void imFormatRegisterInternal(void); -/** Remove all registered formats. +/** Remove all registered formats. Call this if you are checking memory leaks. * \ingroup format */ void imFormatRemoveAll(void); diff --git a/im/include/im_binfile.h b/im/include/im_binfile.h index 08af47a..ffcf8da 100755 --- a/im/include/im_binfile.h +++ b/im/include/im_binfile.h @@ -217,7 +217,7 @@ typedef imBinFileBase* (*imBinFileNewFunc)(); * Returns the new function set id.\n * Accepts up to 10 modules. * \ingroup binfile */ -int imBinFileRegisterModule(imBinFileNewFunc pNewFunc); +extern "C" int imBinFileRegisterModule(imBinFileNewFunc pNewFunc); #endif diff --git a/im/include/im_image.h b/im/include/im_image.h index 12dbad8..6a325c1 100755 --- a/im/include/im_image.h +++ b/im/include/im_image.h @@ -103,12 +103,18 @@ imImage* imImageCreateBased(const imImage* image, int width, int height, int col * \ingroup imgclass */ void imImageDestroy(imImage* image); -/** Adds an alpha channel plane. +/** Adds an alpha channel plane and sets its value to 0 (transparent). * * \verbatim image:AddAlpha() [in Lua 5] \endverbatim * \ingroup imgclass */ void imImageAddAlpha(imImage* image); +/** Sets the alpha channel plane to a constant. + * + * \verbatim image:SetAlpha() [in Lua 5] \endverbatim + * \ingroup imgclass */ +void imImageSetAlpha(imImage* image, float alpha); + /** Changes the buffer size. Reallocate internal buffers if the new size is larger than the original. * * \verbatim image:Reshape(width: number, height: number) [in Lua 5] \endverbatim @@ -129,6 +135,20 @@ void imImageCopy(const imImage* src_image, imImage* dst_image); * \ingroup imgclass */ 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. + * + * \verbatim image:CopyAttributes(dst_image: imImage) [in Lua 5] \endverbatim + * \ingroup imgclass */ +void imImageCopyAttributes(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. + * + * \verbatim image:CopyPlane(src_plane: number, dst_image: imImage, dst_plane: number) [in Lua 5] \endverbatim + * \ingroup imgclass */ +void imImageCopyPlane(const imImage* src_image, int src_plane, imImage* dst_image, int dst_plane); + /** Creates a copy of the image. * * \verbatim image:Duplicate() -> new_image: imImage [in Lua 5] \endverbatim @@ -190,12 +210,6 @@ int imImageIsBitmap(const imImage* image); * \ingroup imgclass */ void imImageSetPalette(imImage* image, long* palette, int palette_count); -/** Copies the image attributes from src to dst. - * - * \verbatim image:CopyAttributes(dst_image: imImage) [in Lua 5] \endverbatim - * \ingroup imgclass */ -void imImageCopyAttributes(const imImage* src_image, imImage* dst_image); - /** Returns 1 if the images match width and height. Returns 0 otherwise. * * \verbatim image:MatchSize(image2: imImage) -> match: boolean [in Lua 5] \endverbatim diff --git a/im/include/im_lib.h b/im/include/im_lib.h index b72b646..964faee 100755 --- a/im/include/im_lib.h +++ b/im/include/im_lib.h @@ -30,10 +30,10 @@ extern "C" { * @{ */ #define IM_AUTHOR "Antonio Scuri" -#define IM_COPYRIGHT "Copyright (C) 1994-2009 Tecgraf, PUC-Rio." -#define IM_VERSION "3.5" /* bug fixes are reported only by imVersion functions */ -#define IM_VERSION_NUMBER 305000 -#define IM_VERSION_DATE "2009/10/02" +#define IM_COPYRIGHT "Copyright (C) 1994-2010 Tecgraf, PUC-Rio." +#define IM_VERSION "3.6" /* bug fixes are reported only by imVersion functions */ +#define IM_VERSION_NUMBER 306000 +#define IM_VERSION_DATE "2010/01/26" #define IM_DESCRIPTION "Image Representation, Storage, Capture and Processing" #define IM_NAME "IM - An Imaging Toolkit" /** @} */ @@ -105,7 +105,7 @@ int imVersionNumber(void); \verbatim **************************************************************************** -Copyright (C) 1994-2009 Tecgraf, PUC-Rio. +Copyright (C) 1994-2010 Tecgraf, PUC-Rio. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/im/include/im_math.h b/im/include/im_math.h index 8e9b3dd..1a05d3d 100755 --- a/im/include/im_math.h +++ b/im/include/im_math.h @@ -195,7 +195,7 @@ inline T imBilinearInterpolation(int width, int height, T *map, float xl, float x1 = x0 = 0; t = 0; } - else if (xl > width-0.5) + else if (xl >= width-0.5) { x1 = x0 = width-1; t = 0; @@ -212,7 +212,7 @@ inline T imBilinearInterpolation(int width, int height, T *map, float xl, float y1 = y0 = 0; u = 0; } - else if (yl > height-0.5) + else if (yl >= height-0.5) { y1 = y0 = height-1; u = 0; @@ -244,7 +244,7 @@ inline T imBicubicInterpolation(int width, int height, T *map, float xl, float y float t, u; (void)Dummy; - if (xl > width-0.5) + if (xl >= width-0.5) { X[3] = X[2] = X[1] = width-1; X[0] = X[1]-1; @@ -265,7 +265,7 @@ inline T imBicubicInterpolation(int width, int height, T *map, float xl, float y t = xl - (X[1]+0.5f); } - if (yl > height-0.5) + if (yl >= height-0.5) { Y[3] = Y[2] = Y[1] = height-1; Y[0] = Y[1]-1; diff --git a/im/include/im_process_loc.h b/im/include/im_process_loc.h index 44e8281..14c1de5 100755 --- a/im/include/im_process_loc.h +++ b/im/include/im_process_loc.h @@ -17,7 +17,8 @@ extern "C" { /** \defgroup resize Image Resize * \par - * Operations to change the image size. + * Operations to change the image size. \n + * All size operations include the alpha channel if any. * \par * See \ref im_process_loc.h * \ingroup process */ @@ -87,7 +88,8 @@ void imProcessAddMargins(const imImage* src_image, imImage* dst_image, int xmin, /** \defgroup geom Geometric Operations * \par - * Operations to change the shape of the image. + * Operations to change the shape of the image. \n + * All geometric operations include the alpha channel if any. * \par * See \ref im_process_loc.h * \ingroup process */ diff --git a/im/include/im_process_pon.h b/im/include/im_process_pon.h index 0611cc6..635448a 100755 --- a/im/include/im_process_pon.h +++ b/im/include/im_process_pon.h @@ -126,6 +126,20 @@ void imProcessBlendConst(const imImage* src_image1, const imImage* src_image2, i * \ingroup arithm */ void imProcessBlend(const imImage* src_image1, const imImage* src_image2, const imImage* alpha_image, imImage* dst_image); +/** Compose two images that have an alpha channel using the OVER operator. \n + * Can be done in place, images must match size and type. \n + * Integer alpha values must be: +\verbatim +0 - 255 IM_BYTE +0 - 65535 IM_USHORT +0 - 2147483647 IM_INT +\endverbatim + * that will be normalized to 0 - 1. + * \verbatim im.ProcessCompose(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] \endverbatim + * \verbatim im.ProcessComposeNew(image1: imImage, image2: imImage) -> new_image: imImage [in Lua 5] \endverbatim + * \ingroup arithm */ +void imProcessCompose(const imImage* src_image1, const imImage* src_image2, imImage* dst_image); + /** Split a complex image into two images with real and imaginary parts \n * or magnitude and phase parts (polar). \n * Source image must be IM_CFLOAT, destiny images must be IM_FLOAT. @@ -268,18 +282,18 @@ void imProcessSplitHSI(const imImage* src_image, imImage* h_image, imImage* s_im * \ingroup colorproc */ void imProcessMergeHSI(const imImage* h_image, const imImage* s_image, const imImage* i_image, imImage* dst_image); -/** Split a multicomponent image into separate components.\n +/** Split a multicomponent image into separate components, including alpha.\n * Destiny images must be IM_GRAY. Size and data types must be all the same.\n - * The number of destiny images must match the depth of the source image. + * The number of destiny images must match the depth of the source image, including alpha. * * \verbatim im.ProcessSplitComponents(src_image: imImage, dst_image_list: table of imImage) [in Lua 5] \endverbatim * \verbatim im.ProcessSplitComponentsNew(src_image: imImage) -> dst_image_list: table of imImage [in Lua 5] \endverbatim * \ingroup colorproc */ void imProcessSplitComponents(const imImage* src_image, imImage** dst_image_list); -/** Merges separate components into a multicomponent image.\n +/** Merges separate components into a multicomponent image, including alpha.\n * Source images must be IM_GRAY. Size and data types must be all the same.\n - * The number of source images must match the depth of the destiny image. + * The number of source images must match the depth of the destiny image, including alpha. * * \verbatim im.ProcessMergeComponents(src_image_list: table of imImage, dst_image: imImage) [in Lua 5] \endverbatim * \verbatim im.ProcessMergeComponentsNew(src_image_list: table of imImage) -> dst_image: imImage [in Lua 5] \endverbatim diff --git a/im/include/imlua.h b/im/include/imlua.h index 5714dff..ad61889 100755 --- a/im/include/imlua.h +++ b/im/include/imlua.h @@ -11,23 +11,13 @@ extern "C" { #endif -/** \defgroup imlua IM Lua 5 Binding +/** \defgroup imlua ImLua 5 Binding Reference * \par * Binding for the Lua 5 scripting language. \n * Lua 5.1 Copyright (C) 1994-2005 Lua.org, PUC-Rio \n * R. Ierusalimschy, L. H. de Figueiredo & W. Celes \n * http://www.lua.org * \par - * The name of the functions were changed because of the namespace "im" and because of the object orientation. \n - * As a general rule use: -\verbatim - imXxx -> im.Xxx - IM_XXX -> im.XXX - imFileXXX(ifile,... -> ifile:XXX(... - imImageXXX(image,... -> image:XXX(... -\endverbatim - * All the objects are garbage collected by the Lua garbage collector. - * \par * See \ref imlua.h * \ingroup util */ @@ -44,6 +34,7 @@ void imlua_open(void); int imlua_open(lua_State *L); int luaopen_imlua(lua_State *L); +#ifdef __IM_IMAGE_H /* must include im_image.h before this */ /** Pushes an image as a metatable on the stack. * \ingroup imlua */ void imlua_pushimage(lua_State *L, imImage* image); @@ -51,6 +42,7 @@ void imlua_pushimage(lua_State *L, imImage* image); /** Gets an image as a metatable from the stack, checks for correct type. * \ingroup imlua */ imImage* imlua_checkimage(lua_State *L, int param); +#endif /** Initializes the Lua binding of the capture library. \n * Returns 1 (leaves the "im" table on the top of the stack). -- cgit v1.2.3