From a3ef3df6ecc95439e2d6fb909cc30fab77675e9f Mon Sep 17 00:00:00 2001 From: scuri Date: Wed, 19 Jan 2011 16:28:59 +0000 Subject: Fixed: support for alpha with gray images in SGI format. --- html/en/history.html | 9 +++++++++ src/im_format_sgi.cpp | 17 ++++++++++++++++- tecmake.mak | 9 +++++++-- tecmakewin.mak | 2 +- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/html/en/history.html b/html/en/history.html index 6b55c03..525cfe0 100644 --- a/html/en/history.html +++ b/html/en/history.html @@ -25,6 +25,15 @@

History of Changes

+

+ CVS (19/Jan/2011)

+

Version 3.6.3 (09/Nov/2010)

diff --git a/src/im_format_sgi.cpp b/src/im_format_sgi.cpp index 08bbf4d..695340b 100644 --- a/src/im_format_sgi.cpp +++ b/src/im_format_sgi.cpp @@ -2,7 +2,7 @@ * \brief SGI - Silicon Graphics Image File Format * * See Copyright Notice in im_lib.h - * $Id: im_format_sgi.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ + * $Id: im_format_sgi.cpp,v 1.3 2011/01/19 16:28:59 scuri Exp $ */ #include "im_format.h" @@ -300,9 +300,13 @@ int imFileFormatSGI::ReadImageInfo(int index) switch (dimension) { case 1: + // If this value is 1, the image file consists of only 1 channel and only 1 scanline (row). + // Only width is valid. this->height = 1; depth = 1; case 2: + // If this value is 2, the file consists of a single channel with a number of scanlines. + // Only width and height are valid. depth = 1; break; case 3: @@ -319,6 +323,10 @@ int imFileFormatSGI::ReadImageInfo(int index) case 1: this->file_color_mode = IM_GRAY; break; + case 2: + // This is NOT mentioned by the specification, but it is used + this->file_color_mode = IM_GRAY | IM_ALPHA; + break; case 3: this->file_color_mode = IM_RGB; break; @@ -411,6 +419,13 @@ int imFileFormatSGI::WriteImageInfo() if (imColorModeHasAlpha(this->user_color_mode)) this->file_color_mode |= IM_ALPHA; } + else if (this->file_color_mode == IM_GRAY && + imColorModeHasAlpha(this->user_color_mode)) + { + // This is NOT mentioned by the specification, but it is used + dimension = 3; + this->file_color_mode |= IM_ALPHA; + } this->file_data_type = this->user_data_type; diff --git a/tecmake.mak b/tecmake.mak index 3f8c0ab..d8c18bc 100644 --- a/tecmake.mak +++ b/tecmake.mak @@ -240,6 +240,11 @@ ifndef NO_GTK_DEFAULT ifneq ($(findstring FreeBSD, $(TEC_UNAME)), ) GTK_DEFAULT = Yes endif + ifneq ($(findstring SunOS, $(TEC_UNAME)), ) + ifeq ($(TEC_SYSARCH), x86) + GTK_DEFAULT = Yes + endif + endif endif #---------------------------------# @@ -947,7 +952,7 @@ endif ifdef USE_GTK ifdef USE_PKGCONFIG # get compile/link flags via pkg-config - PKGINCS += $(shell pkg-config --cflags gtk+-2.0 gdk-2.0) + PKGINCS += $(shell pkg-config --cflags gtk+-2.0 gdk-2.0 gtk+-unix-print-2.0) PKGLIBS += $(shell pkg-config --libs gtk+-2.0 gdk-2.0) GTK_BASE := $(shell pkg-config --variable=prefix gtk+-2.0) GTK := $(GTK_BASE) @@ -984,7 +989,7 @@ ifdef USE_GTK endif LIBS += gdk_pixbuf-2.0 pango-1.0 gobject-2.0 gmodule-2.0 glib-2.0 - STDINCS += $(GTK)/include/atk-1.0 $(GTK)/include/gtk-2.0 $(GTK)/include/cairo $(GTK)/include/pango-1.0 $(GTK)/include/glib-2.0 + STDINCS += $(GTK)/include/atk-1.0 $(GTK)/include/gtk-2.0 $(GTK)/include/gdk-pixbuf-2.0 $(GTK)/include/cairo $(GTK)/include/pango-1.0 $(GTK)/include/glib-2.0 ifeq ($(TEC_SYSARCH), x64) STDINCS += $(GTK)/lib64/glib-2.0/include $(GTK)/lib64/gtk-2.0/include diff --git a/tecmakewin.mak b/tecmakewin.mak index 4e87c3c..89e3ede 100644 --- a/tecmakewin.mak +++ b/tecmakewin.mak @@ -984,7 +984,7 @@ ifdef USE_OPENGL endif ifdef USE_GTK - STDINCS += $(GTK)/include/atk-1.0 $(GTK)/include/gtk-2.0 $(GTK)/include/cairo $(GTK)/include/pango-1.0 $(GTK)/include/glib-2.0 $(GTK)/lib/glib-2.0/include $(GTK)/lib/gtk-2.0/include + STDINCS += $(GTK)/include/atk-1.0 $(GTK)/include/gtk-2.0 $(GTK)/include/gdk-pixbuf-2.0 $(GTK)/include/cairo $(GTK)/include/pango-1.0 $(GTK)/include/glib-2.0 $(GTK)/lib/glib-2.0/include $(GTK)/lib/gtk-2.0/include ifeq "$(TEC_CC)" "gcc" STDFLAGS += -mms-bitfields endif -- cgit v1.2.3