summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscuri <scuri>2010-01-07 19:12:08 +0000
committerscuri <scuri>2010-01-07 19:12:08 +0000
commita091243647ef5905e214b98fb42c5c3e334d2b64 (patch)
tree9df5ce8f92806ebb542a883aeccdb5683e3a4e1b
parentf7cb3c864a65132c672da90a81627e49c98a1ca9 (diff)
Included alpha support in all geometric and size operations.
-rw-r--r--html/en/history.html10
-rw-r--r--include/im_process_loc.h6
-rw-r--r--include/im_process_pon.h8
-rw-r--r--src/process/im_geometric.cpp37
-rw-r--r--src/process/im_resize.cpp24
5 files changed, 53 insertions, 32 deletions
diff --git a/html/en/history.html b/html/en/history.html
index 38ec86a..0c6210a 100644
--- a/html/en/history.html
+++ b/html/en/history.html
@@ -19,17 +19,21 @@
<li dir="ltr">
<span style="color: #008000">Changed:</span> libTIFF updated to version
3.9.2.</li>
+ <li dir="ltr">
+ <span style="color: #008000">Changed:</span>
+ <span style="color: #008000"><span
+ style="color: #000000"> included alpha support in <strong>
+ imProcessSplitComponents</strong> and <strong>imProcessMergeComponents</strong>.
+ Included alpha support in all geometric and size operations.</span></span></li>
<li dir="ltr"><span style="color: #008000"><span style="color: #ff0000">Fixed:</span><span
style="color: #000000"> invalid memory access in <strong>
imAnalyzeFindRegions</strong> when more than 16k regions where found.</span></span></li>
<li dir="ltr"><span style="color: #008000"><span style="color: #ff0000">Fixed:</span><span
style="color: #000000"> memory leak in <strong>imFileOpen</strong>.</span></span></li>
<li dir="ltr"><span style="color: #008000"><span style="color: #ff0000">Fixed:</span><span
- style="color: #000000"> alpha support in <strong>
- imProcessSplitComponents</strong> and <strong>imProcessMergeComponents</strong>.</span></span></li>
- <li dir="ltr"><span style="color: #008000"><span style="color: #ff0000">Fixed:</span><span
style="color: #000000"> alpha support in image:<strong>CopyPlane</strong>()
and in channel indexing in Lua.</span></span></li>
+ <li dir="ltr"></li>
</ul>
<h3 dir="ltr">
<a href="http://sourceforge.net/projects/imtoolkit/files/3.5/">Version 3.5</a> (02/Oct/2009)</h3>
diff --git a/include/im_process_loc.h b/include/im_process_loc.h
index 44e8281..14c1de5 100644
--- a/include/im_process_loc.h
+++ b/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/include/im_process_pon.h b/include/im_process_pon.h
index 0611cc6..2420360 100644
--- a/include/im_process_pon.h
+++ b/include/im_process_pon.h
@@ -268,18 +268,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/src/process/im_geometric.cpp b/src/process/im_geometric.cpp
index a0b5129..d4dbed3 100644
--- a/src/process/im_geometric.cpp
+++ b/src/process/im_geometric.cpp
@@ -2,7 +2,7 @@
* \brief Geometric Operations
*
* See Copyright Notice in im_lib.h
- * $Id: im_geometric.cpp,v 1.1 2008/10/17 06:16:33 scuri Exp $
+ * $Id: im_geometric.cpp,v 1.2 2010/01/07 19:12:53 scuri Exp $
*/
@@ -393,7 +393,8 @@ static void InterlaceSplit(int src_width,
void imProcessRotate90(const imImage* src_image, imImage* dst_image, int dir)
{
- for (int i = 0; i < src_image->depth; i++)
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
+ for (int i = 0; i < src_depth; i++)
{
switch(src_image->data_type)
{
@@ -418,7 +419,8 @@ void imProcessRotate90(const imImage* src_image, imImage* dst_image, int dir)
void imProcessRotate180(const imImage* src_image, imImage* dst_image)
{
- for (int i = 0; i < src_image->depth; i++)
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
+ for (int i = 0; i < src_depth; i++)
{
switch(src_image->data_type)
{
@@ -446,9 +448,10 @@ int imProcessRadial(const imImage* src_image, imImage* dst_image, float k1, int
int ret = 0;
int counter = imCounterBegin("Radial Distort");
- imCounterTotal(counter, dst_image->depth*dst_image->height, "Processing...");
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
+ imCounterTotal(counter, src_depth*dst_image->height, "Processing..."); /* size of the destiny image */
- for (int i = 0; i < src_image->depth; i++)
+ for (int i = 0; i < src_depth; i++)
{
switch(src_image->data_type)
{
@@ -483,9 +486,10 @@ int imProcessSwirl(const imImage* src_image, imImage* dst_image, float k, int or
int ret = 0;
int counter = imCounterBegin("Swirl Distort");
- imCounterTotal(counter, dst_image->depth*dst_image->height, "Processing...");
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
+ imCounterTotal(counter, src_depth*dst_image->height, "Processing..."); /* size of the destiny image */
- for (int i = 0; i < src_image->depth; i++)
+ for (int i = 0; i < src_depth; i++)
{
switch(src_image->data_type)
{
@@ -559,7 +563,8 @@ int imProcessRotate(const imImage* src_image, imImage* dst_image, double cos0, d
int ret = 0;
int counter = imCounterBegin("Rotate");
- imCounterTotal(counter, dst_image->depth*dst_image->height, "Processing...");
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
+ imCounterTotal(counter, src_depth*dst_image->height, "Processing..."); /* size of the destiny image */
if (src_image->color_space == IM_MAP)
{
@@ -567,7 +572,7 @@ int imProcessRotate(const imImage* src_image, imImage* dst_image, double cos0, d
}
else
{
- for (int i = 0; i < src_image->depth; i++)
+ for (int i = 0; i < src_depth; i++)
{
switch(src_image->data_type)
{
@@ -603,7 +608,8 @@ int imProcessRotateRef(const imImage* src_image, imImage* dst_image, double cos0
int ret = 0;
int counter = imCounterBegin("RotateRef");
- imCounterTotal(counter, dst_image->depth*dst_image->height, "Processing...");
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
+ imCounterTotal(counter, src_depth*dst_image->height, "Processing..."); /* size of the destiny image */
if (src_image->color_space == IM_MAP)
{
@@ -611,7 +617,7 @@ int imProcessRotateRef(const imImage* src_image, imImage* dst_image, double cos0
}
else
{
- for (int i = 0; i < src_image->depth; i++)
+ for (int i = 0; i < src_depth; i++)
{
switch(src_image->data_type)
{
@@ -645,8 +651,9 @@ int imProcessRotateRef(const imImage* src_image, imImage* dst_image, double cos0
void imProcessMirror(const imImage* src_image, imImage* dst_image)
{
int i;
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
- for (i = 0; i < src_image->depth; i++)
+ for (i = 0; i < src_depth; i++)
{
switch(src_image->data_type)
{
@@ -672,8 +679,9 @@ void imProcessMirror(const imImage* src_image, imImage* dst_image)
void imProcessFlip(const imImage* src_image, imImage* dst_image)
{
int i;
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
- for (i = 0; i < src_image->depth; i++)
+ for (i = 0; i < src_depth; i++)
{
switch(src_image->data_type)
{
@@ -699,8 +707,9 @@ void imProcessFlip(const imImage* src_image, imImage* dst_image)
void imProcessInterlaceSplit(const imImage* src_image, imImage* dst_image1, imImage* dst_image2)
{
int i;
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
- for (i = 0; i < src_image->depth; i++)
+ for (i = 0; i < src_depth; i++)
{
switch(src_image->data_type)
{
diff --git a/src/process/im_resize.cpp b/src/process/im_resize.cpp
index ddf6e47..4dbaa60 100644
--- a/src/process/im_resize.cpp
+++ b/src/process/im_resize.cpp
@@ -2,7 +2,7 @@
* \brief Image Resize
*
* See Copyright Notice in im_lib.h
- * $Id: im_resize.cpp,v 1.1 2008/10/17 06:16:33 scuri Exp $
+ * $Id: im_resize.cpp,v 1.2 2010/01/07 19:12:53 scuri Exp $
*/
@@ -106,9 +106,10 @@ int imProcessReduce(const imImage* src_image, imImage* dst_image, int order)
int ret = 0;
int counter = imCounterBegin("Reduce Size");
const char* int_msg = (order == 1)? "Bilinear Decimation": "Zero Order Decimation";
- imCounterTotal(counter, src_image->depth*dst_image->height, int_msg);
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
+ imCounterTotal(counter, src_depth*dst_image->height, int_msg);
- for (int i = 0; i < src_image->depth; i++)
+ for (int i = 0; i < src_depth; i++)
{
switch(src_image->data_type)
{
@@ -149,9 +150,10 @@ int imProcessResize(const imImage* src_image, imImage* dst_image, int order)
int ret = 0;
int counter = imCounterBegin("Resize");
const char* int_msg = (order == 3)? "Bicubic Interpolation": (order == 1)? "Bilinear Interpolation": "Zero Order Interpolation";
- imCounterTotal(counter, src_image->depth*dst_image->height, int_msg);
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
+ imCounterTotal(counter, src_depth*dst_image->height, int_msg);
- for (int i = 0; i < src_image->depth; i++)
+ for (int i = 0; i < src_depth; i++)
{
switch(src_image->data_type)
{
@@ -219,8 +221,9 @@ static void ReduceBy4(int src_width,
void imProcessReduceBy4(const imImage* src_image, imImage* dst_image)
{
int i;
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
- for (i = 0; i < src_image->depth; i++)
+ for (i = 0; i < src_depth; i++)
{
switch(src_image->data_type)
{
@@ -246,7 +249,8 @@ void imProcessReduceBy4(const imImage* src_image, imImage* dst_image)
void imProcessCrop(const imImage* src_image, imImage* dst_image, int xmin, int ymin)
{
int type_size = imDataTypeSize(src_image->data_type);
- for (int i = 0; i < src_image->depth; i++)
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
+ for (int i = 0; i < src_depth; i++)
{
imbyte *src_map = (imbyte*)src_image->data[i];
imbyte *dst_map = (imbyte*)dst_image->data[i];
@@ -269,6 +273,7 @@ void imProcessInsert(const imImage* src_image, const imImage* rgn_image, imImage
int dst_offset2 = dst_size1+rgn_image->line_size;
int ymax = ymin+rgn_image->height-1;
int rgn_size = rgn_image->line_size;
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
if (dst_size2 < 0)
{
@@ -280,7 +285,7 @@ void imProcessInsert(const imImage* src_image, const imImage* rgn_image, imImage
if (ymax > src_image->height-1)
ymax = src_image->height-1;
- for (int i = 0; i < src_image->depth; i++)
+ for (int i = 0; i < src_depth; i++)
{
imbyte *src_map = (imbyte*)src_image->data[i];
imbyte *rgn_map = (imbyte*)rgn_image->data[i];
@@ -315,7 +320,8 @@ void imProcessInsert(const imImage* src_image, const imImage* rgn_image, imImage
void imProcessAddMargins(const imImage* src_image, imImage* dst_image, int xmin, int ymin)
{
int type_size = imDataTypeSize(src_image->data_type);
- for (int i = 0; i < src_image->depth; i++)
+ int src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
+ for (int i = 0; i < src_depth; i++)
{
imbyte *dst_map = (imbyte*)dst_image->data[i];
imbyte *src_map = (imbyte*)src_image->data[i];