Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoRasterImageRW.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : C. OGNIER (Jun 2003)
22**=======================================================================*/
23
24
25
26#ifndef _SORASTERIMAGERW_
27#define _SORASTERIMAGERW_
28
29#include <Inventor/nodes/SoNode.h>
30#include <Inventor/image/SoRasterImageIO.h>
31#include <Inventor/image/SbRasterImage.h>
32#include <Inventor/errors/SoDebugError.h>
33#include <Inventor/image/SoSubRasterImageRW.h>
34#include <Inventor/SbPImpl.h>
35
36class SoRasterImageFile; // FORWARD
37
38SO_PIMPL_BASE_PUBLIC_DECLARATION(SoRasterImageRW);
39
215{
216
217 SO_IMAGE_RASTER_RW_ABSTRACT_HEADER()
218 SO_PIMPL_BASE_PUBLIC_HEADER(SoRasterImageRW);
219
220public:
221
237
249
261
266
271 virtual SbBool open(SoRasterImageIO* rasterImageIO, OpenMode openMode);
272
276 virtual void close();
277
282 virtual SbBool checkRead( SoRasterImageFile* imageFile );
283
284
291 virtual SbBool write(SbRasterImage* rasterImage, unsigned int xPos = 0, unsigned int yPos = 0) = 0;
292
299 virtual SbBool writeHeader( const SbVec2i32& size );
300
301#if 1 SoDEPRECATED
310 virtual SbBool writeHeader( SbVec2i32& size );
311#endif
318
319
327 virtual SbBool read(SbRasterImage* rasterImage, SbBool infoOnly = FALSE) = 0;
328
329
339 virtual SbBool readRegion(SbRasterImage* rasterImage, const SbBox2i32& region);
340
341
349 virtual SbString* getSuffixes(int& numSuffixes) const;
350
351
359
360
366
367
373
374
379 virtual void enableMultipleWriting(SbBool state);
380
381
386
387#if 1 SoDEPRECATED
397 virtual SbBool writeHeader(SbVec2s& size);
398
399#endif
401private:
402
408 virtual SbBool getImagesNumber(size_t& imagesNumber);
409
410
416 virtual SbBool read(SbRasterImage* rasterImage, size_t imageIndex, SbBool infoOnly = FALSE);
417
418
427 virtual SbBool readRegion(SbRasterImage* rasterImage, size_t imageIndex, const SbBox2i32& region);
428
435 virtual SbVec3f getOrigin(const size_t& imageId);
436
442 virtual SbVec2f getPixelSize(const size_t& imageId);
443
449 virtual float getThickness(const size_t& imageId);
450
456 virtual SbVec3f getX(const size_t& imageId);
457
463 virtual SbVec3f getY(const size_t& imageId);
464
471 virtual SbVec3f getZ(const size_t& imageId);
472
474 virtual bool supportsAlpha() const;
475
480 static bool write(const SbString& filename, const SbRasterImage& rasterImage);
481
482private:
483
484 // This method must fill m_suffixes and update m_numSuffixes
485 virtual void createSuffixList() = 0;
487
488 SoRasterImageIO* m_rasterImageIO;
489 SbBool m_multipleWriting;
490 SbVec2i32 m_rasterSize;
491 unsigned int m_multipleWritingNumComponents;
492 SbBool m_firstMultipleImages;
493
494 SbString* m_suffixes;
495 int m_numSuffixes;
496};
497
498#endif
2D box class.
Definition SbBox.h:2383
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class encapsulat...
Class for smart character strings.
Definition SbString.h:202
2D vector class.
Definition SbVec.h:76
2D vector class.
Definition SbVec.h:517
2D vector class.
Definition SbVec.h:700
3D vector class.
Definition SbVec.h:932
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class for raster...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
virtual SoRasterImageRW::ReadCapability getReadCapability() const
Returns the read capability of the raster format.
virtual SoDEPRECATED SbBool writeHeader(SbVec2i32 &size)
Writes and encodes the header for this specific format.
ReadCapability
Read Capability enumeration values.
@ READ_UNAVAILABLE
No reading available.
@ READ_AVAILABLE
Read functionality available.
virtual SbBool read(SbRasterImage *rasterImage, SbBool infoOnly=FALSE)=0
Read the current open image into rasterImage.
virtual SbBool isMultipleWritingEnabled() const
Returns TRUE if multiple buffer writing is enabled.
OpenMode
open Mode enumeration values.
@ OPEN_READ
Opened for reading.
@ OPEN_WRITE
Opened for writing.
virtual SoDEPRECATED SbBool writeHeader(SbVec2s &size)
Writes and encodes the header for this specific format.
WriteCapability
Write Capability enumeration values.
@ WRITE_FULL_IMAGE
Can only write a complete image.
@ WRITE_SCANLINES
Can write an image incrementally (e.g., by scan-line).
@ WRITE_UNAVAILABLE
No writing available.
virtual SoRasterImageRW::WriteCapability getWriteCapability() const
Returns the write capability of the raster format.
virtual SbBool open(SoRasterImageIO *rasterImageIO, OpenMode openMode)
Opens the reader/writer in the specified open mode.
virtual void close()
Closes the reader/writer.
virtual ~SoRasterImageRW()
Destructor.
virtual SbBool readRegion(SbRasterImage *rasterImage, const SbBox2i32 &region)
Read the specified region of current open image into rasterImage.
virtual SbBool writeHeader(const SbVec2i32 &size)
Writes and encodes the header for this specific format.
virtual SbBool checkRead(SoRasterImageFile *imageFile)
Checks if the specified file can be read.
virtual void enableMultipleWriting(SbBool state)
Enable writing image with multiple calls to write method.
virtual SbBool isMultipleBufferInverted() const
Returns the write order when using multiple buffers.
virtual SbBool write(SbRasterImage *rasterImage, unsigned int xPos=0, unsigned int yPos=0)=0
Writes and encodes the given data in the specific format.
virtual SbBool writeFooter()
Writes and encodes the footer for this specific format.
virtual SbString * getSuffixes(int &numSuffixes) const
Returns the list of file suffixes supported.
int SbBool
Boolean type.
Definition SbBase.h:87