This commit is contained in:
cristy
2011-10-14 18:01:29 +00:00
parent 09b53e1999
commit 092d71c02d
12 changed files with 44 additions and 66 deletions
+5 -3
View File
@@ -3526,12 +3526,14 @@ void Magick::Image::profile( const std::string name_,
const Magick::Blob &profile_ )
{
modifyImage();
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
ssize_t result = ProfileImage( image(), name_.c_str(),
(unsigned char *)profile_.data(),
profile_.length(), MagickTrue);
profile_.length(), &exceptionInfo);
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
if( !result )
throwImageException();
}
// Retrieve a named profile from the image.
-2
View File
@@ -313,8 +313,6 @@ struct _Image
*ascii85;
ProfileInfo
color_profile,
iptc_profile,
*generic_profile;
char
+19 -10
View File
@@ -100,6 +100,24 @@
cmsOpenProfileFromMem(profile,length)
#endif
/*
Typedef declarations
*/
struct ProfileInfo
{
char
*name;
size_t
length;
unsigned char
*info;
size_t
signature;
};
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
@@ -134,10 +152,6 @@ MagickExport MagickBooleanType CloneImageProfiles(Image *image,
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(clone_image != (const Image *) NULL);
assert(clone_image->signature == MagickSignature);
image->color_profile.length=clone_image->color_profile.length;
image->color_profile.info=clone_image->color_profile.info;
image->iptc_profile.length=clone_image->iptc_profile.length;
image->iptc_profile.info=clone_image->iptc_profile.info;
if (clone_image->profiles != (void *) NULL)
image->profiles=CloneSplayTree((SplayTreeInfo *) clone_image->profiles,
(void *(*)(void *)) ConstantString,(void *(*)(void *)) CloneStringInfo);
@@ -5618,8 +5632,7 @@ static int LCMSExceptionHandler(int severity,const char *message)
#endif
MagickExport MagickBooleanType ProfileImage(Image *image,const char *name,
const void *datum,const size_t length,
const MagickBooleanType magick_unused(clone))
const void *datum,const size_t length,ExceptionInfo *exception)
{
#define ProfileImageTag "Profile/Image"
#define ThrowProfileException(severity,tag,context) \
@@ -5631,9 +5644,6 @@ MagickExport MagickBooleanType ProfileImage(Image *image,const char *name,
ThrowBinaryException(severity,tag,context); \
}
ExceptionInfo
*exception;
MagickBooleanType
status;
@@ -5645,7 +5655,6 @@ MagickExport MagickBooleanType ProfileImage(Image *image,const char *name,
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(name != (const char *) NULL);
exception=(&image->exception);
if ((datum == (const void *) NULL) || (length == 0))
{
char
+2 -15
View File
@@ -25,19 +25,7 @@ extern "C" {
#include "MagickCore/string_.h"
typedef struct _ProfileInfo
{
char
*name;
size_t
length;
unsigned char
*info;
size_t
signature;
} ProfileInfo;
ProfileInfo;
typedef enum
{
@@ -57,8 +45,7 @@ extern MagickExport const StringInfo
extern MagickExport MagickBooleanType
CloneImageProfiles(Image *,const Image *),
DeleteImageProfile(Image *,const char *),
ProfileImage(Image *,const char *,const void *,const size_t,
const MagickBooleanType),
ProfileImage(Image *,const char *,const void *,const size_t,ExceptionInfo *),
SetImageProfile(Image *,const char *,const StringInfo *);
extern MagickExport StringInfo
+4 -6
View File
@@ -601,12 +601,14 @@ MagickExport MagickBooleanType BlackThresholdImage(Image *image,
%
% The format of the ClampImage method is:
%
% MagickBooleanType ClampImage(Image *image)
% MagickBooleanType ClampImage(Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o exception: return any errors or warnings in this structure.
%
*/
static inline Quantum ClampToUnsignedQuantum(const Quantum quantum)
@@ -622,16 +624,13 @@ static inline Quantum ClampToUnsignedQuantum(const Quantum quantum)
#endif
}
MagickExport MagickBooleanType ClampImage(Image *image)
MagickExport MagickBooleanType ClampImage(Image *image,ExceptionInfo *exception)
{
#define ClampImageTag "Clamp/Image"
CacheView
*image_view;
ExceptionInfo
*exception;
MagickBooleanType
status;
@@ -669,7 +668,6 @@ MagickExport MagickBooleanType ClampImage(Image *image)
*/
status=MagickTrue;
progress=0;
exception=(&image->exception);
image_view=AcquireCacheView(image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(progress,status)
+1 -1
View File
@@ -36,7 +36,7 @@ extern MagickExport ThresholdMap
extern MagickExport MagickBooleanType
BilevelImage(Image *,const double),
BlackThresholdImage(Image *,const char *,ExceptionInfo *),
ClampImage(Image *),
ClampImage(Image *,ExceptionInfo *),
ListThresholdMaps(FILE *,ExceptionInfo *),
OrderedPosterizeImage(Image *,const char *,ExceptionInfo *),
RandomThresholdImage(Image *,const char *,ExceptionInfo *),
+1 -7
View File
@@ -1197,19 +1197,13 @@ WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
*/
WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
{
MagickBooleanType
status;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
status=ClampImage(wand->images);
if (status == MagickFalse)
InheritException(wand->exception,&wand->images->exception);
return(status);
return(ClampImage(wand->images,wand->exception));
}
/*
+1 -7
View File
@@ -1725,19 +1725,13 @@ WandExport const char *MagickGetVersion(size_t *version)
WandExport MagickBooleanType MagickProfileImage(MagickWand *wand,
const char *name,const void *profile,const size_t length)
{
MagickBooleanType
status;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
status=ProfileImage(wand->images,name,profile,length,MagickTrue);
if (status == MagickFalse)
InheritException(wand->exception,&wand->images->exception);
return(status);
return(ProfileImage(wand->images,name,profile,length,wand->exception));
}
/*
+2 -4
View File
@@ -1050,8 +1050,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
Clamp image.
*/
(void) SyncImageSettings(mogrify_info,*image);
(void) ClampImage(*image);
InheritException(exception,&(*image)->exception);
(void) ClampImage(*image,exception);
break;
}
if (LocaleCompare("clip",option+1) == 0)
@@ -2338,8 +2337,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
Remove a profile from the image.
*/
(void) ProfileImage(*image,argv[i+1],(const unsigned char *)
NULL,0,MagickTrue);
InheritException(exception,&(*image)->exception);
NULL,0,exception);
break;
}
/*
+4 -6
View File
@@ -1870,8 +1870,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand,
if (LocaleCompare("clamp",argv[0]+1) == 0)
{
(void) SyncImageSettings(image_info,*image);
(void) ClampImage(*image);
InheritException(exception,&(*image)->exception);
(void) ClampImage(*image,exception);
break;
}
if (LocaleCompare("clip",argv[0]+1) == 0)
@@ -3029,8 +3028,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand,
Remove a profile from the image.
*/
(void) ProfileImage(*image,argv[1],(const unsigned char *)
NULL,0,MagickTrue);
InheritException(exception,&(*image)->exception);
NULL,0,exception);
break;
}
/*
@@ -3055,7 +3053,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand,
{
(void) ProfileImage(*image,profile_info->magick,
GetStringInfoDatum(profile),(size_t)
GetStringInfoLength(profile),MagickFalse);
GetStringInfoLength(profile),exception);
profile=DestroyStringInfo(profile);
}
profile_info=DestroyImageInfo(profile_info);
@@ -3068,7 +3066,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand,
profile=GetImageProfile(profile_image,name);
if (profile != (StringInfo *) NULL)
(void) ProfileImage(*image,name,GetStringInfoDatum(profile),
(size_t) GetStringInfoLength(profile),MagickFalse);
(size_t) GetStringInfoLength(profile),exception);
name=GetNextImageProfile(profile_image);
}
profile_image=DestroyImage(profile_image);
+4 -4
View File
@@ -9300,7 +9300,7 @@ Mogrify(ref,...)
Remove a profile from the image.
*/
(void) ProfileImage(image,name,(const unsigned char *) NULL,0,
MagickTrue);
exception);
break;
}
/*
@@ -9310,7 +9310,7 @@ Mogrify(ref,...)
SetStringInfoDatum(profile,(const unsigned char *)
argument_list[1].string_reference);
(void) ProfileImage(image,name,GetStringInfoDatum(profile),
(size_t) GetStringInfoLength(profile),MagickFalse);
(size_t) GetStringInfoLength(profile),exception);
profile=DestroyStringInfo(profile);
break;
}
@@ -9333,7 +9333,7 @@ Mogrify(ref,...)
profile=GetImageProfile(profile_image,name);
if (profile != (const StringInfo *) NULL)
(void) ProfileImage(image,name,GetStringInfoDatum(profile),
(size_t) GetStringInfoLength(profile),MagickFalse);
(size_t) GetStringInfoLength(profile),exception);
name=GetNextImageProfile(profile_image);
}
profile_image=DestroyImage(profile_image);
@@ -10645,7 +10645,7 @@ Mogrify(ref,...)
if (attribute_flag[0] != 0)
channel=(ChannelType) argument_list[0].integer_reference;
channel_mask=SetPixelChannelMask(image,channel);
(void) ClampImage(image);
(void) ClampImage(image,exception);
(void) SetPixelChannelMask(image,channel_mask);
break;
}
+1 -1
View File
@@ -4361,7 +4361,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
Remove a profile from the image.
*/
(void) ProfileImage(msl_info->image[n],keyword,
(const unsigned char *) NULL,0,MagickTrue);
(const unsigned char *) NULL,0,&exception);
continue;
}
/*