本文整理汇总了C++中FormatMagickString函数的典型用法代码示例。如果您正苦于以下问题:C++ FormatMagickString函数的具体用法?C++ FormatMagickString怎么用?C++ FormatMagickString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FormatMagickString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClonePixelIterator
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e P i x e l I t e r a t o r %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ClonePixelIterator() makes an exact copy of the specified iterator.
%
% The format of the ClonePixelIterator method is:
%
% PixelIterator *ClonePixelIterator(const PixelIterator *iterator)
%
% A description of each parameter follows:
%
% o iterator: the magick iterator.
%
*/
WandExport PixelIterator *ClonePixelIterator(const PixelIterator *iterator)
{
PixelIterator
*clone_iterator;
assert(iterator != (PixelIterator *) NULL);
assert(iterator->signature == WandSignature);
if (iterator->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
clone_iterator=(PixelIterator *) AcquireMagickMemory(sizeof(*clone_iterator));
if (clone_iterator == (PixelIterator *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
iterator->name);
(void) ResetMagickMemory(clone_iterator,0,sizeof(*clone_iterator));
clone_iterator->id=AcquireWandId();
(void) FormatMagickString(clone_iterator->name,MaxTextExtent,"%s-%lu",
PixelIteratorId,clone_iterator->id);
clone_iterator->exception=AcquireExceptionInfo();
InheritException(clone_iterator->exception,iterator->exception);
clone_iterator->view=CloneCacheView(iterator->view);
clone_iterator->region=iterator->region;
clone_iterator->active=iterator->active;
clone_iterator->y=iterator->y;
clone_iterator->pixel_wands=ClonePixelWands((const PixelWand **)
iterator->pixel_wands,iterator->region.width);
clone_iterator->debug=iterator->debug;
if (clone_iterator->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
clone_iterator->name);
clone_iterator->signature=WandSignature;
return(clone_iterator);
}
示例2: opendir
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% o p e n d i r %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% opendir() opens the directory named by filename and associates a directory
% stream with it.
%
% The format of the opendir method is:
%
% opendir(entry)
%
% A description of each parameter follows:
%
% o entry: Specifies a pointer to a DIR structure.
%
%
*/
DIR *opendir(char *name)
{
DIR
*directory;
/*
Allocate memory for handle and the pattern.
*/
directory=(DIR *) AcquireMagickMemory(sizeof(DIR));
if (directory == (DIR *) NULL)
{
errno=ENOMEM;
return((DIR *) NULL);
}
if (strcmp(".",name) == 0)
name="";
directory->pattern=(char *) AcquireQuantumMemory(strlen(name)+sizeof("*.*")+
1UL,sizeof(*directory->pattern));
if (directory->pattern == (char *) NULL)
{
directory=DestroyString(directory);
errno=ENOMEM;
return(NULL);
}
/*
Initialize descriptor.
*/
(void) FormatMagickString(directory->pattern,MaxTextExtent,"%s*.*",name);
directory->context=0;
directory->pat.dsc$a_pointer=directory->pattern;
directory->pat.dsc$w_length=strlen(directory->pattern);
directory->pat.dsc$b_dtype=DSC$K_DTYPE_T;
directory->pat.dsc$b_class=DSC$K_CLASS_S;
return(directory);
}
示例3: NewMagickWand
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% N e w M a g i c k W a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% NewMagickWand() returns a wand required for all other methods in the API.
%
% The format of the NewMagickWand method is:
%
% MagickWand *NewMagickWand(void)
%
*/
WandExport MagickWand *NewMagickWand(void)
{
const char
*quantum;
MagickWand
*wand;
size_t
depth;
depth=MAGICKCORE_QUANTUM_DEPTH;
quantum=GetMagickQuantumDepth(&depth);
if (depth != MAGICKCORE_QUANTUM_DEPTH)
ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
wand=(MagickWand *) AcquireMagickMemory(sizeof(*wand));
if (wand == (MagickWand *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
(void) ResetMagickMemory(wand,0,sizeof(*wand));
wand->id=AcquireWandId();
(void) FormatMagickString(wand->name,MaxTextExtent,"%s-%.20g",MagickWandId,
(double) wand->id);
wand->exception=AcquireExceptionInfo();
wand->image_info=AcquireImageInfo();
wand->quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
wand->images=NewImageList();
wand->debug=IsEventLogging();
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
wand->signature=WandSignature;
return(wand);
}
示例4: NewPixelViewRegion
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% N e w P i x e l V i e w R e g i o n %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% NewPixelViewRegion() returns a pixel view required for all other methods
% in the Pixel View API.
%
% The format of the NewPixelViewRegion method is:
%
% PixelView *NewPixelViewRegion(MagickWand *wand,const long x,
% const long y,const unsigned long width,const unsigned long height)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
% o x,y,columns,rows: These values define the perimeter of a region of
% pixel_wands view.
%
*/
WandExport PixelView *NewPixelViewRegion(MagickWand *wand,const long x,
const long y,const unsigned long width,const unsigned long height)
{
PixelView
*pixel_view;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == MagickSignature);
pixel_view=(PixelView *) AcquireMagickMemory(sizeof(*pixel_view));
if (pixel_view == (PixelView *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
(void) ResetMagickMemory(pixel_view,0,sizeof(*pixel_view));
pixel_view->id=AcquireWandId();
(void) FormatMagickString(pixel_view->name,MaxTextExtent,"%s-%lu",
PixelViewId,pixel_view->id);
pixel_view->exception=AcquireExceptionInfo();
pixel_view->view=AcquireCacheView(pixel_view->wand->images);
pixel_view->wand=wand;
pixel_view->region.width=width;
pixel_view->region.height=height;
pixel_view->region.x=x;
pixel_view->region.y=y;
pixel_view->number_threads=GetOpenMPMaximumThreads();
pixel_view->pixel_wands=AcquirePixelsThreadSet(pixel_view->region.width,
pixel_view->number_threads);
if (pixel_view->pixel_wands == (PixelWand ***) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
pixel_view->debug=IsEventLogging();
pixel_view->signature=WandSignature;
return(pixel_view);
}
示例5: NewMagickWand
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% N e w M a g i c k W a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% NewMagickWand() returns a wand required for all other methods in the API.
%
% The format of the NewMagickWand method is:
%
% MagickWand *NewMagickWand(void)
%
*/
WandExport MagickWand *NewMagickWand(void)
{
const char
*quantum;
MagickWand
*wand;
unsigned long
depth;
depth=QuantumDepth;
quantum=GetMagickQuantumDepth(&depth);
if (depth != QuantumDepth)
ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
wand=(MagickWand *) AcquireMagickMemory(sizeof(*wand));
if (wand == (MagickWand *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
strerror(errno));
(void) ResetMagickMemory(wand,0,sizeof(*wand));
wand->id=AcquireWandId();
(void) FormatMagickString(wand->name,MaxTextExtent,"%s-%lu",MagickWandId,
wand->id);
GetExceptionInfo(&wand->exception);
wand->image_info=CloneImageInfo((ImageInfo *) NULL);
wand->quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
wand->images=NewImageList();
wand->debug=IsEventLogging();
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
wand->signature=MagickSignature;
return(wand);
}
示例6: NewWandViewExtent
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% N e w W a n d V i e w E x t e n t %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% NewWandViewExtent() returns a wand view required for all other methods
% in the Wand View API.
%
% The format of the NewWandViewExtent method is:
%
% WandView *NewWandViewExtent(MagickWand *wand,const ssize_t x,
% const ssize_t y,const size_t width,const size_t height)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
% o x,y,columns,rows: These values define the perimeter of a extent of
% pixel_wands view.
%
*/
WandExport WandView *NewWandViewExtent(MagickWand *wand,const ssize_t x,
const ssize_t y,const size_t width,const size_t height)
{
WandView
*wand_view;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
wand_view=(WandView *) AcquireMagickMemory(sizeof(*wand_view));
if (wand_view == (WandView *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
(void) ResetMagickMemory(wand_view,0,sizeof(*wand_view));
wand_view->id=AcquireWandId();
(void) FormatMagickString(wand_view->name,MaxTextExtent,"%s-%.20g",
WandViewId,(double) wand_view->id);
wand_view->description=ConstantString("WandView");
wand_view->view=AcquireCacheView(wand_view->wand->images);
wand_view->wand=wand;
wand_view->extent.width=width;
wand_view->extent.height=height;
wand_view->extent.x=x;
wand_view->extent.y=y;
wand_view->number_threads=GetOpenMPMaximumThreads();
wand_view->exception=AcquireExceptionInfo();
wand_view->pixel_wands=AcquirePixelsThreadSet(wand_view->extent.width,
wand_view->number_threads);
if (wand_view->pixel_wands == (PixelWand ***) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
wand_view->debug=IsEventLogging();
wand_view->signature=WandSignature;
return(wand_view);
}
示例7: ClonePixelView
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e P i x e l V i e w %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ClonePixelView() makes a copy of the specified pixel view.
%
% The format of the ClonePixelView method is:
%
% PixelView *ClonePixelView(const PixelView *pixel_view)
%
% A description of each parameter follows:
%
% o pixel_view: the pixel view.
%
*/
WandExport PixelView *ClonePixelView(const PixelView *pixel_view)
{
PixelView
*clone_view;
register long
i;
assert(pixel_view != (PixelView *) NULL);
assert(pixel_view->signature == WandSignature);
if (pixel_view->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",pixel_view->name);
clone_view=(PixelView *) AcquireMagickMemory(sizeof(*clone_view));
if (clone_view == (PixelView *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
pixel_view->name);
(void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
clone_view->id=AcquireWandId();
(void) FormatMagickString(clone_view->name,MaxTextExtent,"%s-%lu",PixelViewId,
clone_view->id);
clone_view->exception=AcquireExceptionInfo();
InheritException(clone_view->exception,pixel_view->exception);
clone_view->view=CloneCacheView(pixel_view->view);
clone_view->region=pixel_view->region;
clone_view->number_threads=pixel_view->number_threads;
for (i=0; i < (long) pixel_view->number_threads; i++)
clone_view->pixel_wands[i]=ClonePixelWands((const PixelWand **)
pixel_view->pixel_wands[i],pixel_view->region.width);
clone_view->debug=pixel_view->debug;
if (clone_view->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_view->name);
clone_view->signature=WandSignature;
return(clone_view);
}
示例8: CloneWandView
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e W a n d V i e w %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CloneWandView() makes a copy of the specified wand view.
%
% The format of the CloneWandView method is:
%
% WandView *CloneWandView(const WandView *wand_view)
%
% A description of each parameter follows:
%
% o wand_view: the wand view.
%
*/
WandExport WandView *CloneWandView(const WandView *wand_view)
{
WandView
*clone_view;
register ssize_t
i;
assert(wand_view != (WandView *) NULL);
assert(wand_view->signature == WandSignature);
if (wand_view->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand_view->name);
clone_view=(WandView *) AcquireMagickMemory(sizeof(*clone_view));
if (clone_view == (WandView *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
wand_view->name);
(void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
clone_view->id=AcquireWandId();
(void) FormatMagickString(clone_view->name,MaxTextExtent,"%s-%.20g",
WandViewId,(double) clone_view->id);
clone_view->description=ConstantString(wand_view->description);
clone_view->view=CloneCacheView(wand_view->view);
clone_view->extent=wand_view->extent;
clone_view->number_threads=wand_view->number_threads;
clone_view->exception=AcquireExceptionInfo();
InheritException(clone_view->exception,wand_view->exception);
for (i=0; i < (ssize_t) wand_view->number_threads; i++)
clone_view->pixel_wands[i]=ClonePixelWands((const PixelWand **)
wand_view->pixel_wands[i],wand_view->extent.width);
clone_view->debug=wand_view->debug;
if (clone_view->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_view->name);
clone_view->signature=WandSignature;
return(clone_view);
}
示例9: ListTypeInfo
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% L i s t T y p e I n f o %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ListTypeInfo() lists the fonts to a file.
%
% The format of the ListTypeInfo method is:
%
% MagickBooleanType ListTypeInfo(FILE *file,ExceptionInfo *exception)
%
% A description of each parameter follows.
%
% o file: An pointer to a FILE.
%
% o exception: Return any errors or warnings in this structure.
%
*/
MagickExport MagickBooleanType ListTypeInfo(FILE *file,ExceptionInfo *exception)
{
char
weight[MaxTextExtent];
const char
*family,
*name,
*path,
*stretch,
*style;
const TypeInfo
**type_info;
register long
i;
unsigned long
number_fonts;
if (file == (FILE *) NULL)
file=stdout;
number_fonts=0;
type_info=GetTypeInfoList("*",&number_fonts,exception);
if (type_info == (const TypeInfo **) NULL)
return(MagickFalse);
*weight='\0';
path=(const char *) NULL;
for (i=0; i < (long) number_fonts; i++)
{
if (type_info[i]->stealth != MagickFalse)
continue;
if ((path == (const char *) NULL) ||
(LocaleCompare(path,type_info[i]->path) != 0))
{
if (type_info[i]->path != (char *) NULL)
(void) fprintf(file,"\nPath: %s\n\n",type_info[i]->path);
(void) fprintf(file,"%-32.32s %-22.22s %-7.7s %-8.8s %-3s\n",
"Name","Family","Style","Stretch","Weight");
(void) fprintf(file,"--------------------------------------------------"
"------------------------------\n");
}
path=type_info[i]->path;
name="unknown";
if (type_info[i]->name != (char *) NULL)
name=type_info[i]->name;
family="unknown";
if (type_info[i]->family != (char *) NULL)
family=type_info[i]->family;
style=MagickOptionToMnemonic(MagickStyleOptions,type_info[i]->style);
stretch=MagickOptionToMnemonic(MagickStretchOptions,type_info[i]->stretch);
(void) FormatMagickString(weight,MaxTextExtent,"%lu",type_info[i]->weight);
(void) fprintf(file,"%-32.32s %-22.22s %-7.7s %-9.9s %6s\n",name,family,
style,stretch,weight);
}
(void) fflush(file);
type_info=(const TypeInfo **) RelinquishMagickMemory((void *) type_info);
return(MagickTrue);
}
示例10: WriteCLIPImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% W r i t e C L I P I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% WriteCLIPImage() writes an image of clip bytes to a file. It consists of
% data from the clip mask of the image.
%
% The format of the WriteCLIPImage method is:
%
% MagickBooleanType WriteCLIPImage(const ImageInfo *image_info,
% Image *image)
%
% A description of each parameter follows.
%
% o image_info: The image info.
%
% o image: The image.
%
*/
static MagickBooleanType WriteCLIPImage(const ImageInfo *image_info,
Image *image)
{
Image
*clip_image;
ImageInfo
*write_info;
MagickBooleanType
status;
if (image->clip_mask == (Image *) NULL)
(void) ClipImage(image);
if (image->clip_mask == (Image *) NULL)
ThrowWriterException(CoderError,"ImageDoesNotHaveAClipMask");
clip_image=CloneImage(image->clip_mask,0,0,MagickTrue,&image->exception);
if (clip_image == (Image *) NULL)
return(MagickFalse);
(void) SetImageType(clip_image,TrueColorType);
(void) CopyMagickString(clip_image->filename,image->filename,MaxTextExtent);
write_info=CloneImageInfo(image_info);
(void) SetImageInfo(write_info,MagickTrue,&image->exception);
if (LocaleCompare(write_info->magick,"CLIP") == 0)
(void) FormatMagickString(clip_image->filename,MaxTextExtent,"miff:%s",
write_info->filename);
status=WriteImage(write_info,clip_image);
clip_image=DestroyImage(clip_image);
write_info=DestroyImageInfo(write_info);
return(status);
}
示例11: CloneMagickWand
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e M a g i c k W a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CloneMagickWand() makes an exact copy of the specified wand.
%
% The format of the CloneMagickWand method is:
%
% MagickWand *CloneMagickWand(const MagickWand *wand)
%
% A description of each parameter follows:
%
% o wand: The magick wand.
%
*/
WandExport MagickWand *CloneMagickWand(const MagickWand *wand)
{
MagickWand
*clone_wand;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
if (clone_wand == (MagickWand *) NULL)
{
char
*message;
message=GetExceptionMessage(errno);
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
message);
message=DestroyString(message);
}
(void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
clone_wand->id=AcquireWandId();
(void) FormatMagickString(clone_wand->name,MaxTextExtent,"%s-%lu",
MagickWandId,clone_wand->id);
clone_wand->exception=AcquireExceptionInfo();
InheritException(clone_wand->exception,wand->exception);
clone_wand->image_info=CloneImageInfo(wand->image_info);
clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
clone_wand->images=CloneImageList(wand->images,clone_wand->exception);
clone_wand->debug=IsEventLogging();
if (clone_wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
clone_wand->signature=WandSignature;
return(clone_wand);
}
示例12: ReadDOTImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d D O T I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadDOTImage() reads a Graphviz 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 ReadDOTImage method is:
%
% Image *ReadDOTImage(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 *ReadDOTImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
char
command[MaxTextExtent];
const char
*option;
graph_t
*graph;
Image
*image;
ImageInfo
*read_info;
MagickBooleanType
status;
/*
Open image file.
*/
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=AllocateImage(image_info);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
return((Image *) NULL);
read_info=CloneImageInfo(image_info);
(void) CopyMagickString(read_info->magick,"PS",MaxTextExtent);
(void) AcquireUniqueFilename(read_info->filename);
(void) FormatMagickString(command,MaxTextExtent,"-Tps2 -o%s %s",
read_info->filename,image_info->filename);
graph=agread(GetBlobFileHandle(image));
if (graph == (graph_t *) NULL)
return ((Image *) NULL);
option=GetImageOption(image_info,"dot:layout-engine");
if (option == (const char *) NULL)
gvLayout(graphic_context,graph,"dot");
else
gvLayout(graphic_context,graph,(char *) option);
gvRenderFilename(graphic_context,graph,"ps2",read_info->filename);
gvFreeLayout(graphic_context,graph);
/*
Read Postscript graph.
*/
image=ReadImage(read_info,exception);
(void) RelinquishUniqueFileResource(read_info->filename);
read_info=DestroyImageInfo(read_info);
if (image == (Image *) NULL)
return((Image *) NULL);
return(GetFirstImageInList(image));
}
示例13: GetLocaleOptions
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t L o c a l e O p t i o n s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetLocaleOptions() returns any Magick configuration messages associated
% with the specified filename.
%
% The format of the GetLocaleOptions method is:
%
% LinkedListInfo *GetLocaleOptions(const char *filename,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o filename: the locale file tag.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport LinkedListInfo *GetLocaleOptions(const char *filename,
ExceptionInfo *exception)
{
char
path[MaxTextExtent];
const char
*element;
LinkedListInfo
*messages,
*paths;
StringInfo
*xml;
assert(filename != (const char *) NULL);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
assert(exception != (ExceptionInfo *) NULL);
(void) CopyMagickString(path,filename,MaxTextExtent);
/*
Load XML from configuration files to linked-list.
*/
messages=NewLinkedList(0);
paths=GetConfigurePaths(filename,exception);
if (paths != (LinkedListInfo *) NULL)
{
ResetLinkedListIterator(paths);
element=(const char *) GetNextValueInLinkedList(paths);
while (element != (const char *) NULL)
{
(void) FormatMagickString(path,MaxTextExtent,"%s%s",element,filename);
(void) LogMagickEvent(LocaleEvent,GetMagickModule(),
"Searching for locale file: \"%s\"",path);
xml=ConfigureFileToStringInfo(path);
if (xml != (StringInfo *) NULL)
(void) AppendValueToLinkedList(messages,xml);
element=(const char *) GetNextValueInLinkedList(paths);
}
paths=DestroyLinkedList(paths,RelinquishMagickMemory);
}
#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
char
*blob;
blob=(char *) NTResourceToBlob(filename);
if (blob != (char *) NULL)
{
xml=StringToStringInfo(blob);
(void) AppendValueToLinkedList(messages,xml);
blob=DestroyString(blob);
}
}
#endif
ResetLinkedListIterator(messages);
return(messages);
}
示例14: LoadTypeList
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% L o a d T y p e L i s t s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% LoadTypeList() loads one or more type configuration files which provides a
% mapping between type attributes and a type name.
%
% The format of the LoadTypeLists method is:
%
% MagickBooleanType LoadTypeLists(const char *filename,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o filename: the font file name.
%
% o exception: return any errors or warnings in this structure.
%
*/
static MagickBooleanType LoadTypeLists(const char *filename,
ExceptionInfo *exception)
{
#if defined(MAGICKCORE_EMBEDDABLE_SUPPORT)
return(LoadTypeList(TypeMap,"built-in",0,exception));
#else
char
*font_path,
path[MaxTextExtent];
const StringInfo
*option;
LinkedListInfo
*options;
MagickStatusType
status;
status=MagickFalse;
*path='\0';
options=GetConfigureOptions(filename,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
(void) CopyMagickString(path,GetStringInfoPath(option),MaxTextExtent);
status|=LoadTypeList((const char *) GetStringInfoDatum(option),
GetStringInfoPath(option),0,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyConfigureOptions(options);
font_path=GetEnvironmentValue("MAGICK_FONT_PATH");
if (font_path != (char *) NULL)
{
char
*option;
/*
Search MAGICK_FONT_PATH.
*/
(void) FormatMagickString(path,MaxTextExtent,"%s%s%s",font_path,
DirectorySeparator,filename);
option=FileToString(path,~0,exception);
if (option != (void *) NULL)
{
status|=LoadTypeList(option,path,0,exception);
option=DestroyString(option);
}
font_path=DestroyString(font_path);
}
if ((type_list == (SplayTreeInfo *) NULL) ||
(GetNumberOfNodesInSplayTree(type_list) == 0))
status|=LoadTypeList(TypeMap,"built-in",0,exception);
return(status != 0 ? MagickTrue : MagickFalse);
#endif
}
示例15: GetPathTemplate
static MagickBooleanType GetPathTemplate(char *path)
{
const char
*directory;
int
status;
struct stat
file_info;
(void) strcpy(path,"magick-XXXXXXXX");
directory=getenv("MAGICK_TMPDIR");
if (directory == (const char *) NULL)
directory=getenv("TMPDIR");
#if defined(__WINDOWS__)
if (directory == (const char *) NULL)
directory=getenv("TMP");
if (directory == (const char *) NULL)
directory=getenv("TEMP");
#endif
#if defined(__VMS)
directory=getenv("MTMPDIR");
#endif
#if defined(P_tmpdir)
if (directory == (const char *) NULL)
directory=P_tmpdir;
#endif
if (directory == (const char *) NULL)
return(MagickTrue);
if (strlen(directory) > (MaxTextExtent-15))
return(MagickTrue);
status=stat(directory,&file_info);
if ((status != 0) || !S_ISDIR(file_info.st_mode))
return(MagickTrue);
if (directory[strlen(directory)-1] == *DirectorySeparator)
(void) FormatMagickString(path,MaxTextExtent,"%smagick-XXXXXXXX",directory);
else
(void) FormatMagickString(path,MaxTextExtent,"%s%smagick-XXXXXXXX",
directory,DirectorySeparator);
return(MagickTrue);
}