Nuke binary plugins 15.0.5
 
Loading...
Searching...
No Matches
DD::Image::Box Class Reference

Describes a rectangle with integer boundaries. More...

#include <Box.h>

Inheritance diagram for DD::Image::Box:
DD::Image::Format DD::Image::Info2D DD::Image::Interest DD::Image::DeepInfo DD::Image::IopInfo DD::Image::RowCacheTile

Public Types

typedef iterator const_iterator
 

Public Member Functions

iterator begin () const
 
iterator end () const
 
 Box (int x, int y, int r, int t)
 
 Box (const Box &b)
 
int x () const
 
void x (int v)
 
int y () const
 
void y (int v)
 
int r () const
 
void r (int v)
 
int t () const
 
void t (int v)
 
int w () const
 
void w (int v)
 
int h () const
 
void h (int v)
 
float center_x () const
 
float center_y () const
 
void set (int x, int y, int r, int t)
 
void set (const Box &b)
 
bool is_constant () const
 
void clear ()
 
void move (int dx, int dy)
 
void pad (int dx, int dy, int dr, int dt)
 
void pad (int dx, int dy)
 
void pad (int d)
 
int clampx (int x) const
 
int clampy (int y) const
 
void merge (const Box &)
 
void merge (int x, int y)
 
void merge (int x, int y, int r, int t)
 
void expand (int amount)
 
void expand (int widthAmount, int heightAmount)
 
void scale (float scaleAmount)
 
void intersect (const Box &)
 
void intersect (int x, int y, int r, int t)
 
bool intersects (const Box &other) const
 
bool intersects (int x, int y, int r, int t) const
 
bool contains (const Box &other) const
 
int64_t area () const
 

Detailed Description

Describes a rectangle with integer boundaries.

This class is used as a base for everything in DD::Image that describes a rectangle of pixels. It contains 4 integers storing the left, bottom, right, and top edges of the box.

Boxes must have a size of at least 1 in both dimensions. This is so they always contain at least one pixel. This pixel is used to provide a value when locations are indexed outside the box. If you set a box to a size less than one then the result is unpredictable.

In DD::Image integer coordinates are considered to be at the corners of the pixels, not in their centers. When addressing a pixel by integers the pixel to the upper-right of the integer coordinate is chosen. This is why the right and top edge appear to indicate a pixel outside the box. In fact all 4 edges are treated the same and they represent the positions around the outside edge of the pixels.

Member Function Documentation

◆ x() [1/2]

int DD::Image::Box::x ( ) const
inline

Location of left edge

Referenced by DD::Image::Iop::_copyState(), DD::Image::IllumShader::_request(), DD::Image::NukeWrapper::_request(), DD::Image::Render::_request(), DD::Image::RenderScene::_request(), DD::Image::Read::_validate(), DD::Image::Transform::_validate(), DD::Image::UpRez::_validate(), DD::Image::DrawIop::_validate(), DD::Image::Format::append(), DD::Image::Interest::at(), DD::Image::RowCacheTile::at(), DD::Image::Black::Black(), contains(), DD::Image::ImagePlane::copyIntersectionFrom(), DD::Image::DeepPlane::covers(), DD::Image::DeepOp::deepEngine(), DD::Image::Iop::doFetchPlane(), DD::Image::Transform::draw_handle(), DD::Image::Read::engine(), DD::Image::Iop::fetchPlane(), DD::Image::CameraOp::fromFormat(), DD::Image::Iop::get(), DD::Image::DeepInPlaceOutputPlane::getPixel(), DD::Image::ImagePlane::getRow(), DD::Image::ViewerContext::getScreenBoundingBox(), DD::Image::PlanarIop::getStripeBox(), DD::Image::gl_drawTextTopLeftOrthogonal(), DD::Image::GLProject(), DD::Image::Interest::Interest(), intersect(), intersects(), DD::Image::ImagePlaneDescriptor::intersects(), merge(), DD::Image::Transform::motionBlurSample(), DD::Image::operator!=(), DD::Image::operator<<(), DD::Image::operator==(), DD::Image::DrawIop::pixel_engine(), DD::Image::ViewerCache::read_from_cache(), DD::Image::Iop::request(), DD::Image::Scene::request(), DD::Image::Transform::sample(), slr::SlrShadingContext::sample(), DD::Image::VertexContext::sample(), scale(), DD::Image::ProxyContext::setProxyscale(), DD::Image::DeepInPlaceOutputPlane::setSampleCount(), DD::Image::ToBuffer::to_buffer(), DD::Image::ProxyContext::to_proxy(), DD::Image::ProxyContext::to_proxy_rel(), DD::Image::CameraOp::toFormat(), DD::Image::Transform::updateConcat(), DD::Image::Scene::validate(), DD::Image::ViewerContext::viewAreaFromScreenToRender(), and DD::Image::ViewFrustum::ViewFrustum().

