DD::Image::IopInfo Class Reference

Inherits DD::Image::Box, and DD::Image::GeneralInfo.

List of all members.

Public Types

enum  AccessPreference { eAccessPreferNone, eAccessPreferLinear }

Public Member Functions

FormatPair formats () const
void setFormats (const FormatPair &formats)
ChannelSetchannels ()
ChannelMask channels () const
void channels (ChannelSetInit v)
void channels (ChannelMask v)
void channels (Channel v)
const Formatformat () const
void format (const Format &v)
const Formatfull_size_format () const
void full_size_format (const Format &v)
void setAccessPreference (AccessPreference ap)
const AccessPreference & accessPreference () const
int ydirection () const
void ydirection (int v)
bool black_outside () const
void black_outside (bool v)
void turn_on (ChannelSetInit m)
void turn_on (ChannelMask m)
void turn_on (Channel c)
void turn_off (ChannelSetInit m)
void turn_off (ChannelMask m)
void turn_off (Channel c)
bool is_constant () const
void clipmove (int dx, int dy, int dr, int dt)
void operator= (const DeepInfo &deepInfo)
 copy over the subset of DeepInfo and IopInfo onto this


Detailed Description

This structure contains information that Iop::_validate() must calculate. Because this information is often copied unchanged or with tiny variations from the input operator, it is put into this structure so that it can be copied with a single assignment.

This is a subclass of Box and that provides x,y,r,t values that describe the bounding box around all the interesting pixels. It also provides a merge and intersect operators that are useful when _validate is combining the info from two inputs.


Member Function Documentation

ChannelMask DD::Image::IopInfo::channels (  )  const [inline]

Which channels exist in the output of this Iop.

const Format & DD::Image::IopInfo::format (  )  const [inline]

The image size/format. Operators that care (such as file writers) should use this as the size of the image. It can also be used as a boundary for an operator that draws data that logically should extend to infinity.

The format also has a name and pixel aspect ratio that may be useful. Note that Nuke will have already taken the pixel aspect ratio into account when storing WH_knob or other dimensional knobs.

This is also set by the constructor and can be referred to to initialize knob values. For instance if you want an x value to default to half way across the image, set it to (format().x()+format.r())/2. This format is a guess and it may be different when the user hooks up the node or finally stores values in the knobs.

Referenced by DD::Image::Write::_validate(), DD::Image::RenderScene::_validate(), DD::Image::Render::_validate(), DD::Image::Read::_validate(), DD::Image::Black::Black(), DD::Image::Render::get_format_matrix(), DD::Image::Iop::Iop(), DD::Image::RenderScene::projection_matrix(), DD::Image::Reader::Reader(), and DD::Image::Iop::request().

void DD::Image::IopInfo::format ( const Format f  )  [inline]

Sets info_.format() to the given format. Some operators expect this to tell them how to size their output. Most operators will overwrite this in their _validate() method.

const Format & DD::Image::IopInfo::full_size_format (  )  const [inline]

If the output of this operator is a proxy for a full size image, this is the full size. Nuke assumes all coordinates are given in the full size and scales them to the format() when storing them into the knob locations. Because Nuke does the scaling most operators can ignore this, it is occasionally useful for undoing the scaling to get the user's original numbers.

If this is not a proxy then this should point at the same location as format().

Referenced by DD::Image::Read::_validate(), DD::Image::Black::Black(), DD::Image::Iop::Iop(), and DD::Image::Reader::Reader().

void DD::Image::IopInfo::full_size_format ( const Format f  )  [inline]

Sets info_.full_size_format() to the given format. Some operators expect this to tell them how to size their output. Most operators will overwrite this in their _validate() method.

AccessPreference & DD::Image::IopInfo::accessPreference (  )  const [inline]

Indicates a preferred access pattern to ask for the lines in. Some operators operate full frame and prefer to be asked for lines from the very top of the request area rather than in the middle.

Operators can call IopInfo::setAccessPreference to set their access preference. eAccessPreferLinear will cause the viewer to ask for lines always from the top or bottom of the request area first, ignoring any user mouse click.

The default is eAccessPreferNone, indicating this operator has no access preference.

Referenced by DD::Image::Iop::merge_info().

int DD::Image::IopInfo::ydirection (  )  const [inline]

Indicates a preferred direction to ask for the lines in. Some operators (ie file readers) can produce the lines in one direction much faster, usually because reading line N requires reading all lines from 0..N-1 first. Thus if you go by increasing N the first line is returned immediately, but if you go backwards there is a long delay before the first line is produced. Notice that positive means "up" as line 0 is at the bottom.

Larger numbers indicate how "bad" it is. For sgi files it uses +/- 1 because reading in the wrong direction just means it will do seek() between each line. For jpeg it is -100 because it has to decode all lines above line N.

If your operator flips the picture upsidedown it should negate the y direction, otherwise leave it unchanged. If it reads from several inputs it should add all the ydirections together.

Referenced by DD::Image::Transform::_validate(), DD::Image::Read::_validate(), DD::Image::Iop::copy_info(), DD::Image::Iop::merge_info(), and DD::Image::Reader::Reader().

bool DD::Image::IopInfo::black_outside (  )  const [inline]

True indicates that a 1-pixel border all around the edge of the bounding box is zero in all channels. Operators are expected to set this correctly to match their output.

Many operators can take advantage of this to avoid adding their own black edge and thus avoid increasing the bounding box size.

Referenced by DD::Image::Transform::_validate(), DD::Image::RenderScene::_validate(), DD::Image::Read::_validate(), DD::Image::DrawIop::_validate(), DD::Image::Black::Black(), DD::Image::Iop::copy_info(), DD::Image::Transform::degenerate(), DD::Image::Iop::merge_info(), DD::Image::Reader::Reader(), and DD::Image::Reader::set_info().

void DD::Image::IopInfo::turn_on ( ChannelMask  m  )  [inline]

Same as channels(turn_on(channels(), m)).

void DD::Image::IopInfo::turn_on ( Channel  c  )  [inline]

Same as channels(turn_on(channels(), c)).

void DD::Image::IopInfo::turn_off ( ChannelMask  m  )  [inline]

Same as channels(turn_off(channels(), m)).

void DD::Image::IopInfo::turn_off ( Channel  c  )  [inline]

Same as channels(turn_off(channels(), c)).

void DD::Image::IopInfo::clipmove ( int  dx,
int  dy,
int  dr,
int  dt 
)

Expand the bounding box by dx,dy,dr,dt but do not expand it outside the box determined by 0,0,format().width(),format().height() if it is at or inside this. This is used by filter operations, and stops them from expanding their data outside the current format. This clipping is usually what is expected and avoids keeping unnecessary data in the cache buffers, and avoids random-sized caches which fragment memory.

If bounding box is 1 pixel wide in either direction it leaves it unchanged, since this indicates a constant value.



©2009 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk