本文整理汇总了C++中ConstantString函数的典型用法代码示例。如果您正苦于以下问题:C++ ConstantString函数的具体用法?C++ ConstantString怎么用?C++ ConstantString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ConstantString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPolicyValue
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t P o l i c y V a l u e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetPolicyValue() returns the value associated with the named policy.
%
% The format of the GetPolicyValue method is:
%
% char *GetPolicyValue(const char *name)
%
% A description of each parameter follows:
%
% o name: The name of the policy.
%
*/
MagickExport char *GetPolicyValue(const char *name)
{
const char
*value;
const PolicyInfo
*policy_info;
ExceptionInfo
*exception;
assert(name != (const char *) NULL);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",name);
exception=AcquireExceptionInfo();
policy_info=GetPolicyInfo(name,exception);
exception=DestroyExceptionInfo(exception);
if (policy_info == (PolicyInfo *) NULL)
return((char *) NULL);
value=policy_info->value;
if ((value == (const char *) NULL) || (*value == '\0'))
return((char *) NULL);
return(ConstantString(value));
}
示例2: GetConfigureOption
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t C o n f i g u r e O p t i o n %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetConfigureOption() returns the value associated with the configure option.
%
% The format of the GetConfigureOption method is:
%
% char *GetConfigureOption(const char *option)
%
% A description of each parameter follows:
%
% o configure_info: The configure info.
%
*/
MagickExport char *GetConfigureOption(const char *option)
{
const char
*value;
const ConfigureInfo
*configure_info;
ExceptionInfo
*exception;
assert(option != (const char *) NULL);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",option);
exception=AcquireExceptionInfo();
configure_info=GetConfigureInfo(option,exception);
exception=DestroyExceptionInfo(exception);
if (configure_info == (ConfigureInfo *) NULL)
return((char *) NULL);
value=GetConfigureValue(configure_info);
if ((value == (const char *) NULL) || (*value == '\0'))
return((char *) NULL);
return(ConstantString(value));
}
示例3: NewImageView
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% N e w I m a g e V i e w %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% NewImageView() returns a image view required for all other methods in the
% Image View API.
%
% The format of the NewImageView method is:
%
% ImageView *NewImageView(MagickCore *wand,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image: the image.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport ImageView *NewImageView(Image *image,ExceptionInfo *exception)
{
ImageView
*image_view;
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
image_view=(ImageView *) AcquireMagickMemory(sizeof(*image_view));
if (image_view == (ImageView *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(image_view,0,sizeof(*image_view));
image_view->description=ConstantString("ImageView");
image_view->image=image;
image_view->view=AcquireVirtualCacheView(image_view->image,exception);
image_view->extent.width=image->columns;
image_view->extent.height=image->rows;
image_view->extent.x=0;
image_view->extent.y=0;
image_view->exception=AcquireExceptionInfo();
image_view->debug=IsEventLogging();
image_view->signature=MagickSignature;
return(image_view);
}
示例4: RegisterPANGOImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e g i s t e r P A N G O I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% RegisterPANGOImage() adds attributes for the Pango Markup Language format to
% the list of supported formats. The attributes include the image format
% tag, a method to read and/or write the format, whether the format
% supports the saving of more than one frame to the same file or blob,
% whether the format supports native in-memory I/O, and a brief
% description of the format.
%
% The format of the RegisterPANGOImage method is:
%
% size_t RegisterPANGOImage(void)
%
*/
ModuleExport size_t RegisterPANGOImage(void)
{
char
version[MagickPathExtent];
MagickInfo
*entry;
*version='\0';
#if defined(PANGO_VERSION_STRING)
(void) FormatLocaleString(version,MagickPathExtent,"Pangocairo %s",
PANGO_VERSION_STRING);
#endif
entry=AcquireMagickInfo("PANGO","PANGO","Pango Markup Language");
#if defined(MAGICKCORE_PANGOCAIRO_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadPANGOImage;
#endif
if (*version != '\0')
entry->version=ConstantString(version);
entry->flags^=CoderAdjoinFlag;
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
示例5: RegisterCALSImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e g i s t e r C A L S I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% RegisterCALSImage() adds attributes for the CALS Raster Group 1 image file
% image format to the list of supported formats. The attributes include the
% image format tag, a method to read and/or write the format, whether the
% format supports the saving of more than one frame to the same file or blob,
% whether the format supports native in-memory I/O, and a brief description
% of the format.
%
% The format of the RegisterCALSImage method is:
%
% size_t RegisterCALSImage(void)
%
*/
ModuleExport size_t RegisterCALSImage(void)
{
MagickInfo
*entry;
static const char
*CALSDescription=
{
"Continuous Acquisition and Life-cycle Support Type 1"
},
*CALSNote=
{
"Specified in MIL-R-28002 and MIL-PRF-28002"
};
entry=SetMagickInfo("CAL");
entry->decoder=(DecodeImageHandler *) ReadCALSImage;
#if defined(MAGICKCORE_TIFF_DELEGATE)
entry->encoder=(EncodeImageHandler *) WriteCALSImage;
#endif
entry->adjoin=MagickFalse;
entry->magick=(IsImageFormatHandler *) IsCALS;
entry->description=ConstantString(CALSDescription);
entry->note=ConstantString(CALSNote);
entry->module=ConstantString("CALS");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("CALS");
entry->decoder=(DecodeImageHandler *) ReadCALSImage;
#if defined(MAGICKCORE_TIFF_DELEGATE)
entry->encoder=(EncodeImageHandler *) WriteCALSImage;
#endif
entry->adjoin=MagickFalse;
entry->magick=(IsImageFormatHandler *) IsCALS;
entry->description=ConstantString(CALSDescription);
entry->note=ConstantString(CALSNote);
entry->module=ConstantString("CALS");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
示例6: RegisterEPTImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e g i s t e r E P T I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% RegisterEPTImage() adds attributes for the EPT image format to
% the list of supported formats. The attributes include the image format
% tag, a method to read and/or write the format, whether the format
% supports the saving of more than one frame to the same file or blob,
% whether the format supports native in-memory I/O, and a brief
% description of the format.
%
% The format of the RegisterEPTImage method is:
%
% size_t RegisterEPTImage(void)
%
*/
ModuleExport size_t RegisterEPTImage(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("EPT");
entry->decoder=(DecodeImageHandler *) ReadEPTImage;
entry->encoder=(EncodeImageHandler *) WriteEPTImage;
entry->magick=(IsImageFormatHandler *) IsEPT;
entry->seekable_stream=MagickTrue;
entry->adjoin=MagickFalse;
entry->blob_support=MagickFalse;
entry->description=ConstantString(
"Encapsulated PostScript with TIFF preview");
entry->module=ConstantString("EPT");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("EPT2");
entry->decoder=(DecodeImageHandler *) ReadEPTImage;
entry->encoder=(EncodeImageHandler *) WriteEPTImage;
entry->magick=(IsImageFormatHandler *) IsEPT;
entry->adjoin=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->blob_support=MagickFalse;
entry->description=ConstantString(
"Encapsulated PostScript Level II with TIFF preview");
entry->module=ConstantString("EPT");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("EPT3");
entry->decoder=(DecodeImageHandler *) ReadEPTImage;
entry->encoder=(EncodeImageHandler *) WriteEPTImage;
entry->magick=(IsImageFormatHandler *) IsEPT;
entry->seekable_stream=MagickTrue;
entry->blob_support=MagickFalse;
entry->description=ConstantString(
"Encapsulated PostScript Level III with TIFF preview");
entry->module=ConstantString("EPT");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
示例7: RegisterPS2Image
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e g i s t e r P S 2 I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% RegisterPS2Image() adds properties for the PS2 image format to
% the list of supported formats. The properties include the image format
% tag, a method to read and/or write the format, whether the format
% supports the saving of more than one frame to the same file or blob,
% whether the format supports native in-memory I/O, and a brief
% description of the format.
%
% The format of the RegisterPS2Image method is:
%
% size_t RegisterPS2Image(void)
%
*/
ModuleExport size_t RegisterPS2Image(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("EPS2");
entry->encoder=(EncodeImageHandler *) WritePS2Image;
entry->adjoin=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->description=ConstantString("Level II Encapsulated PostScript");
entry->mime_type=ConstantString("application/postscript");
entry->module=ConstantString("PS2");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PS2");
entry->encoder=(EncodeImageHandler *) WritePS2Image;
entry->seekable_stream=MagickTrue;
entry->description=ConstantString("Level II PostScript");
entry->mime_type=ConstantString("application/postscript");
entry->module=ConstantString("PS2");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
示例8: GetConfigurePaths
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t C o n f i g u r e P a t h s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetConfigurePaths() returns any Magick configuration paths associated
% with the specified filename.
%
% The format of the GetConfigurePaths method is:
%
% LinkedListInfo *GetConfigurePaths(const char *filename,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o filename: the configure file name.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport LinkedListInfo *GetConfigurePaths(const char *filename,
ExceptionInfo *exception)
{
#define RegistryKey "ConfigurePath"
#define MagickCoreDLL "CORE_RL_magick_.dll"
#define MagickCoreDebugDLL "CORE_DB_magick_.dll"
char
path[MaxTextExtent];
LinkedListInfo
*paths;
assert(filename != (const char *) NULL);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
assert(exception != (ExceptionInfo *) NULL);
(void) CopyMagickString(path,filename,MaxTextExtent);
paths=NewLinkedList(0);
{
char
*configure_path;
/*
Search $MAGICK_CONFIGURE_PATH.
*/
configure_path=GetEnvironmentValue("MAGICK_CONFIGURE_PATH");
if (configure_path != (char *) NULL)
{
register char
*p,
*q;
for (p=configure_path-1; p != (char *) NULL; )
{
(void) CopyMagickString(path,p+1,MaxTextExtent);
q=strchr(path,DirectoryListSeparator);
if (q != (char *) NULL)
*q='\0';
q=path+strlen(path)-1;
if ((q >= path) && (*q != *DirectorySeparator))
(void) ConcatenateMagickString(path,DirectorySeparator,
MaxTextExtent);
(void) AppendValueToLinkedList(paths,ConstantString(path));
p=strchr(p+1,DirectoryListSeparator);
}
configure_path=DestroyString(configure_path);
}
}
#if defined(MAGICKCORE_INSTALLED_SUPPORT)
#if defined(MAGICKCORE_SHARE_PATH)
(void) AppendValueToLinkedList(paths,ConstantString(MAGICKCORE_SHARE_PATH));
#endif
#if defined(MAGICKCORE_SHAREARCH_PATH)
(void) AppendValueToLinkedList(paths,ConstantString(
MAGICKCORE_SHAREARCH_PATH));
#endif
#if defined(MAGICKCORE_CONFIGURE_PATH)
(void) AppendValueToLinkedList(paths,ConstantString(
MAGICKCORE_CONFIGURE_PATH));
#endif
#if defined(MAGICKCORE_DOCUMENTATION_PATH)
(void) AppendValueToLinkedList(paths,ConstantString(
MAGICKCORE_DOCUMENTATION_PATH));
#endif
#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_PATH))
{
unsigned char
*key_value;
/*
Locate file via registry key.
*/
key_value=NTRegistryKeyLookup(RegistryKey);
if (key_value != (unsigned char *) NULL)
//.........这里部分代码省略.........
示例9: LoadConfigureList
//.........这里部分代码省略.........
(void) ThrowMagickException(exception,GetMagickModule(),
ConfigureError,"IncludeElementNestedTooDeeply","`%s'",token);
else
{
char
path[MaxTextExtent],
*xml;
GetPathComponent(filename,HeadPath,path);
if (*path != '\0')
(void) ConcatenateMagickString(path,DirectorySeparator,
MaxTextExtent);
if (*token == *DirectorySeparator)
(void) CopyMagickString(path,token,MaxTextExtent);
else
(void) ConcatenateMagickString(path,token,MaxTextExtent);
xml=FileToString(path,~0,exception);
if (xml != (char *) NULL)
{
status=LoadConfigureList(xml,path,depth+1,exception);
xml=(char *) RelinquishMagickMemory(xml);
}
}
}
}
continue;
}
if (LocaleCompare(keyword,"<configure") == 0)
{
/*
Configure element.
*/
configure_info=(ConfigureInfo *) AcquireMagickMemory(
sizeof(*configure_info));
if (configure_info == (ConfigureInfo *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(configure_info,0,sizeof(*configure_info));
configure_info->path=ConstantString(filename);
configure_info->exempt=MagickFalse;
configure_info->signature=MagickSignature;
continue;
}
if (configure_info == (ConfigureInfo *) NULL)
continue;
if (LocaleCompare(keyword,"/>") == 0)
{
status=AppendValueToLinkedList(configure_list,configure_info);
if (status == MagickFalse)
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",
configure_info->name);
configure_info=(ConfigureInfo *) NULL;
}
/*
Parse configure element.
*/
GetMagickToken(q,(const char **) NULL,token);
if (*token != '=')
continue;
GetMagickToken(q,&q,token);
GetMagickToken(q,&q,token);
switch (*keyword)
{
case 'N':
case 'n':
{
if (LocaleCompare((char *) keyword,"name") == 0)
{
configure_info->name=ConstantString(token);
break;
}
break;
}
case 'S':
case 's':
{
if (LocaleCompare((char *) keyword,"stealth") == 0)
{
configure_info->stealth=IsMagickTrue(token);
break;
}
break;
}
case 'V':
case 'v':
{
if (LocaleCompare((char *) keyword,"value") == 0)
{
configure_info->value=ConstantString(token);
break;
}
break;
}
default:
break;
}
}
token=(char *) RelinquishMagickMemory(token);
return(status);
}
示例10: SetImageRegistry
MagickExport MagickBooleanType SetImageRegistry(const RegistryType type,
const char *key,const void *value,ExceptionInfo *exception)
{
MagickBooleanType
status;
RegistryInfo
*registry_info;
void
*clone_value;
if (IsEventLogging() != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",key);
clone_value=(void *) NULL;
switch (type)
{
case StringRegistryType:
default:
{
const char
*string;
string=(const char *) value;
clone_value=(void *) ConstantString(string);
break;
}
case ImageRegistryType:
{
const Image
*image;
image=(const Image *) value;
if (image->signature != MagickSignature)
{
(void) ThrowMagickException(exception,GetMagickModule(),RegistryError,
"UnableToSetRegistry","%s",key);
return(MagickFalse);
}
clone_value=(void *) CloneImageList(image,exception);
break;
}
case ImageInfoRegistryType:
{
const ImageInfo
*image_info;
image_info=(const ImageInfo *) value;
if (image_info->signature != MagickSignature)
{
(void) ThrowMagickException(exception,GetMagickModule(),RegistryError,
"UnableToSetRegistry","%s",key);
return(MagickFalse);
}
clone_value=(void *) CloneImageInfo(image_info);
break;
}
}
if (clone_value == (void *) NULL)
return(MagickFalse);
registry_info=(RegistryInfo *) AcquireMagickMemory(sizeof(*registry_info));
if (registry_info == (RegistryInfo *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(registry_info,0,sizeof(*registry_info));
registry_info->type=type;
registry_info->value=clone_value;
registry_info->signature=MagickSignature;
if ((registry == (SplayTreeInfo *) NULL) &&
(instantiate_registry == MagickFalse))
{
if (registry_semaphore == (SemaphoreInfo *) NULL)
AcquireSemaphoreInfo(®istry_semaphore);
LockSemaphoreInfo(registry_semaphore);
if ((registry == (SplayTreeInfo *) NULL) &&
(instantiate_registry == MagickFalse))
{
registry=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory,
DestroyRegistryNode);
instantiate_registry=MagickTrue;
}
UnlockSemaphoreInfo(registry_semaphore);
}
status=AddValueToSplayTree(registry,ConstantString(key),registry_info);
return(status);
}
示例11: GetImageRegistry
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t I m a g e R e g i s t r y %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetImageRegistry() returns a value associated with an image registry key.
%
% The format of the GetImageRegistry method is:
%
% void *GetImageRegistry(const RegistryType type,const char *key,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o type: the type.
%
% o key: the key.
%
% o exception: the exception.
%
*/
MagickExport void *GetImageRegistry(const RegistryType type,const char *key,
ExceptionInfo *exception)
{
void
*value;
RegistryInfo
*registry_info;
if (IsEventLogging() != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",key);
if (registry == (void *) NULL)
return((void *) NULL);
registry_info=(RegistryInfo *) GetValueFromSplayTree(registry,key);
if (registry_info == (void *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),RegistryError,
"UnableToGetRegistryID","`%s'",key);
return((void *) NULL);
}
value=(void *) NULL;
switch (type)
{
case ImageRegistryType:
{
if (type == registry_info->type)
value=(void *) CloneImageList((Image *) registry_info->value,exception);
break;
}
case ImageInfoRegistryType:
{
if (type == registry_info->type)
value=(void *) CloneImageInfo((ImageInfo *) registry_info->value);
break;
}
case StringRegistryType:
{
switch (registry_info->type)
{
case ImageRegistryType:
{
value=(Image *) ConstantString(((Image *)
registry_info->value)->filename);
break;
}
case ImageInfoRegistryType:
{
value=(Image *) ConstantString(((ImageInfo *)
registry_info->value)->filename);
break;
}
case StringRegistryType:
{
value=(void *) ConstantString((char *) registry_info->value);
break;
}
default:
break;
}
break;
}
default:
break;
}
return(value);
}
示例12: ThrowFatalException
static SplayTreeInfo *AcquireCoderCache(const char *filename,
ExceptionInfo *exception)
{
const StringInfo
*option;
LinkedListInfo
*options;
MagickStatusType
status;
register ssize_t
i;
SplayTreeInfo
*coder_cache;
/*
Load external coder map.
*/
coder_cache=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory,
DestroyCoderNode);
if (coder_cache == (SplayTreeInfo *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
status=MagickTrue;
options=GetConfigureOptions(filename,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
status&=LoadCoderCache(coder_cache,(const char *)
GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyConfigureOptions(options);
/*
Load built-in coder map.
*/
for (i=0; i < (ssize_t) (sizeof(CoderMap)/sizeof(*CoderMap)); i++)
{
CoderInfo
*coder_info;
register const CoderMapInfo
*p;
p=CoderMap+i;
coder_info=(CoderInfo *) AcquireMagickMemory(sizeof(*coder_info));
if (coder_info == (CoderInfo *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",p->name);
continue;
}
(void) ResetMagickMemory(coder_info,0,sizeof(*coder_info));
coder_info->path=(char *) "[built-in]";
coder_info->magick=(char *) p->magick;
coder_info->name=(char *) p->name;
coder_info->exempt=MagickTrue;
coder_info->signature=MagickCoreSignature;
status&=AddValueToSplayTree(coder_cache,ConstantString(coder_info->magick),
coder_info);
if (status == MagickFalse)
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",coder_info->name);
}
return(coder_cache);
}
示例13: LoadTypeList
//.........这里部分代码省略.........
*sans_exception;
*path='\0';
GetPathComponent(filename,HeadPath,path);
if (*path != '\0')
(void) ConcatenateMagickString(path,DirectorySeparator,
MaxTextExtent);
if (*token == *DirectorySeparator)
(void) CopyMagickString(path,token,MaxTextExtent);
else
(void) ConcatenateMagickString(path,token,MaxTextExtent);
sans_exception=AcquireExceptionInfo();
xml=FileToString(path,~0UL,sans_exception);
sans_exception=DestroyExceptionInfo(sans_exception);
if (xml != (char *) NULL)
{
status=LoadTypeList(xml,path,depth+1,exception);
xml=(char *) RelinquishMagickMemory(xml);
}
}
}
}
continue;
}
if (LocaleCompare(keyword,"<type") == 0)
{
/*
Type element.
*/
type_info=(TypeInfo *) AcquireMagickMemory(sizeof(*type_info));
if (type_info == (TypeInfo *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(type_info,0,sizeof(*type_info));
type_info->path=ConstantString(filename);
type_info->signature=MagickSignature;
continue;
}
if (type_info == (TypeInfo *) NULL)
continue;
if (LocaleCompare(keyword,"/>") == 0)
{
status=AddValueToSplayTree(type_list,type_info->name,type_info);
if (status == MagickFalse)
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",type_info->name);
type_info=(TypeInfo *) NULL;
}
GetMagickToken(q,(const char **) NULL,token);
if (*token != '=')
continue;
GetMagickToken(q,&q,token);
GetMagickToken(q,&q,token);
switch (*keyword)
{
case 'E':
case 'e':
{
if (LocaleCompare((char *) keyword,"encoding") == 0)
{
type_info->encoding=ConstantString(token);
break;
}
break;
}
case 'F':
case 'f':
示例14: assert
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d V I D I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadVIDImage reads one of more images and creates a Visual Image
% Directory file. It allocates the memory necessary for the new Image
% structure and returns a pointer to the new image.
%
% The format of the ReadVIDImage method is:
%
% Image *ReadVIDImage(const ImageInfo *image_info,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadVIDImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define ClientName "montage"
char
**filelist,
*label;
Image
*image,
*images,
*montage_image,
*next_image,
*thumbnail_image;
ImageInfo
*read_info;
int
number_files;
MagickBooleanType
status;
MontageInfo
*montage_info;
RectangleInfo
geometry;
register ssize_t
i;
/*
Expand the filename.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
image=AcquireImage(image_info);
filelist=(char **) AcquireAlignedMemory(1,sizeof(*filelist));
if (filelist == (char **) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
filelist[0]=ConstantString(image_info->filename);
number_files=1;
status=ExpandFilenames(&number_files,&filelist);
if ((status == MagickFalse) || (number_files == 0))
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
image=DestroyImage(image);
/*
Read each image and convert them to a tile.
*/
images=NewImageList();
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
(void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,
(void *) NULL);
if (read_info->size == (char *) NULL)
(void) CloneString(&read_info->size,DefaultTileGeometry);
for (i=0; i < (ssize_t) number_files; i++)
{
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"name: %s",
filelist[i]);
(void) CopyMagickString(read_info->filename,filelist[i],MaxTextExtent);
filelist[i]=DestroyString(filelist[i]);
*read_info->magick='\0';
next_image=ReadImage(read_info,exception);
CatchException(exception);
if (next_image == (Image *) NULL)
//.........这里部分代码省略.........
示例15: ReadLABELImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d L A B E L I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadLABELImage() reads a LABEL image file and returns it. It
% allocates the memory necessary for the new Image structure and returns a
% pointer to the new image.
%
% The format of the ReadLABELImage method is:
%
% Image *ReadLABELImage(const ImageInfo *image_info,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadLABELImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
char
geometry[MaxTextExtent],
*property;
const char
*label;
DrawInfo
*draw_info;
Image
*image;
MagickBooleanType
status;
TypeMetric
metrics;
size_t
height,
width;
/*
Initialize Image structure.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
image=AcquireImage(image_info);
(void) ResetImagePage(image,"0x0+0+0");
property=InterpretImageProperties(image_info,image,image_info->filename);
(void) SetImageProperty(image,"label",property);
property=DestroyString(property);
label=GetImageProperty(image,"label");
draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL);
draw_info->text=ConstantString(label);
if (((image->columns != 0) || (image->rows != 0)) &&
(image_info->pointsize == 0.0))
{
/*
Fit label to canvas size.
*/
status=GetMultilineTypeMetrics(image,draw_info,&metrics);
for ( ; status != MagickFalse; draw_info->pointsize*=2.0)
{
width=(size_t) floor(metrics.width+draw_info->stroke_width+0.5);
height=(size_t) floor(metrics.height+draw_info->stroke_width+0.5);
if (((image->columns != 0) && (width > (image->columns+1))) ||
((image->rows != 0) && (height > (image->rows+1))))
break;
status=GetMultilineTypeMetrics(image,draw_info,&metrics);
}
for ( ; status != MagickFalse; draw_info->pointsize--)
{
width=(size_t) floor(metrics.width+draw_info->stroke_width+0.5);
height=(size_t) floor(metrics.height+draw_info->stroke_width+0.5);
if ((image->columns != 0) && (width <= (image->columns+1)) &&
((image->rows == 0) || (height <= (image->rows+1))))
break;
if ((image->rows != 0) && (height <= (image->rows+1)) &&
((image->columns == 0) || (width <= (image->columns+1))))
break;
if (draw_info->pointsize < 2.0)
break;
status=GetMultilineTypeMetrics(image,draw_info,&metrics);
//.........这里部分代码省略.........