Nuke binary plugins 14.1.5
 
Loading...
Searching...
No Matches
DD::Image::GenericImagePlane Class Reference

Class to wrap up an image plane of arbitrary type. This is used by the readers to return image data with the minimal amount of conversion needed. More...

#include <GenericImagePlane.h>

Public Member Functions

 GenericImagePlane (const GenericImagePlaneDescriptor &desc)
 ctor, relying on our own allocation
 
 GenericImagePlane (const GenericImagePlaneDescriptor &desc, HandlePtr handle)
 
const GenericImagePlaneDescriptordesc () const
 
ptrdiff_t rowStrideBytes () const
 
ptrdiff_t colStrideBytes () const
 
ptrdiff_t chanStrideBytes () const
 
template<class T >
const T & at (int x, int y, int z) const
 Get a reference to the data at (x, y) with the channel number /z/.
 
template<class T >
T & writableAt (int x, int y, int z)
 Get a reference to the data at (x, y) with the channel number /z/.
 
void clearImage ()
 Clears the image by writing 0 into the entire buffer.
 

Protected Member Functions

void SetStrides ()
 
const char * address (int x, int y, int z) const
 
void CheckType (unsigned char testVariable)
 
void CheckType (unsigned short testVariable)
 
void CheckType (unsigned int testVariable)
 
void CheckType (Half::half testVariable)
 
void CheckType (float testVariable)
 

Protected Attributes

GenericImagePlaneDescriptor _desc
 
HandlePtr _handle
 
char * _data
 base address of our image, kept as a char for address maths
 
ptrdiff_t _rowStrideBytes
 
ptrdiff_t _colStrideBytes
 The stride between columns in bytes.
 
ptrdiff_t _chanStrideBytes
 The stride between channels in bytes.
 

Detailed Description

Class to wrap up an image plane of arbitrary type. This is used by the readers to return image data with the minimal amount of conversion needed.

TODO - refactor ImagePlane and it's floatingpoint refcounted thing to be compatible with this (via assigment and CC both ways, with checks for types being right).

Constructor & Destructor Documentation

◆ GenericImagePlane()

DD::Image::GenericImagePlane::GenericImagePlane ( const GenericImagePlaneDescriptor desc,
HandlePtr  handle 
)
inline

Constructor using a specific chunk of memory in which we want the image data stored.

Note
Make sure the specified memory is large enough to hold the image plane described by the specified descriptor (bounds, bit depth and channel count).

References _data, DD::Image::BaseHandle::getAllocatedData(), and SetStrides().

Member Function Documentation

◆ SetStrides()

void DD::Image::GenericImagePlane::SetStrides ( )
inlineprotected

Helper function to calculate the various strides given the information in the GenericImagePlaneDescriptor member _desc, which must have been set before the call to SetStrides().

References _chanStrideBytes, _colStrideBytes, _rowStrideBytes, DD::Image::Box::h(), and DD::Image::Box::w().

Referenced by GenericImagePlane().

◆ CheckType()

void DD::Image::GenericImagePlane::CheckType ( unsigned char  testVariable)
inlineprotected

The various CheckType() functions are used to assert that the type on which at() or writableAt() have been templatised corresponds to the enumerated type of the descriptor's data info, which is determined at runtime.

Member Data Documentation

◆ _rowStrideBytes

ptrdiff_t DD::Image::GenericImagePlane::_rowStrideBytes
protected

The stride between rows in bytes. This depends on the channel data type and the number of channels and/or image width, according to whether the image plane is packed or not (as specified by GenericImagePlaneDescriptor::_packed).

Referenced by SetStrides().



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