本文整理汇总了C++中SetImageOption函数的典型用法代码示例。如果您正苦于以下问题:C++ SetImageOption函数的具体用法?C++ SetImageOption怎么用?C++ SetImageOption使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetImageOption函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_color_option
/*
Static: set_color_option
Purpose: Set a color name as the value of the specified option
Note: Call QueryColorDatabase to validate color name
*/
static VALUE set_color_option(VALUE self, const char *option, VALUE color)
{
Info *info;
char *name;
PixelPacket pp;
ExceptionInfo exception;
MagickBooleanType okay;
Data_Get_Struct(self, Info, info);
if (NIL_P(color))
{
(void) RemoveImageOption(info, option);
}
else
{
GetExceptionInfo(&exception);
name = StringValuePtr(color);
okay = QueryColorDatabase(name, &pp, &exception);
(void) DestroyExceptionInfo(&exception);
if (!okay)
{
rb_raise(rb_eArgError, "invalid color name `%s'", name);
}
(void) RemoveImageOption(info, option);
(void) SetImageOption(info, option, name);
}
return self;
}
示例2: Info_delay_eq
/*
Method: Info#delay=
Purpose: Set the delay attribute
Notes: Convert from numeric value to string.
*/
VALUE
Info_delay_eq(VALUE self, VALUE string)
{
Info *info;
int delay;
int not_num;
char dstr[20];
Data_Get_Struct(self, Info, info);
if (NIL_P(string))
{
(void) RemoveImageOption(info, "delay");
}
else
{
not_num = 0;
(void) rb_protect(arg_is_integer, string, ¬_num);
if (not_num)
{
rb_raise(rb_eTypeError, "failed to convert %s into Integer", rb_class2name(CLASS_OF(string)));
}
delay = NUM2INT(string);
sprintf(dstr, "%d", delay);
(void) RemoveImageOption(info, "delay");
(void) SetImageOption(info, "delay", dstr);
}
return self;
}
示例3: set_dbl_option
/*
Static: set_dbl_option(obj, option, value)
Purpose: Set an Image::Info option to a floating-point value
Notes: SetImageOption expects the value to be a string.
*/
static VALUE set_dbl_option(VALUE self, const char *option, VALUE value)
{
Info *info;
char buff[50];
double d;
long n;
int len;
Data_Get_Struct(self, Info, info);
if (NIL_P(value))
{
(void) RemoveImageOption(info, option);
}
else
{
d = NUM2DBL(value);
n = floor(d);
if (d == n)
{
len = sprintf(buff, "%-10ld", n);
}
else
{
len = sprintf(buff, "%-10.2f", d);
}
memset(buff+len, '\0', sizeof(buff)-len);
(void) RemoveImageOption(info, option);
(void) SetImageOption(info, option, buff);
}
return self;
}
示例4: Info_page_eq
/*
Method: Info#page=<aString> or <aGeometry>
Purpose: store the Postscript page geometry
*/
VALUE
Info_page_eq(VALUE self, VALUE page_arg)
{
Info *info;
volatile VALUE geom_str;
char *geometry;
Data_Get_Struct(self, Info, info);
if (NIL_P(page_arg))
{
magick_free(info->page);
info->page = NULL;
return self;
}
geom_str = rm_to_s(page_arg);
geometry=GetPageGeometry(StringValuePtr(geom_str));
if (*geometry == '\0')
{
magick_free(info->page);
info->page = NULL;
return self;
}
magick_clone_string(&info->page, geometry);
(void) SetImageOption(info, "page", StringValuePtr(geom_str));
return self;
}
示例5: Info_gravity_eq
/*
Method: Info#gravity=
Purpose: Convert a GravityType enum to a gravity option name and
store in the Info structure
*/
VALUE
Info_gravity_eq(VALUE self, VALUE grav)
{
Info *info;
GravityType gravity;
const char *option;
int x;
Data_Get_Struct(self, Info, info);
if (NIL_P(grav))
{
(void) RemoveImageOption(info, "gravity");
return self;
}
VALUE_TO_ENUM(grav, gravity, GravityType);
option = "Undefined";
for (x = 0; x < N_GRAVITY_OPTIONS; x++)
{
if (gravity == Gravity_Option[x].enumerator)
{
option = Gravity_Option[x].string;
break;
}
}
(void) SetImageOption(info, "gravity", option);
return self;
}
示例6: Info_origin_eq
/*
Method: Info#origin=+-x+-y
Purpose: Set origin geometry. Argument may be a Geometry object as well
as a geometry string.
*/
VALUE
Info_origin_eq(VALUE self, VALUE origin_arg)
{
Info *info;
volatile VALUE origin_str;
char *origin;
Data_Get_Struct(self, Info, info);
if (NIL_P(origin_arg))
{
(void) RemoveImageOption(info, "origin");
return self;
}
origin_str = rm_to_s(origin_arg);
origin = GetPageGeometry(StringValuePtr(origin_str));
if (IsGeometry(origin) == MagickFalse)
{
rb_raise(rb_eArgError, "invalid origin geometry: %s", origin);
}
(void) SetImageOption(info, "origin", origin);
return self;
}
示例7: Info_dispose_eq
/*
Method: Info#dispose=
Purpose: Convert a DisposeType enumerator into the equivalent
dispose option string
*/
VALUE
Info_dispose_eq(VALUE self, VALUE disp)
{
Info *info;
DisposeType dispose;
const char *option;
int x;
Data_Get_Struct(self, Info, info);
if (NIL_P(disp))
{
(void) RemoveImageOption(info, "dispose");
return self;
}
VALUE_TO_ENUM(disp, dispose, DisposeType);
option = "Undefined";
for (x = 0; x < N_DISPOSE_OPTIONS; x++)
{
if (dispose == Dispose_Option[x].enumerator)
{
option = Dispose_Option[x].string;
break;
}
}
(void) SetImageOption(info, "dispose", option);
return self;
}
示例8: getHandle
/*
* Class: magick_ImageInfo
* Method: setImageOption
* Signature: (Ljava/lang/String;Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_magick_ImageInfo_setImageOption
(JNIEnv *env, jobject self, jstring option, jstring value)
{
ImageInfo *info = NULL;
const char *cstr1 = NULL;
const char *cstr2 = NULL;
info = (ImageInfo *) getHandle(env, self, "imageInfoHandle", NULL);
if (info == NULL) {
throwMagickException(env, "Unable to retrieve handle");
return;
}
cstr1 = (*env)->GetStringUTFChars(env, option, 0);
if (cstr1 == NULL) {
throwMagickException(env, "Unable to retrieve Java string chars");
return;
}
cstr2 = (*env)->GetStringUTFChars(env, value, 0);
if (cstr2 == NULL) {
throwMagickException(env, "Unable to retrieve Java string chars");
return;
}
SetImageOption(info, (char *)AcquireString(cstr1), (char *)AcquireString(cstr2));
(*env)->ReleaseStringUTFChars(env, option, cstr1);
(*env)->ReleaseStringUTFChars(env, value, cstr2);
}
示例9: FormatLocaleString
void Magick::Options::setOption(const char *name,const double value_)
{
char
option[MagickPathExtent];
(void) FormatLocaleString(option,MagickPathExtent,"%.20g",value_);
(void) SetImageOption(_imageInfo,name,option);
}
示例10: SetImageOption
void Magick::Options::setOption(const char *name,const Color &value_)
{
std::string
option;
option=value_;
(void) SetImageOption(imageInfo(),name,option.c_str());
}
示例11: RelinquishMagickMemory
void Magick::Options::fontFamily(const std::string &family_)
{
if (family_.length() == 0)
{
_drawInfo->family=(char *) RelinquishMagickMemory(_drawInfo->font);
(void) RemoveImageOption(imageInfo(),"family");
}
else
{
Magick::CloneString(&_drawInfo->family,family_);
(void) SetImageOption(imageInfo(),"family",family_.c_str());
}
}
示例12: Info_scene_eq
VALUE
Info_scene_eq(VALUE self, VALUE scene)
{
Info *info;
char buf[25];
Data_Get_Struct(self, Info, info);
info->scene = NUM2ULONG(scene);
#if defined(HAVE_SNPRINTF)
(void) snprintf(buf, sizeof(buf), "%-ld", info->scene);
#else
(void) sprintf(buf, "%-l", info->scene);
#endif
(void) SetImageOption(info, "scene", buf);
return self;
}
示例13: set_option
/*
Method: Info#set_option
Purpose: Set the specified option to this value.
If the value is nil just unset any current value
*/
static VALUE
set_option(VALUE self, const char *key, VALUE string)
{
Info *info;
char *value;
Data_Get_Struct(self, Info, info);
if (NIL_P(string))
{
(void) RemoveImageOption(info, key);
}
else
{
value = StringValuePtr(string);
(void) SetImageOption(info, key, value);
}
return self;
}
示例14: Info_define
/*
Method: Info#define(format, key[, value])
Purpose: Call SetImageOption
Note: The only method in Info that is not an
attribute accessor.
*/
VALUE
Info_define(int argc, VALUE *argv, VALUE self)
{
Info *info;
char *format, *key;
const char *value = "";
long format_l, key_l;
char ckey[100];
unsigned int okay;
volatile VALUE fmt_arg;
Data_Get_Struct(self, Info, info);
switch (argc)
{
case 3:
/* Allow any argument that supports to_s */
fmt_arg = rb_String(argv[2]);
value = (const char *)StringValuePtr(fmt_arg);
case 2:
key = rm_str2cstr(argv[1], &key_l);
format = rm_str2cstr(argv[0], &format_l);
break;
default:
rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
}
if (2 + format_l + key_l > (long)sizeof(ckey))
{
rb_raise(rb_eArgError, "%.20s:%.20s not defined - format or key too long", format, key);
}
(void) sprintf(ckey, "%s:%s", format, key);
(void) RemoveImageOption(info, ckey);
okay = SetImageOption(info, ckey, value);
if (!okay)
{
rb_warn("%.20s=\"%.78s\" not defined - SetImageOption failed.", ckey, value);
return Qnil;
}
return self;
}
示例15: Info_tile_offset_eq
/*
Method: Image::Info#tile_offset= geometry
Purpose: info.tile_offset = [+/-]x[+/-]y
*/
VALUE
Info_tile_offset_eq(VALUE self, VALUE offset)
{
Info *info;
volatile VALUE offset_str;
char *tile_offset;
offset_str = rm_to_s(offset);
tile_offset = StringValuePtr(offset_str);
if (!IsGeometry(tile_offset))
{
rb_raise(rb_eArgError, "invalid tile offset geometry: %s", tile_offset);
}
Data_Get_Struct(self, Info, info);
(void) DeleteImageOption(info, "tile-offset");
(void) SetImageOption(info, "tile-offset", tile_offset);
return self;
}