本文整理汇总了C++中GetImageOption函数的典型用法代码示例。如果您正苦于以下问题:C++ GetImageOption函数的具体用法?C++ GetImageOption怎么用?C++ GetImageOption使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetImageOption函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetQuantumInfo
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t Q u a n t u m I n f o %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetQuantumInfo() initializes the QuantumInfo structure to default values.
%
% The format of the GetQuantumInfo method is:
%
% GetQuantumInfo(const ImageInfo *image_info,QuantumInfo *quantum_info)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o quantum_info: the quantum info.
%
*/
MagickExport void GetQuantumInfo(const ImageInfo *image_info,
QuantumInfo *quantum_info)
{
const char
*option;
assert(quantum_info != (QuantumInfo *) NULL);
(void) ResetMagickMemory(quantum_info,0,sizeof(*quantum_info));
quantum_info->quantum=8;
quantum_info->maximum=1.0;
quantum_info->scale=QuantumRange;
quantum_info->pack=MagickTrue;
quantum_info->semaphore=AcquireSemaphoreInfo();
quantum_info->signature=MagickCoreSignature;
if (image_info == (const ImageInfo *) NULL)
return;
option=GetImageOption(image_info,"quantum:format");
if (option != (char *) NULL)
quantum_info->format=(QuantumFormatType) ParseCommandOption(
MagickQuantumFormatOptions,MagickFalse,option);
option=GetImageOption(image_info,"quantum:minimum");
if (option != (char *) NULL)
quantum_info->minimum=StringToDouble(option,(char **) NULL);
option=GetImageOption(image_info,"quantum:maximum");
if (option != (char *) NULL)
quantum_info->maximum=StringToDouble(option,(char **) NULL);
if ((quantum_info->minimum == 0.0) && (quantum_info->maximum == 0.0))
quantum_info->scale=0.0;
else
if (quantum_info->minimum == quantum_info->maximum)
{
quantum_info->scale=(double) QuantumRange/quantum_info->minimum;
quantum_info->minimum=0.0;
}
else
quantum_info->scale=(double) QuantumRange/(quantum_info->maximum-
quantum_info->minimum);
option=GetImageOption(image_info,"quantum:scale");
if (option != (char *) NULL)
quantum_info->scale=StringToDouble(option,(char **) NULL);
option=GetImageOption(image_info,"quantum:polarity");
if (option != (char *) NULL)
quantum_info->min_is_white=LocaleCompare(option,"min-is-white") == 0 ?
MagickTrue : MagickFalse;
quantum_info->endian=image_info->endian;
ResetQuantumState(quantum_info);
}
示例2: 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));
}
示例3: ReadXImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d X I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadXImage() reads an image from an X window.
%
% The format of the ReadXImage method is:
%
% Image *ReadXImage(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 *ReadXImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
const char
*option;
XImportInfo
ximage_info;
(void) exception;
XGetImportInfo(&ximage_info);
option=GetImageOption(image_info,"x:screen");
if (option != (const char *) NULL)
ximage_info.screen=IsMagickTrue(option);
option=GetImageOption(image_info,"x:silent");
if (option != (const char *) NULL)
ximage_info.silent=IsMagickTrue(option);
return(XImportImage(image_info,&ximage_info,exception));
}
示例4: Info_page
VALUE
Info_page(VALUE self)
{
Info *info;
const char *page;
Data_Get_Struct(self, Info, info);
page = GetImageOption(info, "page");
return page ? rb_str_new2(page) : Qnil;
}
示例5: return
static inline const char *GetCINProperty(const ImageInfo *image_info,
const Image *image,const char *property,ExceptionInfo *exception)
{
const char
*value;
value=GetImageOption(image_info,property);
if (value != (const char *) NULL)
return(value);
return(GetImageProperty(image,property,exception));
}
示例6: Info_origin
/*
Method: Info#origin
Purpose: Return origin geometry
*/
VALUE
Info_origin(VALUE self)
{
Info *info;
const char *origin;
Data_Get_Struct(self, Info, info);
origin = GetImageOption(info, "origin");
return origin ? rb_str_new2(origin) : Qnil;
}
示例7: get_option
/*
Method: Info#get_option
Purpose: Return the value of the specified option
*/
static VALUE
get_option(VALUE self, const char *key)
{
Info *info;
const char *value;
Data_Get_Struct(self, Info, info);
value = GetImageOption(info, key);
if (value)
{
return rb_str_new2(value);
}
return Qnil;
}
示例8: OutputOptions
/*
Temporary Debugging Information
FUTURE: these should be able to be printed out using 'percent escapes'
Actually 'Properities' can already be output with "%[*]"
*/
static void OutputOptions(ImageInfo *image_info)
{
const char
*option,
*value;
(void) FormatLocaleFile(stdout," Global Options:\n");
ResetImageOptionIterator(image_info);
while ((option=GetNextImageOption(image_info)) != (const char *) NULL ) {
(void) FormatLocaleFile(stdout," %s: ",option);
value=GetImageOption(image_info,option);
if (value != (const char *) NULL)
(void) FormatLocaleFile(stdout,"%s\n",value);
}
ResetImageOptionIterator(image_info);
}
示例9: copy_options
static void copy_options(Image *image, Info *info)
{
char property[MaxTextExtent];
const char *value, *option;
ResetImageOptionIterator(info);
for (option = GetNextImageOption(info); option; option = GetNextImageOption(info))
{
value = GetImageOption(info,option);
if (value)
{
strncpy(property, value, MaxTextExtent);
property[MaxTextExtent-1] = '\0';
(void) SetImageArtifact(image, property, value);
}
}
}
示例10: Info_tile_offset
/*
Method: Image::Info#tile_offset
Purpose: returns tile_offset attribute values
*/
VALUE
Info_tile_offset(VALUE self)
{
Info *info;
const char *tile_offset;
Data_Get_Struct(self, Info, info);
tile_offset = GetImageOption(info, "tile-offset");
if (!tile_offset)
{
return Qnil;
}
return rb_str_new2(tile_offset);
}
示例11: get_dbl_option
/*
Static: get_dbl_option(obj, option)
Purpose: Get an Image::Info option floating-point value
Notes: Convert the string value to a float
*/
static VALUE get_dbl_option(VALUE self, const char *option)
{
Info *info;
const char *value;
double d;
long n;
Data_Get_Struct(self, Info, info);
value = GetImageOption(info, option);
if (!value)
{
return Qnil;
}
d = atof(value);
n = (long) floor(d);
return d == (double)n ? LONG2NUM(n) : rb_float_new(d);
}
示例12: Info_aref
VALUE
Info_aref(int argc, VALUE *argv, VALUE self)
{
Info *info;
char *format_p, *key_p;
long format_l, key_l;
const char *value;
char fkey[MaxTextExtent];
switch (argc)
{
case 2:
format_p = rm_str2cstr(argv[0], &format_l);
key_p = rm_str2cstr(argv[1], &key_l);
if (format_l > MAX_FORMAT_LEN || format_l + key_l > MaxTextExtent-1)
{
rb_raise(rb_eArgError, "can't reference %.60s:%.1024s - too long", format_p, key_p);
}
sprintf(fkey, "%.60s:%.*s", format_p, (int)(MaxTextExtent-61), key_p);
break;
case 1:
strncpy(fkey, StringValuePtr(argv[0]), sizeof(fkey)-1);
fkey[sizeof(fkey)-1] = '\0';
break;
default:
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
break;
}
Data_Get_Struct(self, Info, info);
value = GetImageOption(info, fkey);
if (!value)
{
return Qnil;
}
return rb_str_new2(value);
}
示例13: rm_set_user_artifact
/*
Function: rm_set_user_artifact
Purpose: If a "user" option is present in the Info, assign its value to
a "user" artifact in each image.
*/
void rm_set_user_artifact(Image *images, Info *info)
{
#if defined(HAVE_SETIMAGEARTIFACT)
Image *image;
const char *value;
value = GetImageOption(info, "user");
if (value)
{
image = GetFirstImageInList(images);
while (image)
{
(void) SetImageArtifact(image, "user", value);
image = GetNextImageInList(image);
}
}
#else
images = images;
info = info;
#endif
}
示例14: Info_delay
/*
Method: Info#delay
Purpose: Get the delay attribute
Notes: Convert from string to numeric
*/
VALUE
Info_delay(VALUE self)
{
Info *info;
const char *delay;
char *p;
long d;
Data_Get_Struct(self, Info, info);
delay = GetImageOption(info, "delay");
if (delay)
{
d = strtol(delay, &p, 10);
if (*p != '\0')
{
rb_raise(rb_eRangeError, "failed to convert %s to Numeric", delay);
}
return LONG2NUM(d);
}
return Qnil;
}
示例15: ReadImage
//.........这里部分代码省略.........
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)
{
geometry_info.rho=next->resolution.y;
geometry_info.sigma=1.0;
flags=ParseGeometry(value,&geometry_info);
if (geometry_info.sigma != 0)
next->resolution.y=geometry_info.rho/geometry_info.sigma;
(void) DeleteImageProperty(next,"exif:YResolution");
}
value=GetImageProperty(next,"tiff:ResolutionUnit",exception);
if (value == (char *) NULL)
value=GetImageProperty(next,"exif:ResolutionUnit",exception);
if (value != (char *) NULL)
{
next->units=(ResolutionType) (StringToLong(value)-1);
(void) DeleteImageProperty(next,"exif:ResolutionUnit");
(void) DeleteImageProperty(next,"tiff:ResolutionUnit");
}
if (next->page.width == 0)
next->page.width=next->columns;
if (next->page.height == 0)
next->page.height=next->rows;
option=GetImageOption(read_info,"caption");
if (option != (const char *) NULL)
{
property=InterpretImageProperties(read_info,next,option,exception);
(void) SetImageProperty(next,"caption",property,exception);
property=DestroyString(property);
}
option=GetImageOption(read_info,"comment");
if (option != (const char *) NULL)
{
property=InterpretImageProperties(read_info,next,option,exception);
(void) SetImageProperty(next,"comment",property,exception);
property=DestroyString(property);
}
option=GetImageOption(read_info,"label");
if (option != (const char *) NULL)
{
property=InterpretImageProperties(read_info,next,option,exception);
(void) SetImageProperty(next,"label",property,exception);
property=DestroyString(property);
}
if (LocaleCompare(next->magick,"TEXT") == 0)
(void) ParseAbsoluteGeometry("0x0+0+0",&next->page);
if ((read_info->extract != (char *) NULL) &&
(read_info->stream == (StreamHandler) NULL))
{
RectangleInfo
geometry;
flags=ParseAbsoluteGeometry(read_info->extract,&geometry);
if ((next->columns != geometry.width) ||
(next->rows != geometry.height))
{