Nuke binary plugins 15.1.4
 
Loading...
Searching...
No Matches
DD::Image::ImagePlane Class Reference

#include <ImagePlane.h>

Inheritance diagram for DD::Image::ImagePlane:
DD::Image::ImagePlaneDescriptor

Public Member Functions

 ImagePlane (const DD::Image::Box &bounds, bool packed, DD::Image::ChannelSet mask, int nComps)
 construct based upon bounds, packedness, mask and number of compenents
 
 ImagePlane (const DD::Image::Box &bounds, bool packed, DD::Image::ChannelSet mask)
 construct based upon bounds, packedness, mask and number of components
 
 ImagePlane (const ImagePlane &ip)
 copy construct
 
 ImagePlane (const DD::Image::Box &bounds)
 Construct based upon BBox.
 
 ImagePlane ()
 empty constructor
 
ImagePlaneoperator= (const ImagePlane &ip)
 
float * writable ()
 
const float * readable () const
 
void makeWritable (size_t alignment=0)
 
void makeUnique ()
 make the buffer unique - copy the underlying data if this has more than one reference
 
void copyIntersectionFrom (const ImagePlane &other, bool forceDeep=false)
 
int chanNo (Channel z) const
 
const float & at (int x, int y, int z) const
 get a reference to the data at (x, y) with the channel number /z/.
 
const float & at (int x, int y, Channel z)
 
float & writableAt (int x, int y, int z)
 
ImageTilePtr writableAt (int y, int z)
 
ImageTileReadOnlyPtr readableAt (int y, int z) const
 
int colStride () const
 
int rowStride () const
 
int64_t chanStride () const
 
size_t usage () const
 
void clear ()
 
const RefCountedFloatBuffermemory () const
 
void setMemory (RefCountedFloatBuffer &memory)
 
void fillChannel (Channel z, float value)
 fill a channel with /value/
 
void fillChannelThreaded (Channel z, float value, unsigned int numThreads=0)
 
void copyChannel (Channel dst, Channel src)
 copy channel /src/ into /dst/
 
void getRow (int y, int x, int r, DD::Image::ChannelMask m, DD::Image::Row &row, bool customChannels)
 get a row into the DD scanline
 
- Public Member Functions inherited from DD::Image::ImagePlaneDescriptor
 ImagePlaneDescriptor (const DD::Image::Box &bounds, bool packed, DD::Image::ChannelSet mask, int nComps)
 
DD::Image::Box bounds () const
 
ChannelSet channels () const
 
bool packed () const
 
int nComps () const
 
bool intersects (const ImagePlaneDescriptor &other) const
 
bool intersects (int y, int t) const
 
bool satisfiedBy (const ImagePlaneDescriptor &candidate)
 

Protected Member Functions

RefCountedFloatBuffer buffer (int x, int y) const
 

Protected Attributes

RefCountedFloatBuffer _data
 
- Protected Attributes inherited from DD::Image::ImagePlaneDescriptor
DD::Image::Box _bounds
 
bool _packed
 
ChannelSet _mask
 
int _nComps
 

Detailed Description

Class that represents an ImagePlane. ImagePlanes can be of any size, have any set of channels.

The data is a reference-counted float buffer consisting of contiguous pixel data for the defined bounding box and channels.

This is a relatively low-level class intended for code that interfaces with external code and has to operate in a particular. More complex mechanisms can be built upon this.

Member Function Documentation

◆ writable()

float * DD::Image::ImagePlane::writable ( )
inline

Allocate data if needed and return a non-const pointer to it. The pointer is to element (x, y, z), where x = bounds().x(), y = bounds().y() and z is the lowest Channel in channels()

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

◆ readable()

const float * DD::Image::ImagePlane::readable ( ) const
inline

return a non-const pointer to the data. The pointer is to element (x, y, z), where x = bounds().x(), y = bounds().y() and z is the lowest Channel in channels()

Referenced by copyIntersectionFrom(), DD::Image::PlanarIop::doFetchPlane(), getRow(), DD::Image::GeneralTile::load_range(), and DD::Image::PlanarIop::renderStripe().

◆ makeWritable()

void DD::Image::ImagePlane::makeWritable ( size_t  alignment = 0)
inline

allocate data if needed. This locks the image plane to make sure only one thread will try to allocate the data buffer. Optionally align memory (also rounds up allocated amount to multiple of alignment)

Referenced by DD::Image::PlanarIop::doFetchPlane(), makeUnique(), and DD::Image::Read::renderStripe().

◆ copyIntersectionFrom()

void DD::Image::ImagePlane::copyIntersectionFrom ( const ImagePlane other,
bool  forceDeep = false 
)

copy the intersection in channels and bbox from the other plane to this one in the most efficient way possible. Note that this may involve a pointer copy rather than a memory copy if the intersection is a subset of the other plane (or identical to it); unless forceDeep is set to true, in which case it will always do a deep copy.

Allocates memory if needed, is (and preferred) valid to call it without having called writable().

References DD::Image::Box::r(), readable(), DD::Image::ChannelSet::size(), DD::Image::Box::t(), DD::Image::Box::x(), and DD::Image::Box::y().

Referenced by DD::Image::PlanarIop::doFetchPlane(), and makeUnique().

◆ chanNo()

int DD::Image::ImagePlane::chanNo ( Channel  z) const
inline

find out the index within this plane for the given Channel. E.g. a Mask_RGBA plane will have Chan_Red = 0, Chan_Green = 1, Chan_Blue = 2, Chan_Alpha = 3, but a Mask_Green | Mask_Alpha plane will have Chan_Green = 0 and Chan_Alpha = 1.

Returns -1 if the channel is not present. This is the value that is passed as the last parameter of at() and would be multiplied by the chanStride().

Referenced by DD::Image::GeneralTile::at(), copyChannel(), and getRow().

◆ writableAt() [1/2]

float & DD::Image::ImagePlane::writableAt ( int  x,
int  y,
int  z 
)
inline

get a writable reference to the data at (x, y) with the channel number /z/. you need to have called makeWritable() or similar first.

◆ writableAt() [2/2]

ImageTilePtr DD::Image::ImagePlane::writableAt ( int  y,
int  z 
)
inline

get a writable ImageTilePtr pointing at the data at (0, y) with the channel number /z/. Like Row::operator[] and Row::writable() you must always have add the horizontal offset before deferencing this pointer.

you need to have called makeWritable() or similar first.

◆ colStride()

int DD::Image::ImagePlane::colStride ( ) const
inline

get the stride between columns. Is the number of channels for packed planes. For unpacked planes is 1.

Referenced by copyChannel(), and getRow().

◆ rowStride()

int DD::Image::ImagePlane::rowStride ( ) const
inline

return the stride between rows. Is the number of channels times the width for packed planes. For unpacked planes is the width.

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

◆ chanStride()

int64_t DD::Image::ImagePlane::chanStride ( ) const
inline

return the stride between channels. Is 1 for packed planes. For unpacked planes is the width times the height.

Referenced by copyChannel(), and DD::Image::Iop::doFetchPlane().

◆ fillChannelThreaded()

void DD::Image::ImagePlane::fillChannelThreaded ( Channel  z,
float  value,
unsigned int  numThreads = 0 
)

fill a channel with /value/ (using multiple threads). /numThreads/ specifies the number of threads to use. Setting /numThreads/ to 0 lets the function decide on the number of threads to use.

References DD::Image::Thread::numThreads, DD::Image::Thread::spawn(), and DD::Image::Thread::wait().



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