eq::Image Class Reference

A holder for pixel data. More...

#include <image.h>

Collaboration diagram for eq::Image:
Collaboration graph
[legend]

List of all members.

Classes

class  Attachment
 The individual parameters for a buffer.
struct  Data
 All distributed data.
struct  Memory
 Raw image data.
struct  PixelData

Public Member Functions

 Image ()
 Constructs a new Image.
GLEWContext * glewGetContext ()
uint8_t getNumChannels (const Frame::Buffer buffer) const
uint8_t getChannelSize (const Frame::Buffer buffer) const
uint32_t getDepth (const Frame::Buffer buffer) const
std::vector< uint32_t > findCompressors (const Frame::Buffer buffer) const
bool allocCompressor (const Frame::Buffer buffer, const uint32_t name)
 Re-allocate, if needed, a compressor instance.
Image parameters



void setFormat (const Frame::Buffer buffer, const uint32_t format)
 Set the (OpenGL) format of the pixel data for a buffer.
uint32_t getFormat (const Frame::Buffer buffer) const
void setType (const Frame::Buffer buffer, const uint32_t type)
 Set the (OpenGL) type of the pixel data for a buffer.
uint32_t getType (const Frame::Buffer buffer) const
bool hasAlpha () const
void setStorageType (const Frame::Type type)
 Set the frame pixel storage type.
Frame::Type getStorageType () const
bool hasData (const Frame::Buffer buffer) const
void setPixelViewport (const PixelViewport &pvp)
 Set the pixel viewport of the image.
const PixelViewportgetPixelViewport () const
void reset ()
 Reset the image to its default state.
Pixel data



const uint8_t * getPixelPointer (const Frame::Buffer buffer) const
uint8_t * getPixelPointer (const Frame::Buffer buffer)
uint32_t getPixelDataSize (const Frame::Buffer buffer) const
const PixelDatagetPixelData (const Frame::Buffer buffer) const
const PixelDatacompressPixelData (const Frame::Buffer buffer)
bool hasPixelData (const Frame::Buffer buffer) const
void clearPixelData (const Frame::Buffer buffer)
 Clear (zero-initialize) and validate an image buffer.
void validatePixelData (const Frame::Buffer buffer)
 Validate an image buffer without initializing its content.
void setPixelData (const Frame::Buffer buffer, const uint8_t *data)
 Set the pixel data of one of the image buffers.
void setPixelData (const Frame::Buffer buffer, const PixelData &data)
 Set the pixel data of one of the image buffers.
void enablePBO ()
 Switch PBO usage for image transfers on.
void disablePBO ()
 Switch PBO usage for image transfers off.
bool usePBO () const
void enableAlphaUsage ()
 Enable compression and transport of alpha data.
void disableAlphaUsage ()
 Disable compression and transport of alpha data.
bool ignoreAlpha () const
Texture access



const util::TexturegetTexture (const Frame::Buffer buffer) const
 Get the texture of this image.
bool hasTextureData (const Frame::Buffer buffer) const
uint32_t getInternalTextureFormat (const Frame::Buffer which) const
Operations



void startReadback (const uint32_t buffers, const PixelViewport &pvp, const Zoom &zoom, Window::ObjectManager *glObjects)
 Start reading back an image from the frame buffer.
void syncReadback ()
 Make sure that the last readback operation is complete.
void writeImage (const std::string &filename, const Frame::Buffer buffer) const
 Writes the pixel data as rgb image files.
void writeImages (const std::string &filenameTemplate) const
 Writes all valid pixel data as separate images.
bool readImage (const std::string &filename, const Frame::Buffer buffer)
 Read pixel data from an uncompressed rgb image file.
void setOffset (int32_t x, int32_t y)
 Setting image offset, used after readback to correct position if necessary.
void flush ()
 Delete all cache data of this image.

Friends

std::ostream & operator<< (std::ostream &os, const Image *)

Detailed Description

A holder for pixel data.

An image holds color and depth information for a rectangular region.

Definition at line 37 of file image.h.


Constructor & Destructor Documentation

eq::Image::Image (  ) 

Constructs a new Image.

Definition at line 47 of file image.cpp.

References reset().

Here is the call graph for this function:


Member Function Documentation

void eq::Image::setFormat ( const Frame::Buffer  buffer,
const uint32_t  format 
)

Set the (OpenGL) format of the pixel data for a buffer.

Invalidates the pixel data.

Parameters:
buffer the buffer type.
format the format.

Definition at line 152 of file image.cpp.

References allocCompressor().

