本文整理汇总了C++中rcpp::CharacterVector::at方法的典型用法代码示例。如果您正苦于以下问题:C++ CharacterVector::at方法的具体用法?C++ CharacterVector::at怎么用?C++ CharacterVector::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rcpp::CharacterVector
的用法示例。
在下文中一共展示了CharacterVector::at方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: magick_image_write
// [[Rcpp::export]]
Rcpp::RawVector magick_image_write( XPtrImage input, Rcpp::CharacterVector format, Rcpp::IntegerVector quality,
Rcpp::IntegerVector depth, Rcpp::CharacterVector density, Rcpp::CharacterVector comment){
if(!input->size())
return Rcpp::RawVector(0);
XPtrImage image = copy(input);
#if MagickLibVersion >= 0x691
//suppress write warnings see #74 and #116
image->front().quiet(true);
#endif
if(format.size())
for_each ( image->begin(), image->end(), Magick::magickImage(std::string(format[0])));
if(quality.size())
for_each ( image->begin(), image->end(), Magick::qualityImage(quality[0]));
if(depth.size())
for_each ( image->begin(), image->end(), Magick::depthImage(depth[0]));
if(density.size()){
for_each ( image->begin(), image->end(), Magick::resolutionUnitsImage(Magick::PixelsPerInchResolution));
for_each ( image->begin(), image->end(), Magick::densityImage(Point(density[0])));
}
if(comment.size())
for_each ( image->begin(), image->end(), Magick::commentImage(std::string(comment.at(0))));
Magick::Blob output;
writeImages( image->begin(), image->end(), &output );
Rcpp::RawVector res(output.length());
std::memcpy(res.begin(), output.data(), output.length());
return res;
}
示例2: magick_image_readbin
// [[Rcpp::export]]
XPtrImage magick_image_readbin(Rcpp::RawVector x, Rcpp::CharacterVector density, Rcpp::IntegerVector depth, bool strip = false){
XPtrImage image = create();
#if MagickLibVersion >= 0x689
Magick::ReadOptions opts = Magick::ReadOptions();
#if MagickLibVersion >= 0x690
opts.quiet(1);
#endif
if(density.size())
opts.density(std::string(density.at(0)).c_str());
if(depth.size())
opts.depth(depth.at(0));
Magick::readImages(image.get(), Magick::Blob(x.begin(), x.length()), opts);
#else
Magick::readImages(image.get(), Magick::Blob(x.begin(), x.length()));
#endif
if(strip)
for_each (image->begin(), image->end(), Magick::stripImage());
return image;
}
示例3: magick_image_readpath
// [[Rcpp::export]]
XPtrImage magick_image_readpath(Rcpp::CharacterVector paths, Rcpp::CharacterVector density, Rcpp::IntegerVector depth, bool strip = false){
XPtrImage image = create();
#if MagickLibVersion >= 0x689
Magick::ReadOptions opts = Magick::ReadOptions();
#if MagickLibVersion >= 0x690
opts.quiet(1);
#endif
if(density.size())
opts.density(std::string(density.at(0)).c_str());
if(depth.size())
opts.depth(depth.at(0));
for(int i = 0; i < paths.size(); i++)
Magick::readImages(image.get(), std::string(paths[i]), opts);
#else
for(int i = 0; i < paths.size(); i++)
Magick::readImages(image.get(), std::string(paths[i]));
#endif
if(strip)
for_each (image->begin(), image->end(), Magick::stripImage());
return image;
}