◆ x() [2/2]

void DD::Image::Box::x ( int  v)
inline

Set left edge

◆ y() [1/2]

int DD::Image::Box::y ( ) const
inline

Location of bottom edge

Referenced by DD::Image::Iop::_copyState(), DD::Image::IllumShader::_request(), DD::Image::NukeWrapper::_request(), DD::Image::Render::_request(), DD::Image::RenderScene::_request(), DD::Image::Read::_validate(), DD::Image::Transform::_validate(), DD::Image::UpRez::_validate(), DD::Image::DrawIop::_validate(), DD::Image::Format::append(), DD::Image::Interest::at(), DD::Image::RowCacheTile::at(), DD::Image::Black::Black(), contains(), DD::Image::ImagePlane::copyIntersectionFrom(), DD::Image::DeepPlane::covers(), DD::Image::DeepOp::deepEngine(), DD::Image::Iop::doFetchPlane(), DD::Image::PlanarIop::doFetchPlane(), DD::Image::Interest::done(), DD::Image::Transform::draw_handle(), DD::Image::PlanarIop::expandToFullTiles(), DD::Image::Iop::fetchPlane(), DD::Image::CameraOp::fromFormat(), DD::Image::Iop::get(), DD::Image::DeepInPlaceOutputPlane::getPixel(), DD::Image::ImagePlane::getRow(), DD::Image::ViewerContext::getScreenBoundingBox(), DD::Image::GLProject(), DD::Image::Interest::Interest(), intersect(), intersects(), DD::Image::ImagePlaneDescriptor::intersects(), DD::Image::Interest::is_zero(), DD::Image::GeneralTile::load_range(), merge(), DD::Image::Transform::motionBlurSample(), DD::Image::operator!=(), DD::Image::operator<<(), DD::Image::operator==(), DD::Image::DrawIop::pixel_engine(), DD::Image::ViewerCache::read_from_cache(), DD::Image::Iop::request(), DD::Image::Scene::request(), DD::Image::Transform::sample(), DD::Image::VertexContext::sample(), scale(), DD::Image::ProxyContext::setProxyscale(), DD::Image::DeepInPlaceOutputPlane::setSampleCount(), DD::Image::ToBuffer::to_buffer(), DD::Image::ProxyContext::to_proxy(), DD::Image::ProxyContext::to_proxy_rel(), DD::Image::CameraOp::toFormat(), DD::Image::Transform::updateConcat(), DD::Image::Scene::validate(), DD::Image::ViewerContext::viewAreaFromScreenToRender(), and DD::Image::ViewFrustum::ViewFrustum().

◆ y() [2/2]

void DD::Image::Box::y ( int  v)
inline

Set bottom edge

◆ r() [1/2]

◆ r() [2/2]

void DD::Image::Box::r ( int  v)
inline

Set right edge

◆ t() [1/2]

int DD::Image::Box::t ( ) const
inline

Location of top edge