Referenced by eq::Compositor::mergeFramesCPU(), readImage(), setPixelData(), and eq::util::Texture::writeTexture().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t eq::Image::getFormat ( const Frame::Buffer  buffer  )  const
Returns:
the (OpenGL) format of the pixel data.

Definition at line 176 of file image.cpp.

Referenced by getInternalTextureFormat(), getNumChannels(), hasAlpha(), eq::util::Texture::upload(), and writeImage().

Here is the caller graph for this function:

void eq::Image::setType ( const Frame::Buffer  buffer,
const uint32_t  type 
)

Set the (OpenGL) type of the pixel data for a buffer.

Invalidates the pixel data.

Parameters:
buffer the buffer type.
type the type.

Definition at line 165 of file image.cpp.

References allocCompressor().

Referenced by eq::Compositor::mergeFramesCPU(), readImage(), setPixelData(), and eq::util::Texture::writeTexture().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t eq::Image::getType ( const Frame::Buffer  buffer  )  const
Returns:
the (OpenGL) type of the pixel data.

Definition at line 183 of file image.cpp.

Referenced by getChannelSize(), and eq::util::Texture::upload().

Here is the caller graph for this function:

bool eq::Image::hasAlpha (  )  const
Returns:
true if the image has a color buffer with alpha.

Definition at line 319 of file image.cpp.

References eq::Frame::BUFFER_COLOR, and getFormat().

Here is the call graph for this function:

void eq::Image::setStorageType ( const Frame::Type  type  )  [inline]

Set the frame pixel storage type.

Images of storage type TYPE_MEMORY read back frame buffer data into main memory. The data can be accessed through the PixelData.

Image of storage type TYPE_TEXTURE read frame buffer data into a texture, which can be accessed using getTexture().

Definition at line 107 of file image.h.

Frame::Type eq::Image::getStorageType (  )  const [inline]
Returns:
the pixel data storage type.

Definition at line 110 of file image.h.

Referenced by eq::Compositor::assembleImageDB_GLSL().

Here is the caller graph for this function:

bool eq::Image::hasData ( const Frame::Buffer  buffer  )  const
Returns:
true if the image buffer has valid data.

Definition at line 335 of file image.cpp.

References hasPixelData(), hasTextureData(), eq::Frame::TYPE_MEMORY, and eq::Frame::TYPE_TEXTURE.

Referenced by eq::Compositor::assembleImage(), eq::Compositor::assembleImage2D(), and eq::Compositor::assembleImageDB_FF().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::Image::setPixelViewport ( const PixelViewport pvp  ) 

Set the pixel viewport of the image.

Returns:
the fractional viewport of the image.

The image pixel data and textures will be invalidated.

Parameters:
pvp the pixel viewport.

Definition at line 670 of file image.cpp.

Referenced by eq::Compositor::mergeFramesCPU(), readImage(), reset(), and eq::util::Texture::writeTexture().

Here is the caller graph for this function:

const PixelViewport& eq::Image::getPixelViewport (  )  const [inline]
Returns:
the pixel viewport of the image with in the frame buffer.

Definition at line 128 of file image.h.

Referenced by eq::Compositor::assembleImageDB_FF(), eq::Compositor::assembleImageDB_GLSL(), readImage(), eq::Compositor::setupStencilBuffer(), eq::FrameData::transmit(), and eq::util::Texture::upload().

Here is the caller graph for this function:

void eq::Image::reset (  ) 

Reset the image to its default state.

Definition at line 58 of file image.cpp.

References setPixelViewport().

Referenced by Image().

Here is the call graph for this function:

Here is the caller graph for this function:

const uint8_t * eq::Image::getPixelPointer ( const Frame::Buffer  buffer  )  const
Returns:
a pointer to the raw pixel data.

Definition at line 374 of file image.cpp.

References hasPixelData().

Referenced by eq::Compositor::mergeFramesCPU(), eq::util::Texture::upload(), writeImage(), and eq::util::Texture::writeTexture().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t eq::Image::getPixelDataSize ( const Frame::Buffer  buffer  )  const [inline]
Returns:
the size of the raw pixel data in bytes

Definition at line 143 of file image.h.

References eq::PixelViewport::getArea(), and getDepth().

Referenced by clearPixelData(), compressPixelData(), setPixelData(), eq::FrameData::transmit(), and validatePixelData().

Here is the call graph for this function:

Here is the caller graph for this function:

const Image::PixelData & eq::Image::getPixelData ( const Frame::Buffer  buffer  )  const
Returns:
the pixel data.

Definition at line 386 of file image.cpp.

References hasPixelData().

Referenced by eq::FrameData::transmit().

