00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _SORASTERIMAGERW_
00027 #define _SORASTERIMAGERW_
00028
00029 #include <Inventor/nodes/SoNode.h>
00030 #include <Inventor/image/SoRasterImageIO.h>
00031 #include <Inventor/image/SbRasterImage.h>
00032 #include <Inventor/errors/SoDebugError.h>
00033 #include <Inventor/image/SoSubRasterImageRW.h>
00034 #include <Inventor/SbPImpl.h>
00035
00036 class SoRasterImageFile;
00037
00038 SO_PIMPL_BASE_PUBLIC_DECLARATION(SoRasterImageRW);
00039
00217 class SoRasterImageRW
00218 {
00219
00220 SO_IMAGE_RASTER_RW_ABSTRACT_HEADER()
00221 SO_PIMPL_BASE_PUBLIC_HEADER(SoRasterImageRW);
00222
00223 public:
00224
00226 enum WriteCapability {
00230 WRITE_SCANLINES,
00234 WRITE_FULL_IMAGE,
00238 WRITE_UNAVAILABLE
00239 };
00240
00242 enum ReadCapability {
00246 READ_AVAILABLE,
00250 READ_UNAVAILABLE
00251 };
00252
00254 enum OpenMode {
00258 OPEN_READ,
00262 OPEN_WRITE
00263 };
00264
00268 virtual ~SoRasterImageRW();
00269
00274 virtual SbBool open(SoRasterImageIO* rasterImageIO, OpenMode openMode);
00275
00279 virtual void close();
00280
00285 virtual SbBool checkRead( SoRasterImageFile* imageFile );
00286
00287
00294 virtual SbBool write(SbRasterImage* rasterImage, unsigned int xPos = 0, unsigned int yPos = 0) = 0;
00295
00302 virtual SbBool writeHeader( const SbVec2i32& size );
00303
00304 #if 1 SoDEPRECATED
00313 virtual SbBool writeHeader( SbVec2i32& size );
00314 #endif
00320 virtual SbBool writeFooter();
00321
00322
00330 virtual SbBool read(SbRasterImage* rasterImage, SbBool infoOnly = FALSE) = 0;
00331
00332
00342 virtual SbBool readRegion(SbRasterImage* rasterImage, const SbBox2i32& region);
00343
00344
00352 virtual SbString* getSuffixes(int& numSuffixes) const;
00353
00354
00361 virtual SbBool isMultipleBufferInverted() const;
00362
00363
00368 virtual SoRasterImageRW::WriteCapability getWriteCapability() const;
00369
00370
00375 virtual SoRasterImageRW::ReadCapability getReadCapability() const;
00376
00377
00382 virtual void enableMultipleWriting(SbBool state);
00383
00384
00388 virtual SbBool isMultipleWritingEnabled() const;
00389
00390 #if 1 SoDEPRECATED
00400 virtual SbBool writeHeader(SbVec2s& size);
00401
00402 #endif
00404 private:
00405
00411 virtual SbBool getImagesNumber(size_t& imagesNumber);
00412
00413
00419 virtual SbBool read(SbRasterImage* rasterImage, size_t imageIndex, SbBool infoOnly = FALSE);
00420
00421
00430 virtual SbBool readRegion(SbRasterImage* rasterImage, size_t imageIndex, const SbBox2i32& region);
00431
00438 virtual SbVec3f getOrigin(const size_t& imageId);
00439
00445 virtual SbVec2f getPixelSize(const size_t& imageId);
00446
00452 virtual float getThickness(const size_t& imageId);
00453
00459 virtual SbVec3f getX(const size_t& imageId);
00460
00466 virtual SbVec3f getY(const size_t& imageId);
00467
00474 virtual SbVec3f getZ(const size_t& imageId);
00475
00477 virtual bool supportsAlpha() const;
00478
00483 static bool write(const SbString& filename, const SbRasterImage& rasterImage);
00484
00485 private:
00486
00487
00488 virtual void createSuffixList() = 0;
00489 SoRasterImageRW();
00490
00491 SoRasterImageIO* m_rasterImageIO;
00492 SbBool m_multipleWriting;
00493 SbVec2i32 m_rasterSize;
00494 unsigned int m_multipleWritingNumComponents;
00495 SbBool m_firstMultipleImages;
00496
00497 SbString* m_suffixes;
00498 int m_numSuffixes;
00499 };
00500
00501 #endif
00502