Referenced by DD::Image::Iop::_copyState(), DD::Image::IllumShader::_request(), DD::Image::NukeWrapper::_request(), DD::Image::RenderScene::_request(), DD::Image::Read::_validate(), DD::Image::UpRez::_validate(), DD::Image::DrawIop::_validate(), DD::Image::Format::append(), contains(), DD::Image::ImagePlane::copyIntersectionFrom(), DD::Image::DeepPlane::covers(), DD::Image::DeepOp::deepEngine(), DD::Image::Iop::doFetchPlane(), DD::Image::PlanarIop::doFetchPlane(), DD::Image::Transform::draw_handle(), DD::Image::PlanarIop::expandToFullTiles(), DD::Image::Iop::fetchPlane(), DD::Image::CameraOp::fromFormat(), DD::Image::Iop::get(), DD::Image::DeepInPlaceOutputPlane::getPixel(), DD::Image::ImagePlane::getRow(), DD::Image::ViewerContext::getScreenBoundingBox(), DD::Image::gl_drawTextTopLeftOrthogonal(), DD::Image::Interest::Interest(), intersect(), intersects(), DD::Image::ImagePlaneDescriptor::intersects(), DD::Image::GeneralTile::load_range(), merge(), DD::Image::Transform::motionBlurSample(), DD::Image::operator!=(), DD::Image::operator<<(), DD::Image::operator==(), DD::Image::DrawIop::pixel_engine(), DD::Image::ViewerCache::read_from_cache(), DD::Image::Iop::request(), DD::Image::Scene::request(), DD::Image::Transform::sample(), scale(), DD::Image::ProxyContext::setProxyscale(), DD::Image::DeepInPlaceOutputPlane::setSampleCount(), DD::Image::ProxyContext::to_proxy(), DD::Image::ProxyContext::to_proxy_rel(), DD::Image::CameraOp::toFormat(), DD::Image::Transform::updateConcat(), DD::Image::ViewerContext::viewAreaFromScreenToRender(), and DD::Image::ViewFrustum::ViewFrustum().

◆ t() [2/2]

void DD::Image::Box::t ( int  v)
inline

Set top edge

◆ w() [1/2]

◆ w() [2/2]

void DD::Image::Box::w ( int  v)
inline

Set width by moving right edge

◆ h() [1/2]

◆ h() [2/2]

void DD::Image::Box::h ( int  v)
inline

Set height by moving top edge

◆ center_x()

float DD::Image::Box::center_x ( ) const
inline

center in x

◆ center_y()

float DD::Image::Box::center_y ( ) const
inline

center in y

◆ set() [1/2]

◆ set() [2/2]

void DD::Image::Box::set ( const Box b)
inline

Set all four sides at once.

◆ is_constant()

bool DD::Image::Box::is_constant ( ) const
inline

True if box is 1x1 in both directions.

◆ clear()

◆ move()

void DD::Image::Box::move ( int  dx,
int  dy 
)
inline

Move all the sides and thus the entire box by the given deltas

Referenced by DD::Image::Transform::_validate().

◆ pad() [1/3]

void DD::Image::Box::pad ( int  dx,
int  dy,
int  dr,
int  dt 
)
inline

Move x(), y(), r(), t() by the given deltas, except if a dimension is 1 it does not move those edges, because the color is constant in that direction. This is used to pad out an input image with the spill that a filter will create. Notice that dx and dy are negative to make the box bigger.

Referenced by DD::Image::Render::_validate(), and DD::Image::Transform::_validate().

◆ pad() [2/3]

void DD::Image::Box::pad ( int  dx,
int  dy 
)
inline

Same as pad(-dx,-dy,dx,dy), add the same amount on all sides.

References pad().

Referenced by pad().

◆ pad() [3/3]

void DD::Image::Box::pad ( int  d)
inline

Same as pad(-d,-d,d,d), add the same amount on all sides.

References pad().

Referenced by pad().

◆ clampx()

int DD::Image::Box::clampx ( int  x) const
inline

◆ clampy()

int DD::Image::Box::clampy ( int  y) const
inline

◆ merge() [1/3]

void DD::Image::Box::merge ( const Box v)

Change this box to be the union of itself and the passed box.

This is for bounding boxes where it is assumed the edge pixels extend out to infinity. 1-wide or 1-tall boxes cause the other's dimensions to be used unchanged because these indicate an infinite area of constant color and thus their position is irrelevant. If both boxes are 1 wide or 1 tall then the passed box's position is used.

The output is never an "empty" box which is now illegal for bounding boxes. If both boxes are <= 0 wide or tall then the passed box's postition is used and the right/top edge are set to x/y plus one.

References merge().

Referenced by DD::Image::NukeWrapper::_validate(), DD::Image::Render::_validate(), DD::Image::RenderScene::_validate(), DD::Image::Transform::_validate(), DD::Image::DrawIop::_validate(), DD::Image::DeepPlane::covers(), DD::Image::DeepOp::deepRequest(), DD::Image::PlanarI::getOutputBox(), merge(), DD::Image::Iop::merge_info(), and DD::Image::Scene::validate().

◆ merge() [2/3]

void DD::Image::Box::merge ( int  x,
int  y 
)

Similar to merge(x,y,x+1,y+1) but it always expands the box, even if it describes a constant. This allows you to build a box out of a bunch of pixels that you plan to index.

References x(), and y().

◆ merge() [3/3]

void DD::Image::Box::merge ( int  x,
int  y,
int  r,
int  t 
)

Same as merge(Box(x,y,r,t))

References MAX(), MIN(), r(), t(), x(), and y().

◆ expand() [1/2]

void DD::Image::Box::expand ( int  amount)

Expand the bbox by the given amount in all directions around the centre. Negative values will shrink the bbox.

◆ expand() [2/2]

void DD::Image::Box::expand ( int  widthAmount,
int  heightAmount 
)

Expand the bbox by the given amount for both dimensions around the centre. Negative values will shrink the bbox.

◆ scale()

void DD::Image::Box::scale ( float  scaleAmount)

Scale the bbox by the ratio for both dimensions around the centre. 1.0 is the current size.

References r(), t(), x(), and y().

◆ intersect() [1/2]

void DD::Image::Box::intersect ( const Box v)

Change this box to be the intersection of itself and the passed box.

DD::Image replicates pixels from the nearest edge of the bounding box when selecting coordinates outside it. This affects how boxes intersect, because a box with zero dimensions is not allowed. If the boxes don't intersect the result will still have 1 pixel in it. The resulting location of this box could be anywhere, but this function places it inside the edge of the passed box v.

References intersect().

Referenced by DD::Image::NukeWrapper::_validate(), DD::Image::Render::_validate(), DD::Image::Write::_validate(), DD::Image::DrawIop::_validate(), DD::Image::Interest::Interest(), intersect(), DD::Image::GeneralTile::load_range(), and DD::Image::BufferIopTile::makeTile().

◆ intersect() [2/2]

void DD::Image::Box::intersect ( int  x,
int  y,
int  r,
int  t 
)

Same as intersect(Box(x,y,r,t))

References r(), t(), x(), and y().

◆ intersects() [1/2]

bool DD::Image::Box::intersects ( const Box other) const

Check if this box intersects the other box

References intersects(), r(), t(), x(), and y().

Referenced by intersects().

◆ intersects() [2/2]

bool DD::Image::Box::intersects ( int  x,
int  y,
int  r,
int  t 
) const

Same as intersects(Box(x,y,r,t))

References r(), t(), and y().

◆ contains()

bool DD::Image::Box::contains ( const Box other) const

Check if the other box is completely inside this box

References r(), t(), x(), and y().

Referenced by DD::Image::Scene::validate().



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com