summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html/en/history.html3
-rw-r--r--include/im_format_all.h2
-rw-r--r--src/im_format_ico.cpp12
3 files changed, 11 insertions, 6 deletions
diff --git a/html/en/history.html b/html/en/history.html
index 80446f5..1b815be 100644
--- a/html/en/history.html
+++ b/html/en/history.html
@@ -18,6 +18,9 @@
<span
style="color: #000000"> <span style="color: #0000FF">New:</span>
function <strong>imVideoCaptureReleaseDevices</strong>.</span></span></li>
+ <li dir="ltr">
+ <span style="color: #008000">Changed:</span> ICON format now supports
+ writing up to 10 images.</li>
</ul>
<h3 dir="ltr">
<a href="http://sourceforge.net/projects/imtoolkit/files/3.6.1/">Version 3.6.1</a> (23/Apr/2010)</h3>
diff --git a/include/im_format_all.h b/include/im_format_all.h
index dc07886..3c8e9b4 100644
--- a/include/im_format_all.h
+++ b/include/im_format_all.h
@@ -498,7 +498,7 @@ void imFormatRegisterPNM(void);
Color Spaces: RGB, MAP and Binary (Gray saved as MAP)
Compressions:
NONE - no compression [default]
- Can have more than one image. But writing is limited to 5 images,
+ Can have more than one image. But reading and writing is limited to 10 images max,
and all images must have different sizes and bpp.
Can have an alpha channel (only for RGB)
Internally the components are always packed.
diff --git a/src/im_format_ico.cpp b/src/im_format_ico.cpp
index b10f30e..7079952 100644
--- a/src/im_format_ico.cpp
+++ b/src/im_format_ico.cpp
@@ -2,7 +2,7 @@
* \brief ICO - Windows Icon
*
* See Copyright Notice in im_lib.h
- * $Id: im_format_ico.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $
+ * $Id: im_format_ico.cpp,v 1.3 2010/04/30 18:06:31 scuri Exp $
*/
#include "im_format.h"
@@ -49,11 +49,13 @@ static const char* iICOCompTable[1] =
"NONE"
};
+#define IMICON_MAX 10
+
class imFileFormatICO: public imFileFormatBase
{
imBinFile* handle; /* the binary file handle */
unsigned short bpp; /* number of bits per pixel */
- unsigned int offset[10],
+ unsigned int offset[IMICON_MAX],
next_offset;
int line_raw_size; // raw line size
@@ -134,7 +136,7 @@ int imFileFormatICO::Open(const char* file_name)
/* reads the number of images */
imBinFileRead(handle, &word, 1, 2);
- this->image_count = word > 10? 10: word;
+ this->image_count = word > IMICON_MAX? IMICON_MAX: word;
strcpy(this->compression, "NONE");
for (int i = 0; i < this->image_count; i++)
@@ -170,7 +172,7 @@ int imFileFormatICO::New(const char* file_name)
imBinFileWrite(handle, &word_value, 1, 2); /* resource type */
imBinFileWrite(handle, &word_value, 1, 2); /* number of images, at least one, must update at close */
- this->next_offset = 6 + 5 * 16; // offset to the first image, room for 5 ICONDIRENTRY
+ this->next_offset = 6 + IMICON_MAX * 16; // offset to the first image, room for IMICON_MAX ICONDIRENTRY
return IM_ERR_NONE;
}
@@ -285,7 +287,7 @@ int imFileFormatICO::WriteImageInfo()
this->file_data_type = IM_BYTE;
this->file_color_mode = imColorModeSpace(this->user_color_mode);
- if (this->image_count == 5)
+ if (this->image_count == IMICON_MAX)
return IM_ERR_DATA;
if (this->width > 255 || this->height > 255)