![]() |
Cinder
0.9.1
|
#include <Channel.h>
Classes | |
class | ConstIter |
class | Iter |
Public Member Functions | |
ChannelT () | |
ChannelT (int32_t width, int32_t height) | |
ChannelT (int32_t width, int32_t height, int32_t rowBytes, uint8_t increment, T *data) | |
ChannelT (int32_t width, int32_t height, int32_t rowBytes, uint8_t increment, T *data, const std::shared_ptr< T > &dataStore) | |
ChannelT (const ChannelT &rhs) | |
ChannelT (ChannelT &&rhs) | |
ChannelT (const ImageSourceRef &imageSource) | |
ChannelT & | operator= (const ChannelT &rhs) |
ChannelT & | operator= (ChannelT &&rhs) |
operator ImageSourceRef () const | |
ChannelT | clone (bool copyPixels=true) const |
ChannelT | clone (const Area &area, bool copyPixels=true) const |
int32_t | getWidth () const |
int32_t | getHeight () const |
ivec2 | getSize () const |
float | getAspectRatio () const |
Area | getBounds () const |
int32_t | getRowBytes () const |
uint8_t | getIncrement () const |
bool | isPlanar () const |
T * | getData () |
const T * | getData () const |
T * | getData (const ivec2 &offset) |
const T * | getData (const ivec2 &offset) const |
T * | getData (int32_t x, int32_t y) |
const T * | getData (int32_t x, int32_t y) const |
T | getValue (ivec2 pos) const |
void | setValue (ivec2 pos, T v) |
void | copyFrom (const ChannelT< T > &srcChannel, const Area &srcArea, const ivec2 &relativeOffset=ivec2()) |
T | areaAverage (const Area &area) const |
std::shared_ptr< T > | getDataStore () const |
Iter | getIter () |
Iter | getIter (const Area &area) |
ConstIter | getIter () const |
ConstIter | getIter (const Area &area) const |
Static Public Member Functions | |
static std::shared_ptr< ChannelT< T > > | create (int32_t width, int32_t height) |
static std::shared_ptr< ChannelT< T > > | create (int32_t width, int32_t height, int32_t rowBytes, uint8_t increment, T *data) |
static std::shared_ptr< ChannelT< T > > | create (int32_t width, int32_t height, int32_t rowBytes, uint8_t increment, T *data, const std::shared_ptr< T > &dataStore) |
static std::shared_ptr< ChannelT< T > > | create (const ChannelT &rhs) |
static std::shared_ptr< ChannelT< T > > | create (const ImageSourceRef &imageSource) |
Protected Attributes | |
int32_t | mWidth |
int32_t | mHeight |
int32_t | mRowBytes |
uint8_t | mIncrement |
T * | mData |
std::shared_ptr< T > | mDataStore |
A single channel of image data, either a color channel of a Surface or a grayscale image. Implicitly shared object.
cinder::ChannelT< T >::ChannelT | ( | ) |
An null Channel.
cinder::ChannelT< T >::ChannelT | ( | int32_t | width, |
int32_t | height | ||
) |
Allocates and owns a contiguous block of memory that is sizeof(T) * width * height.
cinder::ChannelT< T >::ChannelT | ( | int32_t | width, |
int32_t | height, | ||
int32_t | rowBytes, | ||
uint8_t | increment, | ||
T * | data | ||
) |
Does not allocate or own memory pointed to by data.
cinder::ChannelT< T >::ChannelT | ( | int32_t | width, |
int32_t | height, | ||
int32_t | rowBytes, | ||
uint8_t | increment, | ||
T * | data, | ||
const std::shared_ptr< T > & | dataStore | ||
) |
Does not allocate memory pointed to by data but holds a reference to dataStore.
cinder::ChannelT< T >::ChannelT | ( | const ChannelT< T > & | rhs | ) |
Creates a clone of rhs. Data is always stored planar regardless of the increment of rhs.
cinder::ChannelT< T >::ChannelT | ( | ChannelT< T > && | rhs | ) |
Move constructor. Receives data store of rhs.
cinder::ChannelT< T >::ChannelT | ( | const ImageSourceRef & | imageSource | ) |
Creates a ChannelT by loading from an ImageSource imageSource.
ChannelT< T > & cinder::ChannelT< T >::operator= | ( | const ChannelT< T > & | rhs | ) |
ChannelT< T > & cinder::ChannelT< T >::operator= | ( | ChannelT< T > && | rhs | ) |
cinder::ChannelT< T >::operator ImageSourceRef | ( | ) | const |
|
static |
Allocates and owns a contiguous block of memory that is sizeof(T) * width * height.
|
static |
Does not allocate or own memory pointed to by data.
|
static |
Does not allocate memory pointed to by data but holds a reference to dataStore.
|
static |
Creates a clone of rhs. Data is always stored planar regardless of the increment of rhs.
|
static |
Creates a ChannelT by loading from an ImageSource imageSource.
ChannelT< T > cinder::ChannelT< T >::clone | ( | bool | copyPixels = true | ) | const |
Returns a new Channel which is a duplicate. If copyPixels the pixel values are copied, otherwise the clone's pixels remain uninitialized.
ChannelT< T > cinder::ChannelT< T >::clone | ( | const Area & | area, |
bool | copyPixels = true |
||
) | const |
Returns a new Channel which is a duplicate of an Area area. If copyPixels the pixel values are copied, otherwise the clone's pixels remain uninitialized.
int32_t cinder::ChannelT< T >::getWidth | ( | ) | const |
Returns the width of the Channel in pixels.
int32_t cinder::ChannelT< T >::getHeight | ( | ) | const |
Returns the height of the Channel in pixels.
ivec2 cinder::ChannelT< T >::getSize | ( | ) | const |
Returns the size of the Channel in pixels.
float cinder::ChannelT< T >::getAspectRatio | ( | ) | const |
Returns the Channel aspect ratio, which is its width / height.
Area cinder::ChannelT< T >::getBounds | ( | ) | const |
Returns the bounding Area of the Channel in pixels: [0,0]-(width,height)
int32_t cinder::ChannelT< T >::getRowBytes | ( | ) | const |
Returns the width of a row of the Channel measured in bytes, which is not necessarily getWidth() * getPixelInc()
uint8_t cinder::ChannelT< T >::getIncrement | ( | ) | const |
Returns the amount to increment a T* to increment by a pixel. For a planar channel this is 1
, but for a Channel of a Surface this might be 3
or 4
.
bool cinder::ChannelT< T >::isPlanar | ( | ) | const |
Returns whether the Channel represents a tightly packed array of values. This will be false
if the Channel is a member of a Surface. Analogous to getIncrement() == 1
T* cinder::ChannelT< T >::getData | ( | ) |
Returns a pointer to the data of the Channel's first pixel. Result is a uint8_t* for Channel8u and a float* for Channel32f.
const T* cinder::ChannelT< T >::getData | ( | ) | const |
Returns a const pointer to the data of the Channel's first pixel. Result is a uint8_t* for Channel8u and a float* for Channel32f.
T* cinder::ChannelT< T >::getData | ( | const ivec2 & | offset | ) |
Returns a pointer to the data of the Channel's pixel at offset. Result is a uint8_t* for Channel8u and a float* for Channel32f.
const T* cinder::ChannelT< T >::getData | ( | const ivec2 & | offset | ) | const |
Returns a const pointer to the data of the Channel's pixel at offset. Result is a uint8_t* for Channel8u and a float* for Channel32f.
T* cinder::ChannelT< T >::getData | ( | int32_t | x, |
int32_t | y | ||
) |
Returns a pointer to the data of the Channel's pixel at (x, y). Result is a uint8_t* for Channel8u and a float* for Channel32f.
const T* cinder::ChannelT< T >::getData | ( | int32_t | x, |
int32_t | y | ||
) | const |
Returns a const pointer to the data of the Channel's pixel at (x, y). Result is a uint8_t* for Channel8u and a float* for Channel32f.
T cinder::ChannelT< T >::getValue | ( | ivec2 | pos | ) | const |
Convenience method for getting a single value at pixel pos. For performance-sensitive code consider Channel::Iter instead. Exhibits clamping behavior when outside Channel boundaries.
void cinder::ChannelT< T >::setValue | ( | ivec2 | pos, |
T | v | ||
) |
Convenience method for setting a single value v at pixel pos. For performance-sensitive code consider Channel::Iter instead. Exhibits clamping behavior when outside Channel boundaries.
void cinder::ChannelT< T >::copyFrom | ( | const ChannelT< T > & | srcChannel, |
const Area & | srcArea, | ||
const ivec2 & | relativeOffset = ivec2() |
||
) |
T cinder::ChannelT< T >::areaAverage | ( | const Area & | area | ) | const |
Returns an averaged value for the Area defined by area.
std::shared_ptr<T> cinder::ChannelT< T >::getDataStore | ( | ) | const |
Returns the shared_ptr used to store the Channel's data. In general prefer getData() instead.
Iter cinder::ChannelT< T >::getIter | ( | ) |
Returns an Iter which iterates the entire Channel.
Iter cinder::ChannelT< T >::getIter | ( | const Area & | area | ) |
ConstIter cinder::ChannelT< T >::getIter | ( | ) | const |
Returns a ConstIter which iterates the entire Channel.
ConstIter cinder::ChannelT< T >::getIter | ( | const Area & | area | ) | const |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |