summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscuri <scuri>2010-08-13 14:19:48 +0000
committerscuri <scuri>2010-08-13 14:19:48 +0000
commit85b707fd418f93cadfa0c2bbf3776c41b5899ac1 (patch)
treeed3e47c25b8379da166c1fdfb7e2ea1ec9eca32c
parentd5ddef516e5dcdf71dec2d2f83f81c4341af9086 (diff)
Fixed: write support for alpha in TGA format. (Thanks to Nicolas Noble)
-rw-r--r--html/en/history.html9
-rw-r--r--include/im_format_all.h2
-rw-r--r--src/im_format_tga.cpp11
3 files changed, 19 insertions, 3 deletions
diff --git a/html/en/history.html b/html/en/history.html
index 4455158..89ff861 100644
--- a/html/en/history.html
+++ b/html/en/history.html
@@ -26,6 +26,15 @@
<h2>History of Changes</h2>
<h3 dir="ltr">
+ CVS (12/Aug/2010)</h3>
+<ul dir="ltr">
+ <li dir="ltr"><span style="color: #008000">
+ <span
+ style="color: #000000">
+ <span class="hist_fixed">Fixed:</span> write support for alpha in TGA
+ format. (Thanks to Nicolas Noble)</span></span></li>
+</ul>
+<h3 dir="ltr">
<a href="http://sourceforge.net/projects/imtoolkit/files/3.6.2/">Version 3.6.2</a> (22/Jun/2010)</h3>
<ul dir="ltr">
<li dir="ltr"><span class="hist_new">New:</span><span style="color: #008000"><span
diff --git a/include/im_format_all.h b/include/im_format_all.h
index 3c8e9b4..b1af911 100644
--- a/include/im_format_all.h
+++ b/include/im_format_all.h
@@ -439,7 +439,7 @@ void imFormatRegisterPCX(void);
NONE - no compression [default]
RLE - Run Lenght Encoding
Only one image.
- No alpha channel.
+ Can have an alpha channel (only for RGB)
Internally the components are always packed.
Internally the lines are arranged from bottom up to top or from top down to bottom.
diff --git a/src/im_format_tga.cpp b/src/im_format_tga.cpp
index 86e968a..9590c13 100644
--- a/src/im_format_tga.cpp
+++ b/src/im_format_tga.cpp
@@ -2,7 +2,7 @@
* \brief TGA - Truevision Graphics Adapter File
*
* See Copyright Notice in im_lib.h
- * $Id: im_format_tga.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $
+ * $Id: im_format_tga.cpp,v 1.3 2010/08/13 14:19:49 scuri Exp $
*/
#include "im_format.h"
@@ -475,7 +475,14 @@ int imFileFormatTGA::WriteImageInfo()
this->image_type = 1;
break;
case IM_RGB:
- this->bpp = 24;
+ if (imColorModeHasAlpha(this->user_color_mode))
+ {
+ this->bpp = 32;
+ this->file_color_mode |= IM_ALPHA;
+ }
+ else
+ this->bpp = 24;
+
this->file_color_mode |= IM_PACKED;
if (imStrEqual(this->compression, "RLE"))
this->image_type = 10;