# TChannelDataBucket Class Reference
[MCImage]

Inheritance diagram for TChannelDataBucket:

List of all members.

## Public Member Functions
| TChannelDataBucket ()
| TChannelDataBucket (TMCPixelBucket *pbuck)
TMCPoint | GetOrigin (void) const
void | SetOrigin (const TMCPoint &p)
void * | GetPrivateData (void) const
void | SetPrivateData (void *data)
real32 | GetGamma (void) const
void | SetGamma (const real32 g)
TMCRect | OffsetRect (void) const
## Protected Attributes
TMCPoint | fOrigin
| origin of the pixelbucket
void * | fPrivateData
| private data used by MCImage channel API
real32 | fGamma
| gamma used to interpret 8-bit data

## Detailed Description

TChannelDataBucket is used to access part of the data of an IShChannel. Here is an example:

            //allocate a memory block that will receive a copy of the channel's data
     //use a TMCArray as buffer so we get asserts if we go outside the bounds
            TMCArray<real> distanceBuffer;
            distanceBuffer.SetElemCount( (tileRect.GetWidth()+fMaxRadius*4) * (tileRect.GetHeight()+fMaxRadius*4) );

            int32 rmax= fMaxRadius;
            TMCRect rect(outputRect.left-2*rmax,outputRect.top-2*rmax,outputRect.right+2*rmax,outputRect.bottom+2*rmax);

            //fZBuffer is a TMCCountedPtr <IShChannel>
            TChannelDataBucket distanceBucket;
            fZBuffer->GetData(rect, &distanceBucket,(void*)distanceBuffer.BaseAddress(), eTileRead | kDataReplicateBorders);

            const uint32 width  = outputRect.GetWidth();
            const uint32 height = outputRect.GetHeight();

            real* dist= NULL;
            for (uint32 y= rmax; y < (height+3*rmax); y++)
            {
                    dist= (real*)distanceBucket.RowPtr32(y);
                    for (uint32 x= rmax; x < (width+3*rmax); x++)
                    {
                            // for each pixel in the buffer
                            gShellThreadUtilities->YieldProcesses(15);
                            const real pixelDistance= dist[x];
                            // Now do something with it...
                    }
            }

            fZBuffer->UnGetData(&distanceBucket,false); //Don't forget this !!!!

## Constructor & Destructor Documentation

TChannelDataBucket::TChannelDataBucket | ( |  | ) | `[inline]`

TChannelDataBucket::TChannelDataBucket | ( | TMCPixelBucket * | pbuck | ) | `[inline]`

## Member Function Documentation

real32 TChannelDataBucket::GetGamma | ( | void |  | ) | const`[inline]`

TMCPoint TChannelDataBucket::GetOrigin | ( | void |  | ) | const`[inline]`

void* TChannelDataBucket::GetPrivateData | ( | void |  | ) | const`[inline]`

TMCRect TChannelDataBucket::OffsetRect | ( | void |  | ) | const`[inline]`

void TChannelDataBucket::SetGamma | ( | const real32 | g | ) | `[inline]`

void TChannelDataBucket::SetOrigin | ( | const TMCPoint & | p | ) | `[inline]`

void TChannelDataBucket::SetPrivateData | ( | void * | data | ) | `[inline]`

## Member Data Documentation

real32 TChannelDataBucket::fGamma`[protected]`

gamma used to interpret 8-bit data

TMCPoint TChannelDataBucket::fOrigin`[protected]`

origin of the pixelbucket

void* TChannelDataBucket::fPrivateData`[protected]`

private data used by MCImage channel API

The documentation for this class was generated from the following file:

- IShChannel.h