From adbc15b5a1b96dc4ef12a8841f2db40cdf07a841 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 25 Feb 2008 13:25:42 +0000 Subject: [PATCH] From Glenn Waldron, "As you may recall, we discussed adding ReaderWriter::readObject() overrides to all the image plugins in order to facilitate future archive support. Attached are the necessary modifications. I tested JPEG, but not all the others... the code is identical though. Note that the DDS plugin already contained the readObject() implementations." --- src/osgPlugins/bmp/ReaderWriterBMP.cpp | 10 ++++++++++ src/osgPlugins/gif/ReaderWriterGIF.cpp | 10 ++++++++++ src/osgPlugins/jpeg/ReaderWriterJPEG.cpp | 10 ++++++++++ src/osgPlugins/pic/ReaderWriterPIC.cpp | 5 +++++ src/osgPlugins/png/ReaderWriterPNG.cpp | 10 ++++++++++ src/osgPlugins/rgb/ReaderWriterRGB.cpp | 10 ++++++++++ src/osgPlugins/tga/ReaderWriterTGA.cpp | 10 ++++++++++ src/osgPlugins/tiff/ReaderWriterTIFF.cpp | 10 ++++++++++ 8 files changed, 75 insertions(+) diff --git a/src/osgPlugins/bmp/ReaderWriterBMP.cpp b/src/osgPlugins/bmp/ReaderWriterBMP.cpp index 88c053dda..763b29444 100644 --- a/src/osgPlugins/bmp/ReaderWriterBMP.cpp +++ b/src/osgPlugins/bmp/ReaderWriterBMP.cpp @@ -354,6 +354,16 @@ class ReaderWriterBMP : public osgDB::ReaderWriter return pOsgImage; } + virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(fin, options); + } + + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(file, options); + } + virtual ReadResult readImage(std::istream& fin,const Options* =NULL) const { return readBMPStream(fin); diff --git a/src/osgPlugins/gif/ReaderWriterGIF.cpp b/src/osgPlugins/gif/ReaderWriterGIF.cpp index 81bd27643..6e7fa93b1 100644 --- a/src/osgPlugins/gif/ReaderWriterGIF.cpp +++ b/src/osgPlugins/gif/ReaderWriterGIF.cpp @@ -375,6 +375,16 @@ class ReaderWriterGIF : public osgDB::ReaderWriter return pOsgImage; } + virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(fin, options); + } + + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(file, options); + } + virtual ReadResult readImage(std::istream& fin,const osgDB::ReaderWriter::Options* =NULL) const { return readGIFStream(fin); diff --git a/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp b/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp index b3f12b30a..a4cf5d3ea 100644 --- a/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp +++ b/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp @@ -784,6 +784,16 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter return pOsgImage; } + virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(fin, options); + } + + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(file, options); + } + virtual ReadResult readImage(std::istream& fin,const osgDB::ReaderWriter::Options* =NULL) const { return readJPGStream(fin); diff --git a/src/osgPlugins/pic/ReaderWriterPIC.cpp b/src/osgPlugins/pic/ReaderWriterPIC.cpp index e39796645..47583bb3b 100644 --- a/src/osgPlugins/pic/ReaderWriterPIC.cpp +++ b/src/osgPlugins/pic/ReaderWriterPIC.cpp @@ -194,6 +194,11 @@ class ReaderWriterPIC : public osgDB::ReaderWriter virtual const char* className() const { return "PIC Image Reader"; } virtual bool acceptsExtension(const std::string& extension) const { return osgDB::equalCaseInsensitive(extension,"pic"); } + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(file, options); + } + virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(file); diff --git a/src/osgPlugins/png/ReaderWriterPNG.cpp b/src/osgPlugins/png/ReaderWriterPNG.cpp index 9278f6225..26c9b47cd 100644 --- a/src/osgPlugins/png/ReaderWriterPNG.cpp +++ b/src/osgPlugins/png/ReaderWriterPNG.cpp @@ -281,6 +281,16 @@ class ReaderWriterPNG : public osgDB::ReaderWriter return Z_DEFAULT_COMPRESSION; } + virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(fin, options); + } + + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(file, options); + } + virtual ReadResult readImage(std::istream& fin,const Options* =NULL) const { return readPNGStream(fin); diff --git a/src/osgPlugins/rgb/ReaderWriterRGB.cpp b/src/osgPlugins/rgb/ReaderWriterRGB.cpp index 1d5f154e8..77af41920 100644 --- a/src/osgPlugins/rgb/ReaderWriterRGB.cpp +++ b/src/osgPlugins/rgb/ReaderWriterRGB.cpp @@ -497,6 +497,16 @@ class ReaderWriterRGB : public osgDB::ReaderWriter return image; } + virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(fin, options); + } + + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(file, options); + } + virtual ReadResult readImage(std::istream& fin,const osgDB::ReaderWriter::Options* =NULL) const { return readRGBStream(fin); diff --git a/src/osgPlugins/tga/ReaderWriterTGA.cpp b/src/osgPlugins/tga/ReaderWriterTGA.cpp index f613c0dac..6aceb7069 100644 --- a/src/osgPlugins/tga/ReaderWriterTGA.cpp +++ b/src/osgPlugins/tga/ReaderWriterTGA.cpp @@ -507,6 +507,16 @@ class ReaderWriterTGA : public osgDB::ReaderWriter } + virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(fin, options); + } + + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(file, options); + } + virtual ReadResult readImage(std::istream& fin,const Options* =NULL) const { return readTGAStream(fin); diff --git a/src/osgPlugins/tiff/ReaderWriterTIFF.cpp b/src/osgPlugins/tiff/ReaderWriterTIFF.cpp index 2ef2acdfd..295f6c2b9 100644 --- a/src/osgPlugins/tiff/ReaderWriterTIFF.cpp +++ b/src/osgPlugins/tiff/ReaderWriterTIFF.cpp @@ -751,6 +751,16 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter return WriteResult::FILE_SAVED; } + virtual ReadResult readObject(std::istream& fin,const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(fin, options); + } + + virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options =NULL) const + { + return readImage(file, options); + } + virtual ReadResult readImage(std::istream& fin,const osgDB::ReaderWriter::Options* =NULL) const { return readTIFStream(fin);