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.
*ascii85;
ProfileInfo
- color_profile,
- iptc_profile,
*generic_profile;
char
cmsOpenProfileFromMem(profile,length)
#endif
\f
+/*
+ Typedef declarations
+*/
+struct ProfileInfo
+{
+ char
+ *name;
+
+ size_t
+ length;
+
+ unsigned char
+ *info;
+
+ size_t
+ signature;
+};
+\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
(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);
#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) \
ThrowBinaryException(severity,tag,context); \
}
- ExceptionInfo
- *exception;
-
MagickBooleanType
status;
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
#include "MagickCore/string_.h"
typedef struct _ProfileInfo
-{
- char
- *name;
-
- size_t
- length;
-
- unsigned char
- *info;
-
- size_t
- signature;
-} ProfileInfo;
+ ProfileInfo;
typedef enum
{
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
%
% 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)
#endif
}
-MagickExport MagickBooleanType ClampImage(Image *image)
+MagickExport MagickBooleanType ClampImage(Image *image,ExceptionInfo *exception)
{
#define ClampImageTag "Clamp/Image"
CacheView
*image_view;
- ExceptionInfo
- *exception;
-
MagickBooleanType
status;
*/
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)
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 *),
*/
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));
}
\f
/*
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));
}
\f
/*
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)
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;
}
/*
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)
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;
}
/*
{
(void) ProfileImage(*image,profile_info->magick,
GetStringInfoDatum(profile),(size_t)
- GetStringInfoLength(profile),MagickFalse);
+ GetStringInfoLength(profile),exception);
profile=DestroyStringInfo(profile);
}
profile_info=DestroyImageInfo(profile_info);
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);
Remove a profile from the image.
*/
(void) ProfileImage(image,name,(const unsigned char *) NULL,0,
- MagickTrue);
+ exception);
break;
}
/*
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;
}
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);
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;
}
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;
}
/*