1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGITFIMAGEFILETYPE_H_
40 #define _OSGITFIMAGEFILETYPE_H_
45 #include "OSGImageFileIODef.h"
46 #include "OSGImageFileType.h"
47 #include "OSGRectangle.h"
49 #include "boost/shared_ptr.hpp"
54 class ITFImageFileType
;
56 /*! \ingroup GrpImageFileIOITF
57 \ingroup GrpLibOSGImageFileIO
60 class OSG_IMGFILEIO_DLLMAPPING TiledImageBlockAccessor
:
61 public ImageBlockAccessor
64 /*========================== PUBLIC =================================*/
68 typedef ImageBlockAccessor Inherited
;
70 /*---------------------------------------------------------------------*/
71 /*! \name Destructor */
74 virtual ~TiledImageBlockAccessor(void);
77 /*---------------------------------------------------------------------*/
78 /*! \name Read/Write */
81 virtual bool isOpen(void);
84 /*---------------------------------------------------------------------*/
85 /*! \name Read/Write */
88 virtual bool readBlockA16(Vec2i vSampleOrigin
,
91 Int32 iTargetSizeBytes
);
93 virtual bool readBlockA16(Vec2i vSampleOrigin
,
96 Int32 iTargetSizeBytes
);
99 /*========================= PROTECTED ===============================*/
106 std::vector
<ImageBlockAccessorPtr
> _vImages
;
107 std::vector
<Rectangle2i
> _vSampleDescs
;
109 std::vector
<Int16
> _vI16Buffer
;
111 /*---------------------------------------------------------------------*/
112 /*! \name Default Constructor */
115 TiledImageBlockAccessor(void);
118 /*---------------------------------------------------------------------*/
119 /*! \name Read/Write */
122 void open(const Char8
*szFilename
);
125 /*---------------------------------------------------------------------*/
126 /*! \name Read/Write */
129 bool read2HBlocksA16(Int32 iLow
,
134 Int32 iTargetSizeBytes
);
136 bool read2VBlocksA16(Int32 iLow
,
141 Int32 iTargetSizeBytes
);
143 bool read4BlocksA16 (Int32 iLow
,
148 Int32 iTargetSizeBytes
);
151 /*========================== PRIVATE ================================*/
155 friend class ITFImageFileType
;
158 /*! \ingroup GrpImageFileIOITF
161 typedef boost::shared_ptr
<TiledImageBlockAccessor
> TiledImageBlockAccessorPtr
;
163 /*! \ingroup GrpImageFileIOITF
164 \ingroup GrpLibOSGImageFileIO
167 class OSG_IMGFILEIO_DLLMAPPING DefaultBlockAccessor
: public ImageBlockAccessor
169 /*========================== PUBLIC =================================*/
173 typedef ImageBlockAccessor Inherited
;
175 /*---------------------------------------------------------------------*/
176 /*! \name Destructor */
179 virtual ~DefaultBlockAccessor(void);
182 /*---------------------------------------------------------------------*/
183 /*! \name Read/Write */
186 virtual bool isOpen(void);
189 /*---------------------------------------------------------------------*/
190 /*! \name Read/Write */
194 /*---------------------------------------------------------------------*/
195 /*! \name Read/Write */
199 /*---------------------------------------------------------------------*/
200 /*! \name Read/Write */
203 virtual bool readBlockA16(Vec2i vSampleOrigin
,
206 Int32 iTargetSizeBytes
);
208 virtual bool readBlockA16(Vec2i vSampleOrigin
,
211 Int32 iTargetSizeBytes
);
214 /*========================= PROTECTED ===============================*/
218 Int32 _iDefaultValue
;
220 /*---------------------------------------------------------------------*/
221 /*! \name Default Constructor */
224 DefaultBlockAccessor(void);
227 /*---------------------------------------------------------------------*/
228 /*! \name Read/Write */
231 void open(const Char8
*szFilename
);
234 /*========================== PRIVATE ================================*/
238 friend class TiledImageBlockAccessor
;
241 /*! \ingroup GrpImageFileIOITF
244 typedef boost::shared_ptr
<DefaultBlockAccessor
> DefaultBlockAccessorPtr
;
247 /*! \brief ITF File Handler. Used to read/write TIFF files.
248 See \ref PageSystemImage for a detailed description.
250 \ingroup GrpImageFileIOITF
251 \ingroup GrpLibOSGImageFileIO
254 class OSG_IMGFILEIO_DLLMAPPING ITFImageFileType
: public ImageFileType
256 /*========================== PUBLIC =================================*/
260 /*---------------------------------------------------------------------*/
261 /*! \name Destructor */
264 virtual ~ITFImageFileType(void);
267 /*---------------------------------------------------------------------*/
268 /*! \name Read/Write */
271 virtual bool validateHeader(const Char8
*fileName
,
275 /*---------------------------------------------------------------------*/
279 virtual ImageBlockAccessorPtr
open(const Char8
*fileName
);
282 /*========================= PROTECTED ===============================*/
286 /*---------------------------------------------------------------------*/
287 /*! \name Default Constructor */
290 ITFImageFileType (const Char8
*mimeType
,
291 const Char8
*suffixArray
[],
292 UInt16 suffixByteCount
,
296 /*---------------------------------------------------------------------*/
300 ITFImageFileType (const ITFImageFileType
&obj
);
301 const ITFImageFileType
&operator =(const ITFImageFileType
&obj
);
304 /*========================== PRIVATE ================================*/
308 typedef ImageFileType Inherited
;
310 static ITFImageFileType _the
;
313 typedef ITFImageFileType
*ITFImageFileTypeP
;
317 #endif // _OSGITFIMAGEFILETYPE_H_