Equalizer  1.4.1
image.h
00001 
00002 /* Copyright (c) 2006-2012, Stefan Eilemann <eile@equalizergraphics.com>
00003  *                    2010, Cedric Stalder <cedric.stalder@gmail.com>
00004  *
00005  * This library is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Lesser General Public License version 2.1 as published
00007  * by the Free Software Foundation.
00008  *
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00012  * details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this library; if not, write to the Free Software Foundation, Inc.,
00016  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00017  */
00018 
00019 #ifndef EQ_IMAGE_H
00020 #define EQ_IMAGE_H
00021 
00022 #include <eq/client/frame.h>         // for Frame::Buffer enum
00023 #include <eq/client/types.h>
00024 
00025 namespace eq
00026 {
00027 namespace detail { class Image; }
00028 
00034     class Image
00035     {
00036     public:
00038         EQ_API Image();
00039 
00041         EQ_API virtual ~Image();
00042 
00057         EQ_API void setInternalFormat( const Frame::Buffer buffer,
00058                                        const uint32_t internalFormat );
00059 
00061         EQ_API uint32_t getInternalFormat( const Frame::Buffer buffer )const;
00062 
00075         EQ_API uint32_t getExternalFormat( const Frame::Buffer buffer ) const;
00076 
00084         EQ_API uint32_t getPixelSize( const Frame::Buffer buffer ) const;
00085 
00091         EQ_API bool hasAlpha() const;
00092 
00104         EQ_API void setStorageType( const Frame::Type type );
00105 
00107         EQ_API Frame::Type getStorageType() const;
00108 
00120         EQ_API void setPixelViewport( const PixelViewport& pvp );
00121 
00123         EQ_API const PixelViewport& getPixelViewport() const;
00124 
00126         EQ_API void setZoom( const Zoom& zoom );
00127 
00129         EQ_API const Zoom& getZoom() const;
00130 
00140         EQ_API void useCompressor( const Frame::Buffer buffer,
00141                                    const uint32_t name );
00142 
00152         EQ_API void reset();
00153 
00155         EQ_API void flush();
00156 
00163         EQ_API void deleteGLObjects( ObjectManager* om );
00164 
00171         EQ_API void resetPlugins();
00173 
00177         EQ_API const uint8_t* getPixelPointer( const Frame::Buffer buffer )
00178             const;
00179 
00181         EQ_API uint8_t* getPixelPointer( const Frame::Buffer buffer );
00182 
00184         EQ_API uint32_t getPixelDataSize( const Frame::Buffer buffer ) const;
00185 
00187         EQ_API const PixelData& getPixelData( const Frame::Buffer ) const;
00188 
00190         EQ_API const PixelData& compressPixelData( const Frame::Buffer );
00191 
00196         EQ_API bool hasPixelData( const Frame::Buffer buffer ) const;
00197 
00202         EQ_API bool hasAsyncReadback( const Frame::Buffer buffer ) const;
00203 
00208         EQ_API bool hasAsyncReadback() const;
00209 
00220         EQ_API void clearPixelData( const Frame::Buffer buffer );
00221 
00223         EQ_API void validatePixelData( const Frame::Buffer buffer );
00224 
00236         EQ_API void setPixelData( const Frame::Buffer buffer,
00237                                      const PixelData& data );
00238 
00243         EQ_API void setAlphaUsage( const bool enabled );
00244 
00246         EQ_API bool getAlphaUsage() const;
00247 
00260         EQ_API void setQuality( const Frame::Buffer buffer,
00261                                 const float quality );
00262 
00264         EQ_API float getQuality( const Frame::Buffer buffer ) const;
00266 
00270         EQ_API const util::Texture& getTexture( const Frame::Buffer buffer )
00271             const;
00272 
00277         EQ_API bool hasTextureData( const Frame::Buffer buffer ) const;
00279 
00282 #ifndef EQ_2_0_API
00283 
00294         EQ_API bool readback( const uint32_t buffers, const PixelViewport& pvp,
00295                               const Zoom& zoom, ObjectManager* glObjects );
00296 #endif
00297 
00308         EQ_API bool startReadback( const uint32_t buffers,
00309                                    const PixelViewport& pvp, const Zoom& zoom,
00310                                    ObjectManager* glObjects );
00311 
00313         bool startReadback( const Frame::Buffer buffer,
00314                             const util::Texture* texture,
00315                             const GLEWContext* glewContext );
00316 
00324         EQ_API void finishReadback( const Zoom& zoom,
00325                                     const GLEWContext* glewContext );
00326 
00342         EQ_API bool upload( const Frame::Buffer buffer, util::Texture* texture,
00343                             const Vector2i& position,
00344                             ObjectManager* glObjects ) const;
00345 
00347         EQ_API bool writeImage( const std::string& filename,
00348                                    const Frame::Buffer buffer ) const;
00349 
00351         EQ_API bool writeImages( const std::string& filenameTemplate ) const;
00352 
00354         EQ_API bool readImage( const std::string& filename,
00355                                const Frame::Buffer buffer );
00356 
00358         void setOffset( int32_t x, int32_t y );
00360 
00367         EQ_API std::vector< uint32_t >
00368         findCompressors( const Frame::Buffer buffer ) const;
00369 
00374         EQ_API std::vector< uint32_t >
00375         findTransferers( const Frame::Buffer buffer, const GLEWContext* gl )
00376             const;
00377 
00379         EQ_API bool allocCompressor( const Frame::Buffer buffer,
00380                                      const uint32_t name );
00381 
00383         EQ_API bool allocDownloader( const Frame::Buffer buffer,
00384                                      const uint32_t name,
00385                                      const GLEWContext* glewContext );
00386 
00388         EQ_API uint32_t getDownloaderName( const Frame::Buffer buffer ) const;
00390 
00391     private:
00392         detail::Image* const _impl;
00393 
00395         uint32_t _chooseCompressor( const Frame::Buffer buffer ) const;
00396 
00397         co::CompressorInfos _findTransferers( const Frame::Buffer buffer,
00398                                               const GLEWContext* gl ) const;
00399 
00401         const void* _getBufferKey( const Frame::Buffer buffer ) const;
00402 
00404         const void* _getCompressorKey( const Frame::Buffer buffer ) const;
00405 
00416         void _setExternalFormat( const Frame::Buffer buffer,
00417                                  const uint32_t externalFormat,
00418                                  const uint32_t pixelSize,
00419                                  const bool hasAlpha );
00420 
00421         bool _readback( const Frame::Buffer buffer, const Zoom& zoom,
00422                         ObjectManager* glObjects );
00423 
00424         bool _startReadback( const Frame::Buffer buffer, const Zoom& zoom,
00425                              ObjectManager* glObjects );
00426 
00427         void _finishReadback( const Frame::Buffer buffer, const Zoom& zoom,
00428                               const GLEWContext* glewContext );
00429 
00430         bool _readbackZoom( const Frame::Buffer buffer, const Zoom& zoom,
00431                             ObjectManager* glObjects );
00432     };
00433 };
00434 #endif // EQ_IMAGE_H
Generated on Mon Nov 26 2012 14:41:49 for Equalizer 1.4.1 by  doxygen 1.7.6.1