⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qtimportexport.h

📁 最新osg包
💻 H
字号:
/* *  QTImportExport.h *  cefix * *  Created by Stephan Huber on 07.02.08. *  Copyright 2008 StephanMaximilianHuber, digitalmind. All rights reserved. * */#include <osg/Image>#ifndef QT_IMPORT_EXPORT_HEADER#define QT_IMPORT_EXPORT_HEADER/** small helper class handling the im- and export of image data via quicktime */class QuicktimeImportExport {    public:        /** ctor */        QuicktimeImportExport();                /** readFromString tries to read a chunk of bytes and interpret it as an image.          *  @param istream the input stream         *  @param fileTypeHint you can speed up the conversion by providing a filename with extension, so quicktime has not to guess the image's type         *  @param sizeHint useful, if you are streaming data, if you provide a sizeHint ony sizeHint bytes are read from the stream         */        osg::Image* readFromStream(std::istream & inStream, const std::string& fileTypeHint, long sizeHint = 0);                /** writes an osg::Image to a stream, using fileTypeHint as a hint whar format you want to write. */        void writeToStream(std::ostream& outStream, osg::Image* image, const std::string& fileTypeHint) ;                /** get the last error-message */        const std::string getLastErrorString() { return _lastError; }                /** return true if no error occured */        bool success() { return (_error == false); }        protected:                /** flips an image */        void flipImage(unsigned char* buffer, int bytesPerPixel, unsigned int width, unsigned height);                /** do some swizzling, so osg can use the image */        unsigned char* pepareBufferForOSG(unsigned char * buffer, int bytesPerPixel, unsigned int width, unsigned height);                /** do some swizzling, so quicktime can use the image */        unsigned char* prepareBufferForQuicktime(unsigned char* buffer, GLenum pixelFormat, int bytesPerPixel, unsigned int width, unsigned int height)  ;                /** sets an error-msg */        void setError(const std::string& msg) { _lastError = msg; _error = true; }                 /** do the import */        osg::Image* doImport(unsigned char* buffer, unsigned int dataSize, const std::string& fileTypeHint);                      private:        bool            _error;        std::string _lastError;};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -