本文整理汇总了C++中ImageIOParameter::init方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageIOParameter::init方法的具体用法?C++ ImageIOParameter::init怎么用?C++ ImageIOParameter::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageIOParameter
的用法示例。
在下文中一共展示了ImageIOParameter::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: param
void
ImageSpec::attribute (string_view name, TypeDesc type, string_view value)
{
ImageIOParameter param (name, type, 1, NULL);
TypeDesc::BASETYPE basetype = (TypeDesc::BASETYPE)type.basetype;
if (basetype == TypeDesc::INT) {
parse_elements<int> (name, type, "%d", value, param);
} else if (basetype == TypeDesc::UINT) {
parse_elements<unsigned int> (name, type, "%u", value, param);
} else if (basetype == TypeDesc::FLOAT) {
parse_elements<float> (name, type, "%f", value, param);
} else if (basetype == TypeDesc::DOUBLE) {
parse_elements<double> (name, type, "%lf", value, param);
} else if (basetype == TypeDesc::INT64) {
parse_elements<long long> (name, type, "%lld", value, param);
} else if (basetype == TypeDesc::UINT64) {
parse_elements<unsigned long long> (name, type, "%llu", value, param);
} else if (basetype == TypeDesc::INT16) {
parse_elements<short> (name, type, "%hd", value, param);
} else if (basetype == TypeDesc::UINT16) {
parse_elements<unsigned short> (name, type, "%hu", value, param);
} else if (type == TypeDesc::STRING) {
ustring s (value);
param.init (name, TypeDesc::TypeString, 1, &s);
}
// Don't allow duplicates
ImageIOParameter *f = find_attribute (name);
if (f) {
*f = param;
} else {
extra_attribs.push_back (param);
}
}
示例2:
void
ImageSpec::attribute (const std::string &name, TypeDesc type, const void *value)
{
// Don't allow duplicates
ImageIOParameter *f = find_attribute (name);
if (! f) {
extra_attribs.resize (extra_attribs.size() + 1);
f = &extra_attribs.back();
}
f->init (name, type, 1, value);
}