Here is the call graph for this function:

Here is the caller graph for this function:

const Image::PixelData & eq::Image::compressPixelData ( const Frame::Buffer  buffer  ) 
Returns:
compress, if needed, and return the pixel data.

Definition at line 933 of file image.cpp.

References allocCompressor(), EQ_COMPRESSOR_DATA_2D, EQ_COMPRESSOR_IGNORE_MSE, EQ_COMPRESSOR_NONE, EQWARN, and getPixelDataSize().

Referenced by eq::FrameData::transmit().

Here is the call graph for this function:

Here is the caller graph for this function:

bool eq::Image::hasPixelData ( const Frame::Buffer  buffer  )  const [inline]
Returns:
true if the image has pixel data for the buffer, false if not.

Definition at line 158 of file image.h.

Referenced by getPixelData(), getPixelPointer(), hasData(), and eq::FrameData::transmit().

Here is the caller graph for this function:

void eq::Image::clearPixelData ( const Frame::Buffer  buffer  ) 

Clear (zero-initialize) and validate an image buffer.

Parameters:
buffer the image buffer to clear.

Definition at line 679 of file image.cpp.

References eq::Frame::BUFFER_COLOR, eq::Frame::BUFFER_DEPTH, getDepth(), getPixelDataSize(), and validatePixelData().

Referenced by eq::Compositor::mergeFramesCPU().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::Image::validatePixelData ( const Frame::Buffer  buffer  ) 

Validate an image buffer without initializing its content.

Definition at line 716 of file image.cpp.

References getPixelDataSize().

Referenced by clearPixelData(), readImage(), and eq::util::Texture::writeTexture().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::Image::setPixelData ( const Frame::Buffer  buffer,
const uint8_t *  data 
)

Set the pixel data of one of the image buffers.

The data is copied, and previous data for the buffer is overwritten. The pixel data is validated.

Parameters:
buffer the image buffer to set.
data the buffer data of size pvp.w * pvp.h * depth.

Definition at line 726 of file image.cpp.

References getPixelDataSize().

Referenced by setPixelData().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::Image::setPixelData ( const Frame::Buffer  buffer,
const PixelData data 
)

Set the pixel data of one of the image buffers.

Previous data for the buffer is overwritten. The pixel data is validated and decompressed , if needed.

Parameters:
buffer the image buffer to set.
data the pixel data.

Definition at line 740 of file image.cpp.

References eq::Image::PixelData::compressedData, eq::Image::PixelData::compressedSize, eq::Image::PixelData::compressorName, EQ_COMPRESSOR_DATA_2D, EQ_COMPRESSOR_IGNORE_MSE, EQ_COMPRESSOR_NONE, eq::Image::PixelData::format, eq::base::Buffer< T >::getData(), getPixelDataSize(), eq::base::Buffer< T >::getSize(), eq::Image::PixelData::pixels, setFormat(), setPixelData(), setType(), and eq::Image::PixelData::type.

Here is the call graph for this function:

void eq::Image::enablePBO (  )  [inline]

Switch PBO usage for image transfers on.

Definition at line 196 of file image.h.

void eq::Image::disablePBO (  )  [inline]

Switch PBO usage for image transfers off.

Definition at line 199 of file image.h.

bool eq::Image::usePBO (  )  const [inline]
Returns:
if this image should use PBO for image transfers.

Definition at line 202 of file image.h.

void eq::Image::enableAlphaUsage (  ) 

Enable compression and transport of alpha data.

Definition at line 344 of file image.cpp.

void eq::Image::disableAlphaUsage (  ) 

Disable compression and transport of alpha data.

Definition at line 354 of file image.cpp.

bool eq::Image::ignoreAlpha (  )  const [inline]
Returns:
true if alpha data can be ignored.

Definition at line 211 of file image.h.

Referenced by eq::FrameData::transmit().

Here is the caller graph for this function:

const util::Texture & eq::Image::getTexture ( const Frame::Buffer  buffer  )  const

Get the texture of this image.

Definition at line 369 of file image.cpp.

Referenced by eq::Compositor::assembleImageDB_GLSL(), and hasTextureData().

Here is the caller graph for this function:

bool eq::Image::hasTextureData ( const Frame::Buffer  buffer  )  const
Returns:
true if the image has texture data for the buffer, false if not.

Definition at line 364 of file image.cpp.

References getTexture(), and eq::util::Texture::isValid().

Referenced by hasData().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t eq::Image::getInternalTextureFormat ( const Frame::Buffer  which  )  const
Returns:
the internal format a texture should use for the given buffer.

Definition at line 127 of file image.cpp.

