Deep Compositing Extended

OpenDCX 2.2.2 documentation


void splitName(const char *name, std::string &layer, std::string &chan)

Split the name into separate layer & chan strings, if possible, returning true if successful. This splits at the last period (‘.’) in the string. If the name contains more than one period then those become part of the layer string.

bool matchStandardChannel(const char *channel_name, std::string &std_layer_name, std::string &std_chan_name, ChannelIdx &std_channel, std::string &std_io_name, OPENEXR_IMF_NAMESPACE::PixelType &std_io_type)

Returns the best matching standard ChannelIdx and layer name for the channel name (with no layer prefix,) or false if no match. If there’s a match it also sets the channel’s default name and PixelType for file I/O.

int getLayerPositionFromKind(ChannelIdx kind)

If the kind of channel is one of the predefined ones, return the common position that channel occupies in a layer. i.e:

if kind==Chan_R -> rgba position 0
if kind==Chan_A -> rgba position 3
class ChannelContext

Context structure for storing the global ChannelIdx assignment slots and maps for quick access to/from ChannelAliases and ChannelIdxs.

A ChannelAlias contains layer and channel strings which map to unique ChannelIdx indice.

ChannelContext(bool addStandardChans = true)

Default ctor adds the predefined standard ChannelAliases to the context. Pass in false if a subclass of ChannelContext wants to define a custom ChannelAlias type and manage the predefined set itself.

ChannelSet ChannelContext::getChannels()

Get the ChannelSet for all channels in the context.

ChannelSet ChannelContext::getChannelSetFromAliases(const ChannelAliasPtrList&)

Get the ChannelSet from a ChannelAliasList or ChannelAliasSet.

ChannelIdx ChannelContext::lastAssignedChannel() const

Returns the last assigned ChannelIdx.

This value can be used to size channel arrays as it represents the current maximum channel count for this context. Note that this value does not represent active channels, only channel definitions assigned to ChannelIdx slots, whereas a ChannelSet is used to define the set of active channels.

If no arbitrary channels have been added to this context the value will be Chan_ArbitraryStart-1.

ChannelIdx ChannelContext::getChannel(const char *name)

Get and/or create a channel, returning a ChannelIdx or ChannelAlias. Returns Chan_Invalid or NULL if there was an error creating it.

Note that multiple channel names can map to the same ChannelIdx but each name will have a unique ChannelAlias. ex. ‘R’, ‘rgba.R’, ‘’ will all be mapped to Chan_R with each getting a unique ChannelAlias.

Unrecognized channel names like ‘’ and ‘mylayer.F’ will each be assigned unique ChannelIdxs unless the duplicate ChannelAliases were added using addChannelAlias() with the same ChannelIdx from the first created alias.

const char *ChannelContext::getChannelName(ChannelIdx channel) const

Get channel or name from a ChannelIdx. Returns ‘unknown’ if the ChannelIdx doesn’t exist (is out of range.)

ChannelAlias *ChannelContext::findChannelAlias(const char *name) const

Find channel by name or ChannelIdx and return a ChannelAlias pointer, or NULL if not found.

void addStandardChannels()

Add the predefined standard channels to the context.

ChannelAlias *ChannelContext::addChannelAlias(ChannelAlias *alias)

Add a new ChannelAlias to the context, either by passing in a pre-allocated ChannelAlias or having the context construct it. In both cases the ChannelContext takes ownership of the pointer and deletes the pointers in the destructor.

If the assigned channel is Chan_Invalid then no specfic channel slot is being requested so the next available ChannelIdx is assigned, incrementing lastAssignedChannel().

  • chan_name user-facing name, not including the layer (‘R’, ‘G’, ‘red’,
    ‘green’, ‘alpha’, ‘Z’, ‘ZBack’, etc)
  • layer_name user-facing layer name (‘rgba’, ‘beauty’, ‘beauty.diffuse’)
  • channel absolute ChannelIdx - if Chan_Invalid a new ChannelIdx is assigned
  • position sorted position index within layer (i.e. 0,1,2)
  • io_name name to use for exr file I/O (‘R’ or ‘AR’ vs. ‘’ or
  • io_type PixelType to use for file I/O
const ChannelAliasPtrList &ChannelContext::channelAliasList() const

Read-only access to the shared lists & maps.

void ChannelContext::printChannelName(std::ostream&, const ChannelIdx&) const

Print channel or ‘<layer>.<channel>’ name to an output stream.