Alien-FreeImage
view release on metacpan or search on metacpan
src/Source/OpenEXR/IlmImf/ImfMultiView.cpp view on Meta::CPAN
return r;
}
int
viewNum (const string &view, const StringVector &multiView)
{
//
// returns which view number is called 'view'
// returns -1 if no member of multiView is 'view'
// (i.e. if viewNum() returns -1, 'view' isn't a view name
// if viewNum() returns 0, 'view' is the default view
// otherwise, it's some other (valid) view
//
for (size_t i = 0; i < multiView.size(); ++i)
{
if (multiView[i] == view)
return i;
}
return -1;
}
} // namespace
string
defaultViewName (const StringVector &multiView)
{
if (multiView.size() > 0)
return multiView[0];
else
return "";
}
string
viewFromChannelName (const string &channel,
const StringVector &multiView)
{
//
// Given the name of a channel, return the name of the view to
// which it belongs.
//
//
// View name is penultimate section of name separated by periods ('.'s)
//
StringVector s = parseString (channel, '.');
if (s.size() == 0)
return ""; // nothing in, nothing out
if (s.size() == 1)
{
//
// Return default view name.
// The rules say ALL channels with no periods
// in the name belong to the default view.
//
return multiView[0];
}
else
{
//
// size >= 2 - the last part is the channel name,
// the next-to-last part is the view name.
// Check if that part of the name really is
// a valid view and, if it is, return it.
//
const string &viewName = s[s.size() - 2];
if (viewNum (viewName, multiView) >= 0)
return viewName;
else
return ""; // not associated with any particular view
}
}
ChannelList
channelsInView (const string & viewName,
const ChannelList & channelList,
const StringVector & multiView)
{
//
// Return a list of all channels belonging to view viewName.
//
ChannelList q;
for (ChannelList::ConstIterator i = channelList.begin();
i != channelList.end();
++i)
{
//
// Get view name for this channel
//
string view = viewFromChannelName (i.name(), multiView);
//
// Insert channel into q if it's a member of view viewName
//
if (view == viewName)
q.insert (i.name(), i.channel());
}
return q;
}
ChannelList
channelsInNoView (const ChannelList &channelList,
( run in 0.301 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )