Equalizer
1.4.1
|
A holder for pixel data. More...
#include <image.h>
Public Member Functions | |
Image () | |
Construct a new Image. | |
virtual | ~Image () |
Destruct the Image. | |
Image parameters | |
void | setInternalFormat (const Frame::Buffer buffer, const uint32_t internalFormat) |
Set the internal format for the given buffer. | |
uint32_t | getInternalFormat (const Frame::Buffer buffer) const |
uint32_t | getExternalFormat (const Frame::Buffer buffer) const |
Get the external format of the given buffer. | |
uint32_t | getPixelSize (const Frame::Buffer buffer) const |
Get the size, in bytes, of one pixel in the external pixel data. | |
bool | hasAlpha () const |
void | setStorageType (const Frame::Type type) |
Set the frame pixel storage type. | |
Frame::Type | getStorageType () const |
void | setPixelViewport (const PixelViewport &pvp) |
Set the internal pixel viewport of the image. | |
const PixelViewport & | getPixelViewport () const |
void | setZoom (const Zoom &zoom) |
Sets the zoom factor to be used for compositing. | |
const Zoom & | getZoom () const |
void | useCompressor (const Frame::Buffer buffer, const uint32_t name) |
Set a compressor to be used during transmission of the image. | |
void | reset () |
Reset the image to its default state. | |
void | flush () |
Free all cached data of this image. | |
void | deleteGLObjects (ObjectManager *om) |
Delete all OpenGL objects allocated from the given object manager. | |
void | resetPlugins () |
Deallocate all transfer and compression plugins. | |
Pixel Data Access | |
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 PixelData & | getPixelData (const Frame::Buffer) const |
const PixelData & | compressPixelData (const Frame::Buffer) |
bool | hasPixelData (const Frame::Buffer buffer) const |
bool | hasAsyncReadback (const Frame::Buffer buffer) const |
bool | hasAsyncReadback () const |
void | clearPixelData (const Frame::Buffer buffer) |
Clear and validate an image buffer. | |
void | validatePixelData (const Frame::Buffer buffer) |
Allocate an image buffer without initialization. | |
void | setPixelData (const Frame::Buffer buffer, const PixelData &data) |
Set the pixel data of the given image buffer. | |
void | setAlphaUsage (const bool enabled) |
Set alpha data preservation during download and compression. | |
bool | getAlphaUsage () const |
void | setQuality (const Frame::Buffer buffer, const float quality) |
Set the minimum quality after a full download-compression path. | |
float | getQuality (const Frame::Buffer buffer) const |
Texture Data Access | |
const util::Texture & | getTexture (const Frame::Buffer buffer) const |
Get the texture of this image. | |
bool | hasTextureData (const Frame::Buffer buffer) const |
Operations | |
bool | readback (const uint32_t buffers, const PixelViewport &pvp, const Zoom &zoom, ObjectManager *glObjects) |
Read back an image from the frame buffer. | |
bool | startReadback (const uint32_t buffers, const PixelViewport &pvp, const Zoom &zoom, ObjectManager *glObjects) |
Start reading back an image from the frame buffer. | |
bool | startReadback (const Frame::Buffer buffer, const util::Texture *texture, const GLEWContext *glewContext) |
void | finishReadback (const Zoom &zoom, const GLEWContext *glewContext) |
Finish an asynchronous readback. | |
bool | upload (const Frame::Buffer buffer, util::Texture *texture, const Vector2i &position, ObjectManager *glObjects) const |
Upload this image to the frame buffer or a texture. | |
bool | writeImage (const std::string &filename, const Frame::Buffer buffer) const |
Write the pixel data as rgb image file. | |
bool | writeImages (const std::string &filenameTemplate) const |
Write 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) |
Internal | |
std::vector< uint32_t > | findCompressors (const Frame::Buffer buffer) const |
std::vector< uint32_t > | findTransferers (const Frame::Buffer buffer, const GLEWContext *gl) const |
bool | allocCompressor (const Frame::Buffer buffer, const uint32_t name) |
bool | allocDownloader (const Frame::Buffer buffer, const uint32_t name, const GLEWContext *glewContext) |
uint32_t | getDownloaderName (const Frame::Buffer buffer) const |
A holder for pixel data.
An image holds color and depth information for one rectangular region.
eq::Image::Image | ( | ) |
Construct a new Image.
virtual eq::Image::~Image | ( | ) | [virtual] |
Destruct the Image.
void eq::Image::clearPixelData | ( | const Frame::Buffer | buffer | ) |
Clear and validate an image buffer.
RGBA and BGRA buffers are initialized with (0,0,0,255). DEPTH_UNSIGNED_INT buffers are initialized with 255. All other buffers are zero-initialized. Validates the buffer.
buffer | the image buffer to clear. |
const PixelData& eq::Image::compressPixelData | ( | const Frame::Buffer | ) |
void eq::Image::deleteGLObjects | ( | ObjectManager * | om | ) |
Delete all OpenGL objects allocated from the given object manager.
Requires the appropriate OpenGL context to be current.
void eq::Image::finishReadback | ( | const Zoom & | zoom, |
const GLEWContext * | glewContext | ||
) |
Finish an asynchronous readback.
zoom | the scale factor to apply during readback. |
glewContext | the OpenGL function table. |
void eq::Image::flush | ( | ) |
Free all cached data of this image.
bool eq::Image::getAlphaUsage | ( | ) | const |
uint32_t eq::Image::getExternalFormat | ( | const Frame::Buffer | buffer | ) | const |
Get the external format of the given buffer.
The external format describes the layout of the pixel data in main memory. It is determined by the plugin used during download. The external format also determines the pixel size and alpha availability.
buffer | the frame buffer attachment. |
uint32_t eq::Image::getInternalFormat | ( | const Frame::Buffer | buffer | ) | const |
const PixelData& eq::Image::getPixelData | ( | const Frame::Buffer | ) | const |
uint32_t eq::Image::getPixelDataSize | ( | const Frame::Buffer | buffer | ) | const |
const uint8_t* eq::Image::getPixelPointer | ( | const Frame::Buffer | buffer | ) | const |
uint8_t* eq::Image::getPixelPointer | ( | const Frame::Buffer | buffer | ) |
uint32_t eq::Image::getPixelSize | ( | const Frame::Buffer | buffer | ) | const |
Get the size, in bytes, of one pixel in the external pixel data.
buffer | the frame buffer attachment. |
const PixelViewport& eq::Image::getPixelViewport | ( | ) | const |
float eq::Image::getQuality | ( | const Frame::Buffer | buffer | ) | const |
Frame::Type eq::Image::getStorageType | ( | ) | const |
const util::Texture& eq::Image::getTexture | ( | const Frame::Buffer | buffer | ) | const |
Get the texture of this image.
const Zoom& eq::Image::getZoom | ( | ) | const |
bool eq::Image::hasAlpha | ( | ) | const |
bool eq::Image::hasAsyncReadback | ( | const Frame::Buffer | buffer | ) | const |
bool eq::Image::hasAsyncReadback | ( | ) | const |
bool eq::Image::hasPixelData | ( | const Frame::Buffer | buffer | ) | const |
bool eq::Image::hasTextureData | ( | const Frame::Buffer | buffer | ) | const |
bool eq::Image::readback | ( | const uint32_t | buffers, |
const PixelViewport & | pvp, | ||
const Zoom & | zoom, | ||
ObjectManager * | glObjects | ||
) |
Read back an image from the frame buffer.
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. |
bool eq::Image::readImage | ( | const std::string & | filename, |
const Frame::Buffer | buffer | ||
) |
Read pixel data from an uncompressed rgb image file.
void eq::Image::reset | ( | ) |
Reset the image to its default state.
This method does not free allocated memory or plugins. Invalidates all pixel data.
void eq::Image::resetPlugins | ( | ) |
Deallocate all transfer and compression plugins.
Requires the OpenGL context used during readback to be current.
void eq::Image::setAlphaUsage | ( | const bool | enabled | ) |
Set alpha data preservation during download and compression.
void eq::Image::setInternalFormat | ( | const Frame::Buffer | buffer, |
const uint32_t | internalFormat | ||
) |
Set the internal format for the given buffer.
The internal format descibes the format of the pixel data source, typically an OpenGL frame buffer or texture. The internal formats used by Equalizer use the same numerical value as their OpenGL counterpart.
buffer | the frame buffer attachment. |
internalFormat | the internal format. |
void eq::Image::setPixelData | ( | const Frame::Buffer | buffer, |
const PixelData & | data | ||
) |
Set the pixel data of the given image buffer.
Previous data for the buffer is overwritten. Validates the buffer. Depending on the given PixelData parameters, the pixel data is copied, decompressed or cleared.
buffer | the image buffer to set. |
data | the pixel data. |
void eq::Image::setPixelViewport | ( | const PixelViewport & | pvp | ) |
Set the internal pixel viewport of the image.
The image pixel data and textures will be invalidated. The pixel data describes the size of the image on the destination (GPU). Each downloaded buffer has its own size, which is potentially different from the image PVP.
pvp | the pixel viewport. |
void eq::Image::setQuality | ( | const Frame::Buffer | buffer, |
const float | quality | ||
) |
Set the minimum quality after a full download-compression path.
The automatic selection of a download and compression plugin will never always choose plugins which maintain at least the given quality. A quality of 1.0 enables a lossless transmission path, and a quality of 0.0 disables all quality quarantees.
buffer | the frame buffer attachment. |
quality | the minimum quality to maintain. |
void eq::Image::setStorageType | ( | const Frame::Type | type | ) |
Set the frame pixel storage type.
Images of storage type TYPE_MEMORY are read back from the frame buffer into main memory using a transfer plugin. 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().
void eq::Image::setZoom | ( | const Zoom & | zoom | ) |
Sets the zoom factor to be used for compositing.
bool eq::Image::startReadback | ( | const uint32_t | buffers, |
const PixelViewport & | pvp, | ||
const Zoom & | zoom, | ||
ObjectManager * | glObjects | ||
) |
Start reading back an image from the frame buffer.
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. |
bool eq::Image::upload | ( | const Frame::Buffer | buffer, |
util::Texture * | texture, | ||
const Vector2i & | position, | ||
ObjectManager * | glObjects | ||
) | const |
Upload this image to the frame buffer or a texture.
If a texture is given, the upload is performed to it. Otherwise the pixel data is uploaded to the frame buffer. The texture will be initialized using the parameters corresponding to the requested buffer.
buffer | the buffer type. |
texture | the target texture, or 0 for frame buffer upload. |
position | the destination offset wrt current GL viewport. |
glObjects | the OpenGL object manager for the current context. |
void eq::Image::useCompressor | ( | const Frame::Buffer | buffer, |
const uint32_t | name | ||
) |
Set a compressor to be used during transmission of the image.
The default compressor is EQ_COMPRESSOR_AUTO which selects the most suitable compressor based on the current image and buffer parameters.
buffer | the frame buffer attachment. |
name | the compressor name |
void eq::Image::validatePixelData | ( | const Frame::Buffer | buffer | ) |
Allocate an image buffer without initialization.
bool eq::Image::writeImage | ( | const std::string & | filename, |
const Frame::Buffer | buffer | ||
) | const |
Write the pixel data as rgb image file.
bool eq::Image::writeImages | ( | const std::string & | filenameTemplate | ) | const |
Write all valid pixel data as separate images.