本文整理汇总了C++中GetPathComponent函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPathComponent函数的具体用法?C++ GetPathComponent怎么用?C++ GetPathComponent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPathComponent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ThrowMagickExceptionList
MagickExport MagickBooleanType ThrowMagickExceptionList(
ExceptionInfo *exception,const char *module,const char *function,
const size_t line,const ExceptionType severity,const char *tag,
const char *format,va_list operands)
{
char
message[MaxTextExtent],
path[MaxTextExtent],
reason[MaxTextExtent];
const char
*locale,
*type;
int
n;
MagickBooleanType
status;
size_t
length;
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
locale=GetLocaleExceptionMessage(severity,tag);
(void) CopyMagickString(reason,locale,MaxTextExtent);
(void) ConcatenateMagickString(reason," ",MaxTextExtent);
length=strlen(reason);
#if defined(MAGICKCORE_HAVE_VSNPRINTF)
n=vsnprintf(reason+length,MaxTextExtent-length,format,operands);
#else
n=vsprintf(reason+length,format,operands);
#endif
if (n < 0)
reason[MaxTextExtent-1]='\0';
status=LogMagickEvent(ExceptionEvent,module,function,line,"%s",reason);
GetPathComponent(module,TailPath,path);
type="undefined";
if ((severity >= WarningException) && (severity < ErrorException))
type="warning";
if ((severity >= ErrorException) && (severity < FatalErrorException))
type="error";
if (severity >= FatalErrorException)
type="fatal";
(void) FormatLocaleString(message,MaxTextExtent,"%s @ %s/%s/%s/%.20g",reason,
type,path,function,(double) line);
(void) ThrowException(exception,severity,message,(char *) NULL);
return(status);
}
开发者ID:Distrotech,项目名称:ImageMagick,代码行数:50,代码来源:exception.c
示例2: LoadTypeCache
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
+ L o a d T y p e C a c h e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% LoadTypeCache() loads the type configurations which provides a mapping
% between type attributes and a type name.
%
% The format of the LoadTypeCache method is:
%
% MagickBooleanType LoadTypeCache(SplayTreeInfo *type_cache,
% const char *xml,const char *filename,const size_t depth,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o xml: The type list in XML format.
%
% o filename: The type list filename.
%
% o depth: depth of <include /> statements.
%
% o exception: return any errors or warnings in this structure.
%
*/
static inline MagickBooleanType SetTypeNodePath(const char *filename,
char *font_path,const char *token,char **target)
{
char
*path;
path=ConstantString(token);
#if defined(MAGICKCORE_WINDOWS_SUPPORT)
if (strchr(path,'@') != (char *) NULL)
SubstituteString(&path,"@[email protected]",font_path);
#endif
if (IsPathAccessible(path) == MagickFalse)
{
/*
Relative path.
*/
path=DestroyString(path);
GetPathComponent(filename,HeadPath,font_path);
(void) ConcatenateMagickString(font_path,DirectorySeparator,
MaxTextExtent);
(void) ConcatenateMagickString(font_path,token,MaxTextExtent);
path=ConstantString(font_path);
#if defined(MAGICKCORE_WINDOWS_SUPPORT)
if (strchr(path,'@') != (char *) NULL)
SubstituteString(&path,"@[email protected]","");
#endif
if (IsPathAccessible(path) == MagickFalse)
{
path=DestroyString(path);
return(MagickFalse);
}
}
*target=path;
return(MagickTrue);
}
开发者ID:INT2208-ST,项目名称:MyFriend,代码行数:67,代码来源:type.c
示例3: WriteXPMImage
//.........这里部分代码省略.........
for (i=0; i < (ssize_t) image->colors; i++)
if (image->colormap[i].opacity != OpaqueOpacity)
{
if (opacity < 0)
{
opacity=i;
continue;
}
alpha=(Quantum) TransparentOpacity-(MagickRealType)
image->colormap[i].opacity;
beta=(Quantum) TransparentOpacity-(MagickRealType)
image->colormap[opacity].opacity;
if (alpha < beta)
opacity=i;
}
}
if (opacity >= 0)
{
image->colormap[opacity].red=image->transparent_color.red;
image->colormap[opacity].green=image->transparent_color.green;
image->colormap[opacity].blue=image->transparent_color.blue;
}
}
/*
Compute the character per pixel.
*/
characters_per_pixel=1;
for (k=MaxCixels; (ssize_t) image->colors > k; k*=MaxCixels)
characters_per_pixel++;
/*
XPM header.
*/
(void) WriteBlobString(image,"/* XPM */\n");
GetPathComponent(image->filename,BasePath,basename);
if (isalnum((int) ((unsigned char) *basename)) == 0)
{
(void) FormatLocaleString(buffer,MaxTextExtent,"xpm_%s",basename);
(void) CopyMagickString(basename,buffer,MaxTextExtent);
}
if (isalpha((int) ((unsigned char) basename[0])) == 0)
basename[0]='_';
for (i=1; basename[i] != '\0'; i++)
if (isalnum((int) ((unsigned char) basename[i])) == 0)
basename[i]='_';
(void) FormatLocaleString(buffer,MaxTextExtent,
"static char *%s[] = {\n",basename);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"/* columns rows colors chars-per-pixel */\n");
(void) FormatLocaleString(buffer,MaxTextExtent,
"\"%.20g %.20g %.20g %.20g \",\n",(double) image->columns,(double)
image->rows,(double) image->colors,(double) characters_per_pixel);
(void) WriteBlobString(image,buffer);
GetMagickPixelPacket(image,&pixel);
for (i=0; i < (ssize_t) image->colors; i++)
{
/*
Define XPM color.
*/
SetMagickPixelPacket(image,image->colormap+i,(IndexPacket *) NULL,&pixel);
pixel.colorspace=sRGBColorspace;
pixel.depth=8;
pixel.opacity=(MagickRealType) OpaqueOpacity;
(void) QueryMagickColorname(image,&pixel,XPMCompliance,name,exception);
if (i == opacity)
(void) CopyMagickString(name,"None",MaxTextExtent);
/*
开发者ID:MarinaAndenko,项目名称:MyBlog,代码行数:67,代码来源:xpm.c
示例4: LoadConfigureList
//.........这里部分代码省略.........
}
if (LocaleNCompare(keyword,"<!--",4) == 0)
{
/*
Comment element.
*/
while ((LocaleNCompare(q,"->",2) != 0) && (*q != '\0'))
GetMagickToken(q,&q,token);
continue;
}
if (LocaleCompare(keyword,"<include") == 0)
{
/*
Include element.
*/
while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
{
(void) CopyMagickString(keyword,token,MaxTextExtent);
GetMagickToken(q,&q,token);
if (*token != '=')
continue;
GetMagickToken(q,&q,token);
if (LocaleCompare(keyword,"file") == 0)
{
if (depth > 200)
(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;
开发者ID:MaximOrlovsky,项目名称:unix-toolbox.js-imagemagick,代码行数:67,代码来源:configure.c
示例5: LoadFontConfigFonts
MagickExport MagickBooleanType LoadFontConfigFonts(SplayTreeInfo *type_list,
ExceptionInfo *exception)
{
#if !defined(FC_FULLNAME)
#define FC_FULLNAME "fullname"
#endif
char
extension[MaxTextExtent],
name[MaxTextExtent];
FcChar8
*family,
*file,
*fullname,
*style;
FcConfig
*font_config;
FcFontSet
*font_set;
FcObjectSet
*object_set;
FcPattern
*pattern;
FcResult
status;
int
slant,
width,
weight;
register ssize_t
i;
TypeInfo
*type_info;
/*
Load system fonts.
*/
(void) exception;
font_config=FcInitLoadConfigAndFonts();
if (font_config == (FcConfig *) NULL)
return(MagickFalse);
font_set=(FcFontSet *) NULL;
object_set=FcObjectSetBuild(FC_FULLNAME,FC_FAMILY,FC_STYLE,FC_SLANT,
FC_WIDTH,FC_WEIGHT,FC_FILE,(char *) NULL);
if (object_set != (FcObjectSet *) NULL)
{
pattern=FcPatternCreate();
if (pattern != (FcPattern *) NULL)
{
font_set=FcFontList(0,pattern,object_set);
FcPatternDestroy(pattern);
}
FcObjectSetDestroy(object_set);
}
if (font_set == (FcFontSet *) NULL)
{
FcConfigDestroy(font_config);
return(MagickFalse);
}
for (i=0; i < (ssize_t) font_set->nfont; i++)
{
status=FcPatternGetString(font_set->fonts[i],FC_FAMILY,0,&family);
if (status != FcResultMatch)
continue;
status=FcPatternGetString(font_set->fonts[i],FC_FILE,0,&file);
if (status != FcResultMatch)
continue;
*extension='\0';
GetPathComponent((const char *) file,ExtensionPath,extension);
if ((*extension != '\0') && (LocaleCompare(extension,"gz") == 0))
continue;
type_info=(TypeInfo *) AcquireMagickMemory(sizeof(*type_info));
if (type_info == (TypeInfo *) NULL)
continue;
(void) ResetMagickMemory(type_info,0,sizeof(*type_info));
type_info->path=ConstantString("System Fonts");
type_info->signature=MagickSignature;
(void) CopyMagickString(name,"Unknown",MaxTextExtent);
status=FcPatternGetString(font_set->fonts[i],FC_FULLNAME,0,&fullname);
if ((status == FcResultMatch) && (fullname != (FcChar8 *) NULL))
(void) CopyMagickString(name,(const char *) fullname,MaxTextExtent);
else
{
if (family != (FcChar8 *) NULL)
(void) CopyMagickString(name,(const char *) family,MaxTextExtent);
status=FcPatternGetString(font_set->fonts[i],FC_STYLE,0,&style);
if ((status == FcResultMatch) && (style != (FcChar8 *) NULL) &&
(LocaleCompare((const char *) style,"Regular") != 0))
{
(void) ConcatenateMagickString(name," ",MaxTextExtent);
(void) ConcatenateMagickString(name,(const char *) style,
//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,代码来源:type.c
示例6: ReadImage
//.........这里部分代码省略.........
clones=CloneImages(image,read_info->scenes,exception);
if (clones == (Image *) NULL)
(void) ThrowMagickException(exception,GetMagickModule(),OptionError,
"SubimageSpecificationReturnsNoImages","`%s'",read_info->filename);
else
{
image=DestroyImageList(image);
image=GetFirstImageInList(clones);
}
}
if (GetBlobError(image) != MagickFalse)
{
ThrowFileException(exception,FileOpenError,
"AnErrorHasOccurredReadingFromFile",read_info->filename);
image=DestroyImageList(image);
read_info=DestroyImageInfo(read_info);
return((Image *) NULL);
}
for (next=image; next != (Image *) NULL; next=GetNextImageInList(next))
{
char
magick_path[MaxTextExtent],
*property,
timestamp[MaxTextExtent];
const char
*option;
const StringInfo
*profile;
next->taint=MagickFalse;
GetPathComponent(magick_filename,MagickPath,magick_path);
if (*magick_path == '\0')
(void) CopyMagickString(next->magick,magick,MaxTextExtent);
(void) CopyMagickString(next->magick_filename,magick_filename,
MaxTextExtent);
if (IsBlobTemporary(image) != MagickFalse)
(void) CopyMagickString(next->filename,filename,MaxTextExtent);
if (next->magick_columns == 0)
next->magick_columns=next->columns;
if (next->magick_rows == 0)
next->magick_rows=next->rows;
value=GetImageProperty(next,"tiff:Orientation",exception);
if (value == (char *) NULL)
value=GetImageProperty(next,"exif:Orientation",exception);
if (value != (char *) NULL)
{
next->orientation=(OrientationType) StringToLong(value);
(void) DeleteImageProperty(next,"tiff:Orientation");
(void) DeleteImageProperty(next,"exif:Orientation");
}
value=GetImageProperty(next,"exif:XResolution",exception);
if (value != (char *) NULL)
{
geometry_info.rho=next->resolution.x;
geometry_info.sigma=1.0;
flags=ParseGeometry(value,&geometry_info);
if (geometry_info.sigma != 0)
next->resolution.x=geometry_info.rho/geometry_info.sigma;
(void) DeleteImageProperty(next,"exif:XResolution");
}
value=GetImageProperty(next,"exif:YResolution",exception);
if (value != (char *) NULL)
{
开发者ID:ChaseReid,项目名称:ImageMagick,代码行数:67,代码来源:constitute.c
示例7: WriteMPEGImage
//.........这里部分代码省略.........
length=0;
scene=p->scene;
delay=100.0*p->delay/MagickMax(1.0*p->ticks_per_second,1.0);
for (i=0; i < (ssize_t) MagickMax((1.0*delay+1.0)/3.0,1.0); i++)
{
p->scene=count;
count++;
status=MagickFalse;
switch (i)
{
case 0:
{
Image
*frame;
(void) FormatLocaleString(p->filename,MagickPathExtent,"%s%.20g.%s",
basename,(double) p->scene,WriteMPEGIntermediateFormat);
(void) FormatLocaleString(filename,MagickPathExtent,"%s%.20g.%s",
basename,(double) p->scene,WriteMPEGIntermediateFormat);
(void) FormatLocaleString(previous_image,MagickPathExtent,
"%s%.20g.%s",basename,(double) p->scene,
WriteMPEGIntermediateFormat);
frame=CloneImage(p,0,0,MagickTrue,exception);
if (frame == (Image *) NULL)
break;
status=WriteImage(write_info,frame,exception);
frame=DestroyImage(frame);
break;
}
case 1:
{
blob=(unsigned char *) FileToBlob(previous_image,~0UL,&length,
exception);
}
default:
{
(void) FormatLocaleString(filename,MagickPathExtent,"%s%.20g.%s",
basename,(double) p->scene,WriteMPEGIntermediateFormat);
if (length > 0)
status=BlobToFile(filename,blob,length,exception);
break;
}
}
if (image->debug != MagickFalse)
{
if (status != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"%.20g. Wrote %s file for scene %.20g:",(double) i,
WriteMPEGIntermediateFormat,(double) p->scene);
else
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"%.20g. Failed to write %s file for scene %.20g:",(double) i,
WriteMPEGIntermediateFormat,(double) p->scene);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"%s",filename);
}
}
p->scene=scene;
if (blob != (unsigned char *) NULL)
blob=(unsigned char *) RelinquishMagickMemory(blob);
if (status == MagickFalse)
break;
}
/*
Convert JPEG to MPEG.
*/
(void) CopyMagickString(coalesce_image->magick_filename,basename,
MagickPathExtent);
(void) CopyMagickString(coalesce_image->filename,basename,MagickPathExtent);
GetPathComponent(image_info->filename,ExtensionPath,coalesce_image->magick);
if (*coalesce_image->magick == '\0')
(void) CopyMagickString(coalesce_image->magick,image->magick,
MagickPathExtent);
status=InvokeDelegate(write_info,coalesce_image,(char *) NULL,"mpeg:encode",
exception);
(void) FormatLocaleString(write_info->filename,MagickPathExtent,"%s.%s",
write_info->unique,coalesce_image->magick);
status=CopyDelegateFile(write_info->filename,image->filename);
(void) RelinquishUniqueFileResource(write_info->filename);
write_info=DestroyImageInfo(write_info);
/*
Relinquish resources.
*/
count=0;
for (p=coalesce_image; p != (Image *) NULL; p=GetNextImageInList(p))
{
delay=100.0*p->delay/MagickMax(1.0*p->ticks_per_second,1.0);
for (i=0; i < (ssize_t) MagickMax((1.0*delay+1.0)/3.0,1.0); i++)
{
(void) FormatLocaleString(p->filename,MagickPathExtent,"%s%.20g.%s",
basename,(double) count++,WriteMPEGIntermediateFormat);
(void) RelinquishUniqueFileResource(p->filename);
}
(void) CopyMagickString(p->filename,image_info->filename,MagickPathExtent);
}
(void) RelinquishUniqueFileResource(basename);
coalesce_image=DestroyImageList(coalesce_image);
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"exit");
return(status);
}
开发者ID:vcgato29,项目名称:ImageMagick,代码行数:101,代码来源:mpeg.c
示例8: LoadCoderCache
//.........这里部分代码省略.........
}
if (LocaleNCompare(keyword,"<!--",4) == 0)
{
/*
Comment element.
*/
while ((LocaleNCompare(q,"->",2) != 0) && (*q != '\0'))
GetNextToken(q,&q,extent,token);
continue;
}
if (LocaleCompare(keyword,"<include") == 0)
{
/*
Include element.
*/
while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
{
(void) CopyMagickString(keyword,token,MagickPathExtent);
GetNextToken(q,&q,extent,token);
if (*token != '=')
continue;
GetNextToken(q,&q,extent,token);
if (LocaleCompare(keyword,"file") == 0)
{
if (depth > 200)
(void) ThrowMagickException(exception,GetMagickModule(),
ConfigureError,"IncludeNodeNestedTooDeeply","`%s'",token);
else
{
char
path[MagickPathExtent],
*file_xml;
GetPathComponent(filename,HeadPath,path);
if (*path != '\0')
(void) ConcatenateMagickString(path,DirectorySeparator,
MagickPathExtent);
if (*token == *DirectorySeparator)
(void) CopyMagickString(path,token,MagickPathExtent);
else
(void) ConcatenateMagickString(path,token,MagickPathExtent);
file_xml=FileToXML(path,~0UL);
if (file_xml != (char *) NULL)
{
status&=LoadCoderCache(coder_cache,file_xml,path,depth+1,
exception);
file_xml=DestroyString(file_xml);
}
}
}
}
continue;
}
if (LocaleCompare(keyword,"<coder") == 0)
{
/*
Coder element.
*/
coder_info=(CoderInfo *) AcquireMagickMemory(sizeof(*coder_info));
if (coder_info == (CoderInfo *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(coder_info,0,sizeof(*coder_info));
coder_info->path=ConstantString(filename);
coder_info->exempt=MagickFalse;
coder_info->signature=MagickCoreSignature;
continue;
开发者ID:JimBobSquarePants,项目名称:ImageMagick,代码行数:67,代码来源:coder.c
示例9: MagickMain
static int MagickMain(int argc,char **argv)
{
#define MagickCommandSize(name,use_metadata,command) \
{ (name), sizeof(name)-1, (use_metadata), (command) }
typedef struct _CommandInfo
{
const char
*client_name;
size_t
extent;
MagickBooleanType
use_metadata;
MagickCommand
command;
} CommandInfo;
const CommandInfo
MagickCommands[] =
{
MagickCommandSize("magick", MagickFalse, MagickImageCommand),
MagickCommandSize("convert", MagickFalse, ConvertImageCommand),
MagickCommandSize("composite", MagickFalse, CompositeImageCommand),
MagickCommandSize("identify", MagickTrue, IdentifyImageCommand),
MagickCommandSize("animate", MagickFalse, AnimateImageCommand),
MagickCommandSize("compare", MagickTrue, CompareImagesCommand),
MagickCommandSize("conjure", MagickFalse, ConjureImageCommand),
MagickCommandSize("display", MagickFalse, DisplayImageCommand),
MagickCommandSize("import", MagickFalse, ImportImageCommand),
MagickCommandSize("mogrify", MagickFalse, MogrifyImageCommand),
MagickCommandSize("montage", MagickFalse, MontageImageCommand),
MagickCommandSize("stream", MagickFalse, StreamImageCommand)
};
char
client_name[MagickPathExtent],
*metadata;
ExceptionInfo
*exception;
ImageInfo
*image_info;
int
exit_code,
offset;
MagickBooleanType
status;
register ssize_t
i;
size_t
number_commands;
MagickCoreGenesis(*argv,MagickTrue);
exception=AcquireExceptionInfo();
image_info=AcquireImageInfo();
GetPathComponent(argv[0],TailPath,client_name);
number_commands=sizeof(MagickCommands)/sizeof(MagickCommands[0]);
for (i=0; i < (ssize_t) number_commands; i++)
{
offset=LocaleNCompare(MagickCommands[i].client_name,client_name,
MagickCommands[i].extent);
if (offset == 0)
break;
}
i%=(number_commands);
if ((i == 0) && (argc > 1))
{
for (i=1; i < (ssize_t) number_commands; i++)
{
offset=LocaleCompare(MagickCommands[i].client_name,argv[1]);
if (offset == 0)
{
argc--;
argv++;
break;
}
}
i%=number_commands;
}
metadata=(char *) NULL;
status=MagickCommandGenesis(image_info,MagickCommands[i].command,argc,argv,
MagickCommands[i].use_metadata ? &metadata : (char **) NULL,exception);
if (metadata != (char *) NULL)
{
(void) fputs(metadata,stdout);
metadata=DestroyString(metadata);
}
if (MagickCommands[i].command != CompareImagesCommand)
exit_code=status != MagickFalse ? 0 : 1;
else
{
if (status == MagickFalse)
//.........这里部分代码省略.........
开发者ID:vcgato29,项目名称:ImageMagick,代码行数:101,代码来源:magick.c
示例10: MagickImageCommand
WandExport MagickBooleanType MagickImageCommand(ImageInfo *image_info,int argc,
char **argv,char **metadata,ExceptionInfo *exception)
{
MagickCLI
*cli_wand;
size_t
len;
assert(image_info != (ImageInfo *) NULL);
/* For specific OS command line requirements */
ReadCommandlLine(argc,&argv);
/* Initialize special "CLI Wand" to hold images and settings (empty) */
cli_wand=AcquireMagickCLI(image_info,exception);
cli_wand->location="Initializing";
cli_wand->filename=argv[0];
cli_wand->line=1;
if (cli_wand->wand.debug != MagickFalse)
(void) CLILogEvent(cli_wand,CommandEvent,GetMagickModule(),
"\"%s\"",argv[0]);
GetPathComponent(argv[0],TailPath,cli_wand->wand.name);
SetClientName(cli_wand->wand.name);
ConcatenateMagickString(cli_wand->wand.name,"-CLI",MagickPathExtent);
len=strlen(argv[0]); /* precaution */
/* "convert" command - give a "deprecated" warning" */
if (len>=7 && LocaleCompare("convert",argv[0]+len-7) == 0) {
cli_wand->process_flags = ConvertCommandOptionFlags;
(void) FormatLocaleFile(stderr,"WARNING: %s\n",
"The convert command is deprecated in IMv7, use \"magick\"\n");
}
/* Special Case: If command name ends with "script" implied "-script" */
if (len>=6 && LocaleCompare("script",argv[0]+len-6) == 0) {
if (argc >= 2 && ( (*(argv[1]) != '-') || (strlen(argv[1]) == 1) )) {
GetPathComponent(argv[1],TailPath,cli_wand->wand.name);
ProcessScriptOptions(cli_wand,argv[1],argc,argv,2);
goto Magick_Command_Cleanup;
}
}
/* Special Case: Version Information and Abort */
if (argc == 2) {
if ((LocaleCompare("-version",argv[1]) == 0) || /* GNU standard option */
(LocaleCompare("--version",argv[1]) == 0) ) { /* just version */
CLIOption(cli_wand, "-version");
goto Magick_Command_Exit;
}
if ((LocaleCompare("-help",argv[1]) == 0) || /* GNU standard option */
(LocaleCompare("--help",argv[1]) == 0) ) { /* just a brief summary */
if (cli_wand->wand.debug != MagickFalse)
(void) CLILogEvent(cli_wand,CommandEvent,GetMagickModule(),
"- Special Option \"%s\"", argv[1]);
MagickUsage(MagickFalse);
goto Magick_Command_Exit;
}
if (LocaleCompare("-usage",argv[1]) == 0) { /* both version & usage */
if (cli_wand->wand.debug != MagickFalse)
(void) CLILogEvent(cli_wand,CommandEvent,GetMagickModule(),
"- Special Option \"%s\"", argv[1]);
CLIOption(cli_wand, "-version" );
MagickUsage(MagickTrue);
goto Magick_Command_Exit;
}
}
/* not enough arguments -- including -help */
if (argc < 3) {
(void) FormatLocaleFile(stderr,
"Error: Invalid argument or not enough arguments\n\n");
MagickUsage(MagickFalse);
goto Magick_Command_Exit;
}
/* Special "concatenate option (hidden) for delegate usage */
if (LocaleCompare("-concatenate",argv[1]) == 0) {
if (cli_wand->wand.debug != MagickFalse)
(void) CLILogEvent(cli_wand,CommandEvent,GetMagickModule(),
"- Special Option \"%s\"", argv[1]);
ConcatenateImages(argc,argv,exception);
goto Magick_Command_Exit;
}
/* List Information and Abort */
if (argc == 3 && LocaleCompare("-list",argv[1]) == 0) {
CLIOption(cli_wand, argv[1], argv[2]);
goto Magick_Command_Exit;
}
/* ------------- */
/* The Main Call */
if (LocaleCompare("-script",argv[1]) == 0) {
/* Start processing directly from script, no pre-script options
//.........这里部分代码省略.........
开发者ID:JimBobSquarePants,项目名称:ImageMagick,代码行数:101,代码来源:magick-cli.c
示例11: WriteCIPImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% W r i t e C I P I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Procedure WriteCIPImage() writes an image to a file in the Cisco IP phone
% image format.
%
% The format of the WriteCIPImage method is:
%
% MagickBooleanType WriteCIPImage(const ImageInfo *image_info,Image *image)
%
% A description of each parameter follows.
%
% o image_info: The image info.
%
% o image: The image.
%
%
*/
static MagickBooleanType WriteCIPImage(const ImageInfo *image_info,Image *image)
{
char
buffer[MaxTextExtent];
const ImageAttribute
*attribute;
long
y;
MagickBooleanType
status;
register const PixelPacket
*p;
register long
i,
x;
unsigned char
byte;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
(void) WriteBlobString(image,"<CiscoIPPhoneImage>\n");
attribute=GetImageAttribute(image,"Label");
if (attribute != (const ImageAttribute *) NULL)
(void) FormatMagickString(buffer,MaxTextExtent,"<Title>%s</Title>\n",
attribute->value);
else
{
char
basename[MaxTextExtent];
GetPathComponent(image->filename,BasePath,basename);
(void) FormatMagickString(buffer,MaxTextExtent,"<Title>%s</Title>\n",
basename);
}
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,"<LocationX>%ld</LocationX>\n",
image->page.x);
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,"<LocationY>%ld</LocationY>\n",
image->page.y);
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,"<Width>%lu</Width>\n",
image->columns+(image->columns % 2));
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,"<Height>%lu</Height>\n",
image->rows);
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,"<Depth>2</Depth>\n");
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"<Data>");
(void) SetImageColorspace(image,RGBColorspace);
for (y=0; y < (long) image->rows; y++)
{
p=AcquireImagePixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
for (x=0; x < ((long) image->columns-3); x+=4)
{
//.........这里部分代码省略.........
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:101,代码来源:cip.c
示例12: LoadMimeCache
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
+ L o a d M i m e C a c h e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% LoadMimeCache() loads the mime configurations which provides a mapping
% between mime attributes and a mime name.
%
% The format of the LoadMimeCache method is:
%
% MagickBooleanType LoadMimeCache(LinkedListInfo *cache,const char *xml,
% const char *filename,const size_t depth,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o xml: The mime list in XML format.
%
% o filename: The mime list filename.
%
% o depth: depth of <include /> statements.
%
% o exception: return any errors or warnings in this structure.
%
*/
static MagickBooleanType LoadMimeCache(LinkedListInfo *cache,const char *xml,
const char *filename,const size_t depth,ExceptionInfo *exception)
{
const char
*attribute;
MimeInfo
*mime_info = (MimeInfo *) NULL;
MagickStatusType
status;
XMLTreeInfo
*mime,
*mime_map,
*include;
/*
Load the mime map file.
*/
(void) LogMagickEvent(ConfigureEvent,GetMagickModule(),
"Loading mime map \"%s\" ...",filename);
if (xml == (const char *) NULL)
return(MagickFalse);
mime_map=NewXMLTree(xml,exception);
if (mime_map == (XMLTreeInfo *) NULL)
return(MagickFalse);
status=MagickTrue;
include=GetXMLTreeChild(mime_map,"include");
while (include != (XMLTreeInfo *) NULL)
{
/*
Process include element.
*/
attribute=GetXMLTreeAttribute(include,"file");
if (attribute != (const char *) NULL)
{
if (depth > 200)
(void) ThrowMagickException(exception,GetMagickModule(),
ConfigureError,"IncludeElementNestedTooDeeply","`%s'",filename);
else
{
char
path[MagickPathExtent],
*file_xml;
GetPathComponent(filename,HeadPath,path);
if (*path != '\0')
(void) ConcatenateMagickString(path,DirectorySeparator,
MagickPathExtent);
if (*attribute == *DirectorySeparator)
(void) CopyMagickString(path,attribute,MagickPathExtent);
else
(void) ConcatenateMagickString(path,attribute,MagickPathExtent);
file_xml=FileToXML(path,~0UL);
if (file_xml != (char *) NULL)
{
status&=LoadMimeCache(cache,file_xml,path,depth+1,exception);
file_xml=DestroyString(file_xml);
}
}
}
include=GetNextXMLTreeTag(include);
}
mime=GetXMLTreeChild(mime_map,"mime");
while (mime != (XMLTreeInfo *) NULL)
{
/*
Process mime element.
*/
//.........这里部分代码省略.........
开发者ID:vcgato29,项目名称:ImageMagick,代码行数:101,代码来源:mime.c
示例13: WriteHTMLImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% W r i t e H T M L I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% WriteHTMLImage() writes an image in the HTML encoded image format.
%
% The format of the WriteHTMLImage method is:
%
% MagickBooleanType WriteHTMLImage(const ImageInfo *image_info,Image *image)
%
% A description of each parameter follows.
%
% o image_info: the image info.
%
% o image: The image.
%
%
*/
static MagickBooleanType WriteHTMLImage(const ImageInfo *image_info,
Image *image)
{
char
basename[MaxTextExtent],
buffer[MaxTextExtent],
filename[MaxTextExtent],
mapname[MaxTextExtent],
url[MaxTextExtent];
Image
*next;
ImageInfo
*write_info;
MagickBooleanType
status;
RectangleInfo
geometry;
register char
*p;
/*
Open image.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
(void) CloseBlob(image);
if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
(void) TransformImageColorspace(image,sRGBColorspace);
*url='\0';
if ((LocaleCompare(image_info->magick,"FTP") == 0) ||
(LocaleCompare(image_info->magick,"HTTP") == 0))
{
/*
Extract URL base from filename.
*/
p=strrchr(image->filename,'/');
if (p != (char *) NULL)
{
p++;
(void) CopyMagickString(url,image_info->magick,MaxTextExtent);
(void) ConcatenateMagickString(url,":",MaxTextExtent);
url[strlen(url)+p-image->filename]='\0';
(void) ConcatenateMagickString(url,image->filename,
p-image->filename+2);
(void) CopyMagickString(image->filename,p,MaxTextExtent);
}
}
/*
Refer to image map file.
*/
(void) CopyMagickString(filename,image->filename,MaxTextExtent);
AppendImageFormat("map",filename);
GetPathComponent(filename,BasePath,basename);
(void) CopyMagickString(mapname,basename,MaxTextExtent);
(void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent);
(void) CopyMagickString(filename,image->filename,MaxTextExtent);
write_info=CloneImageInfo(image_info);
write_info->adjoin=MagickTrue;
status=MagickTrue;
if (LocaleCompare(image_info->magick,"SHTML") != 0)
{
const char
//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,代码来源:html.c
示例14: WriteUILImage
//.........这里部分代码省略.........
if (transparent != MagickFalse)
{
register Quantum
*q;
colors++;
for (y=0; y < (ssize_t) image->rows; y++)
{
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
if (matte_image[i] != 0)
SetPixelIndex(image,(Quantum) image->colors,q);
q+=GetPixelChannels(image);
}
}
}
if (matte_image != (unsigned char *) NULL)
matte_image=(unsigned char *) RelinquishMagickMemory(matte_image);
}
/*
Compute the character per pixel.
*/
characters_per_pixel=1;
for (k=MaxCixels; (ssize_t) colors > k; k*=MaxCixels)
characters_per_pixel++;
/*
UIL header.
*/
symbol=AcquireString("");
(void) WriteBlobString(image,"/* UIL */\n");
GetPathComponent(image->filename,BasePath,basename);
(void) FormatLocaleString(buffer,MagickPathExtent,
"value\n %s_ct : color_table(\n",basename);
(void) WriteBlobString(image,buffer);
GetPixelInfo(image,&pixel);
for (i=0; i < (ssize_t) colors; i++)
{
/*
Define UIL color.
*/
pixel=image->colormap[i];
pixel.colorspace=sRGBColorspace;
pixel.depth=8;
pixel.alpha=(double) OpaqueAlpha;
GetColorTuple(&pixel,MagickTrue,name);
if (transparent != MagickFalse)
if (i == (ssize_t) (colors-1))
(void) CopyMagickString(name,"None",MagickPathExtent);
/*
Write UIL color.
*/
k=i % MaxCixels;
symbol[0]=Cixel[k];
for (j=1; j < (int) characters_per_pixel; j++)
{
k=((i-k)/MaxCixels) % MaxCixels;
symbol[j]=Cixel[k];
}
symbol[j]='\0';
(void) SubstituteString(&symbol,"'","''");
if (LocaleCompare(name,"None") == 0)
(void) FormatLocaleString(buffer,MagickPathExtent,
" background color = '%s'",symbol);
开发者ID:JosephineWolff,项目名称:ImageMagick,代码行数:67,代码来源:uil.c
示例15: LoadLocaleList
//.........这里部分代码省略.........
}
continue;
}
if (LocaleCompare(keyword,"<include") == 0)
{
/*
Include element.
*/
while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
{
(void) CopyMagickString(keyword,token,MaxTextExtent);
GetMagickToken(q,&q,token);
if (*token != '=')
continue;
GetMagickToken(q,&q,token);
if (LocaleCompare(keyword,"locale") == 0)
{
if (LocaleCompare(locale,token) != 0)
break;
continue;
}
if (LocaleCompare(keyword,"file") == 0)
{
if (depth > 200)
(void) ThrowMagickException(exception,GetMagickModule(),
ConfigureError,"IncludeElementNestedTooDeeply","`%s'",token);
else
{
char
path[MaxTextExtent],
*xml;
*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);
xml=FileToString(path,~0,exception);
if (xml != (char *) NULL)
{
status=LoadLocaleList(xml,path,locale,depth+1,exception);
xml=(char *) RelinquishMagickMemory(xml);
}
}
}
}
continue;
}
if (LocaleCompare(keyword,"<locale") == 0)
{
/*
Locale element.
*/
while ((*token != '>') && (*q != '\0'))
{
(void) CopyMagickString(keyword,token,MaxTextExtent);
GetMagickToken(q,&q,token);
if (*token != '=')
continue;
GetMagickToken(q,&q,token);
}
continue;
开发者ID:0xPr0 |
请发表评论