- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/tga/ReaderWriterTGA.cpp
r12912 r13041 469 469 { 470 470 public: 471 471 472 472 ReaderWriterTGA() 473 473 { 474 474 supportsExtension("tga","Tga Image format"); 475 475 } 476 476 477 477 virtual const char* className() const { return "TGA Image Reader"; } 478 478 … … 543 543 return rr; 544 544 } 545 545 546 546 bool saveTGAStream(const osg::Image& image, std::ostream& fout) const 547 547 { … … 556 556 int numPerPixel = image.computeNumComponents(pixelFormat); 557 557 int pixelMultiplier = (image.getDataType()==GL_FLOAT ? 255 : 1); 558 558 559 559 // Headers 560 560 fout.put(0); // Identification field size … … 570 570 fout.put(numPerPixel * 8); // Image pixel size 571 571 fout.put(0); // Image descriptor 572 572 573 573 // Swap red/blue channels for BGR images 574 574 int r = 0, g = 1, b = 2; … … 603 603 return true; 604 604 } 605 605 606 606 virtual WriteResult writeImage(const osg::Image& image, std::ostream& fout, const Options*) const 607 607 { … … 611 611 return WriteResult::ERROR_IN_WRITING_FILE; 612 612 } 613 613 614 614 virtual WriteResult writeImage(const osg::Image& image, const std::string& fileName, const Options* options) const 615 615 { 616 616 std::string ext = osgDB::getFileExtension(fileName); 617 617 if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 618 618 619 619 osgDB::ofstream fout(fileName.c_str(), std::ios::out | std::ios::binary); 620 620 if (!fout) return WriteResult::ERROR_IN_WRITING_FILE;
