本文整理汇总了C++中ImageBuf::copy_pixels方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageBuf::copy_pixels方法的具体用法?C++ ImageBuf::copy_pixels怎么用?C++ ImageBuf::copy_pixels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageBuf
的用法示例。
在下文中一共展示了ImageBuf::copy_pixels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImageBuf
ImageRec::ImageRec (ImageRec &img, int subimage_to_copy,
int miplevel_to_copy, bool writable, bool copy_pixels)
: m_name(img.name()), m_elaborated(true),
m_metadata_modified(false), m_pixels_modified(false),
m_was_output(false),
m_imagecache(img.m_imagecache)
{
img.read ();
int first_subimage = std::max (0, subimage_to_copy);
int subimages = (subimage_to_copy < 0) ? img.subimages() : 1;
m_subimages.resize (subimages);
for (int s = 0; s < subimages; ++s) {
int srcsub = s + first_subimage;
int first_miplevel = std::max (0, miplevel_to_copy);
int miplevels = (miplevel_to_copy < 0) ? img.miplevels(srcsub) : 1;
m_subimages[s].m_miplevels.resize (miplevels);
m_subimages[s].m_specs.resize (miplevels);
for (int m = 0; m < miplevels; ++m) {
int srcmip = m + first_miplevel;
const ImageBuf &srcib (img(srcsub,srcmip));
const ImageSpec &srcspec (*img.spec(srcsub,srcmip));
ImageBuf *ib = NULL;
if (writable || img.pixels_modified() || !copy_pixels) {
// Make our own copy of the pixels
ib = new ImageBuf (srcspec);
if (copy_pixels)
ib->copy_pixels (srcib);
} else {
// The other image is not modified, and we don't need to be
// writable, either.
ib = new ImageBuf (img.name(), srcib.imagecache());
bool ok = ib->read (srcsub, srcmip, false /*force*/,
img.m_input_dataformat /*convert*/);
ASSERT (ok);
}
m_subimages[s].m_miplevels[m].reset (ib);
m_subimages[s].m_specs[m] = srcspec;
}
}
}