Inherits DD::Image::ImagePlaneDescriptor.
Inherited by DD::Image::ImagePlaneWindow.
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 | |
ImagePlane & | operator= (const ImagePlane &ip) |
float * | writable () |
const float * | readable () const |
void | makeWritable () |
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 |
int | chanStride () const |
size_t | usage () const |
void | clear () |
const RefCountedFloatBuffer & | memory () const |
void | setMemory (RefCountedFloatBuffer &memory) |
void | fillChannel (Channel z, float value) |
fill a channel with /value/ | |
void | fillChannelThreaded (Channel z, float value) |
fill a channel with /value/ (using multiple threads) | |
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 | |
Protected Member Functions | |
RefCountedFloatBuffer | buffer (int x, int y) const |
Protected Attributes | |
RefCountedFloatBuffer | _data |
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.
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().
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::GeneralTile::GeneralTile(), and getRow().
void DD::Image::ImagePlane::makeWritable | ( | ) | [inline] |
allocate data if needed. This locks the image plane to make sure only one thread will try to allocate the data buffer.
References DD::Image::RefCountedFloatBuffer::allocate().
Referenced by DD::Image::PlanarIop::doFetchPlane(), makeUnique(), and DD::Image::Read::renderStripe().
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().
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().
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.
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.
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().
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().
int 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().