本文整理汇总了C++中imagebuf::Iterator::exists方法的典型用法代码示例。如果您正苦于以下问题:C++ Iterator::exists方法的具体用法?C++ Iterator::exists怎么用?C++ Iterator::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类imagebuf::Iterator
的用法示例。
在下文中一共展示了Iterator::exists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: s
static bool
paste_ (ImageBuf &dst, ROI dstroi,
const ImageBuf &src, ROI srcroi, int nthreads)
{
// N.B. Punt on parallelizing because of the subtle interplay
// between srcroi and dstroi, the parallel_image idiom doesn't
// handle that especially well. And it's not worth customizing for
// this function which is inexpensive and not commonly used, and so
// would benefit little from parallelizing. We can always revisit
// this later. But in the mean time, we maintain the 'nthreads'
// parameter for uniformity with the rest of IBA.
int src_nchans = src.nchannels ();
int dst_nchans = dst.nchannels ();
ImageBuf::ConstIterator<S,D> s (src, srcroi);
ImageBuf::Iterator<D,D> d (dst, dstroi);
for ( ; ! s.done(); ++s, ++d) {
if (! d.exists())
continue; // Skip paste-into pixels that don't overlap dst's data
for (int c = srcroi.chbegin, c_dst = dstroi.chbegin;
c < srcroi.chend; ++c, ++c_dst) {
if (c_dst >= 0 && c_dst < dst_nchans)
d[c_dst] = c < src_nchans ? s[c] : D(0);
}
}
return true;
}
示例2: s
static bool
transpose_ (ImageBuf &dst, const ImageBuf &src,
ROI roi, int nthreads)
{
if (nthreads != 1 && roi.npixels() >= 1000) {
// Possible multiple thread case -- recurse via parallel_image
ImageBufAlgo::parallel_image (
boost::bind(transpose_<DSTTYPE,SRCTYPE>,
boost::ref(dst), boost::cref(src),
_1 /*roi*/, 1 /*nthreads*/),
roi, nthreads);
return true;
}
// Serial case
ImageBuf::ConstIterator<SRCTYPE,DSTTYPE> s (src, roi);
ImageBuf::Iterator<DSTTYPE,DSTTYPE> d (dst);
for ( ; ! s.done(); ++s) {
d.pos (s.y(), s.x(), s.z());
if (! d.exists())
continue;
for (int c = roi.chbegin; c < roi.chend; ++c)
d[c] = s[c];
}
return true;
}
示例3: pixel
static inline void
setpixel_ (ImageBuf &buf, int x, int y, int z, const float *data, int chans)
{
ImageBuf::Iterator<T> pixel (buf, x, y, z);
if (pixel.exists()) {
for (int i = 0; i < chans; ++i)
pixel[i] = data[i];
}
}
示例4: s
static bool
transpose_ (ImageBuf &dst, const ImageBuf &src,
ROI roi, int nthreads)
{
ImageBufAlgo::parallel_image (roi, nthreads, [&](ROI roi){
ImageBuf::ConstIterator<SRCTYPE,DSTTYPE> s (src, roi);
ImageBuf::Iterator<DSTTYPE,DSTTYPE> d (dst);
for ( ; ! s.done(); ++s) {
d.pos (s.y(), s.x(), s.z());
if (! d.exists())
continue;
for (int c = roi.chbegin; c < roi.chend; ++c)
d[c] = s[c];
}
});
return true;
}