本文整理汇总了C++中Oiiotool::push方法的典型用法代码示例。如果您正苦于以下问题:C++ Oiiotool::push方法的具体用法?C++ Oiiotool::push怎么用?C++ Oiiotool::push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oiiotool
的用法示例。
在下文中一共展示了Oiiotool::push方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
static int
action_colorconvert (int argc, const char *argv[])
{
ASSERT (argc == 3);
if (ot.postpone_callback (1, action_colorconvert, argc, argv))
return 0;
std::string fromspace = argv[1];
std::string tospace = argv[2];
ot.read ();
bool need_transform = false;
ImageRecRef A = ot.curimg;
ot.read (A);
for (int s = 0, send = A->subimages(); s < send; ++s) {
for (int m = 0, mend = A->miplevels(s); m < mend; ++m) {
const ImageSpec *spec = A->spec(s,m);
need_transform |=
spec->get_string_attribute("oiio:ColorSpace") != tospace;
}
}
if (! need_transform)
return 1; // no need to do anything
ot.pop ();
ot.push (new ImageRec (*A, ot.allsubimages ? -1 : 0,
ot.allsubimages ? -1 : 0, true, false));
if (fromspace == "current")
fromspace = A->spec(0,0)->get_string_attribute ("oiio:Colorspace", "Linear");
ColorProcessor *processor =
ot.colorconfig.createColorProcessor (fromspace.c_str(), tospace.c_str());
if (! processor)
return 1;
for (int s = 0, send = A->subimages(); s < send; ++s) {
for (int m = 0, mend = A->miplevels(s); m < mend; ++m) {
ImageBufAlgo::colorconvert ((*ot.curimg)(s,m), (*A)(s,m), processor, false);
ot.curimg->spec(s,m)->attribute ("oiio::Colorspace", tospace);
}
}
ot.colorconfig.deleteColorProcessor (processor);
return 1;
}
示例2: ImageRec
static int
action_select_subimage (int argc, const char *argv[])
{
if (ot.postpone_callback (1, action_select_subimage, argc, argv))
return 0;
ot.read ();
if (ot.curimg->subimages() == 1)
return 0; // --subimage on a single-image file is a no-op
int subimage = std::min (atoi(argv[1]), ot.curimg->subimages());
ImageRecRef A = ot.pop();
ot.push (new ImageRec (*A, subimage));
return 0;
}
示例3: B
static int
action_sub (int argc, const char *argv[])
{
if (ot.postpone_callback (2, action_sub, argc, argv))
return 0;
ImageRecRef B (ot.pop());
ImageRecRef A (ot.pop());
ot.read (A);
ot.read (B);
ot.push (new ImageRec (*A, ot.allsubimages ? -1 : 0,
ot.allsubimages ? -1 : 0, true, false));
int subimages = ot.curimg->subimages();
for (int s = 0; s < subimages; ++s) {
int miplevels = ot.curimg->miplevels(s);
for (int m = 0; m < miplevels; ++m) {
const ImageBuf &Aib ((*A)(s,m));
const ImageBuf &Bib ((*B)(s,m));
if (! same_size (Aib, Bib)) {
// FIXME: some day, there should be options of combining
// differing images somehow.
std::cerr << "oiiotool: " << argv[0] << " could not combine images of differing sizes\n";
continue;
}
ImageBuf &Rib ((*ot.curimg)(s,m));
ImageBuf::ConstIterator<float> a (Aib);
ImageBuf::ConstIterator<float> b (Bib);
ImageBuf::Iterator<float> r (Rib);
int nchans = Rib.nchannels();
for ( ; ! r.done(); ++r) {
a.pos (r.x(), r.y());
b.pos (r.x(), r.y());
for (int c = 0; c < nchans; ++c)
r[c] = a[c] - b[c];
}
}
}
return 0;
}