References EQWARN, and getFormat().

Referenced by eq::util::Texture::upload().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::Image::startReadback ( const uint32_t  buffers,
const PixelViewport pvp,
const Zoom zoom,
Window::ObjectManager glObjects 
)

Start reading back an image from the frame buffer.

Parameters:
buffers bit-wise combination of the frame buffer components.
pvp the area of the frame buffer wrt the drawable.
zoom the scale factor to apply during readback.
glObjects the GL object manager for the current GL context.
See also:
setStorageType()

Definition at line 392 of file image.cpp.

References eq::Frame::BUFFER_COLOR, eq::Frame::BUFFER_DEPTH, EQLOG, and eq::LOG_ASSEMBLY.

Referenced by eq::FrameData::startReadback().

Here is the caller graph for this function:

void eq::Image::syncReadback (  ) 

Make sure that the last readback operation is complete.

Definition at line 418 of file image.cpp.

References eq::Frame::BUFFER_COLOR, and eq::Frame::BUFFER_DEPTH.

Referenced by eq::FrameData::syncReadback().

Here is the caller graph for this function:

void eq::Image::writeImage ( const std::string &  filename,
const Frame::Buffer  buffer 
) const

Writes the pixel data as rgb image files.

Definition at line 1057 of file image.cpp.

References EQERROR, getChannelSize(), getFormat(), getNumChannels(), and getPixelPointer().

Referenced by writeImages(), and eq::util::Texture::writeTexture().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::Image::writeImages ( const std::string &  filenameTemplate  )  const

Writes all valid pixel data as separate images.

Definition at line 993 of file image.cpp.

References eq::Frame::BUFFER_COLOR, eq::Frame::BUFFER_DEPTH, and writeImage().

Referenced by eq::Compositor::assembleFramesCPU(), and eq::FrameData::syncReadback().

Here is the call graph for this function:

Here is the caller graph for this function:

bool eq::Image::readImage ( const std::string &  filename,
const Frame::Buffer  buffer 
)

Read pixel data from an uncompressed rgb image file.

Definition at line 1146 of file image.cpp.

References eq::Frame::BUFFER_COLOR, eq::Frame::BUFFER_DEPTH, EQERROR, eq::base::MemoryMap::getAddress(), getPixelViewport(), eq::base::MemoryMap::getSize(), eq::base::MemoryMap::map(), setFormat(), setPixelViewport(), setType(), and validatePixelData().

Here is the call graph for this function:

void eq::Image::flush (  ) 

Delete all cache data of this image.

Definition at line 65 of file image.cpp.

Referenced by eq::FrameData::flush().

Here is the caller graph for this function:

GLEWContext* eq::Image::glewGetContext (  )  [inline]
Returns:
the GL function table, valid during readback.

Definition at line 277 of file image.h.

uint8_t eq::Image::getNumChannels ( const Frame::Buffer  buffer  )  const
Returns:
the number of channels in a pixel.

Definition at line 78 of file image.cpp.

References EQWARN, and getFormat().

Referenced by getDepth(), and writeImage().

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t eq::Image::getChannelSize ( const Frame::Buffer  buffer  )  const
Returns:
the size in bytes for one channel.

Definition at line 105 of file image.cpp.

References getType().

Referenced by getDepth(), and writeImage().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t eq::Image::getDepth ( const Frame::Buffer  buffer  )  const
Returns:
the size in bytes for one pixel (nChannels*channelSize).

Definition at line 73 of file image.cpp.

References getChannelSize(), and getNumChannels().

Referenced by clearPixelData(), and getPixelDataSize().

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< uint32_t > eq::Image::findCompressors ( const Frame::Buffer  buffer  )  const
Returns:
the list of possible compressors for the given buffer.

For internal use only.

Definition at line 245 of file image.cpp.

References EQINFO, eq::Compressor::getInfos(), eq::Global::getPluginRegistry(), EqCompressorInfo::name, and EqCompressorInfo::tokenType.

Referenced by allocCompressor().

Here is the call graph for this function:

Here is the caller graph for this function:

bool eq::Image::allocCompressor ( const Frame::Buffer  buffer,
const uint32_t  name 
)

Re-allocate, if needed, a compressor instance.

Find and activate a compression engine.

For internal use only.

Definition at line 845 of file image.cpp.

References EQ_COMPRESSOR_NONE, EQINFO, findCompressors(), and eq::Global::getPluginRegistry().

Referenced by compressPixelData(), setFormat(), and setType().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Sat Feb 6 13:05:29 2010 for Equalizer 0.9.1 by  doxygen 1.6.1