fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Image / FileIO / OSGITFImageFileType.h
blobc59c6bd0572042092ab1e5f6ef63b76ee9e5cc4e
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGITFIMAGEFILETYPE_H_
40 #define _OSGITFIMAGEFILETYPE_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGImageFileIODef.h"
46 #include "OSGImageFileType.h"
47 #include "OSGRectangle.h"
49 #include "boost/shared_ptr.hpp"
52 OSG_BEGIN_NAMESPACE
54 class ITFImageFileType;
56 /*! \ingroup GrpImageFileIOITF
57 \ingroup GrpLibOSGImageFileIO
60 class OSG_IMGFILEIO_DLLMAPPING TiledImageBlockAccessor :
61 public ImageBlockAccessor
64 /*========================== PUBLIC =================================*/
66 public:
68 typedef ImageBlockAccessor Inherited;
70 /*---------------------------------------------------------------------*/
71 /*! \name Destructor */
72 /*! \{ */
74 virtual ~TiledImageBlockAccessor(void);
76 /*! \} */
77 /*---------------------------------------------------------------------*/
78 /*! \name Read/Write */
79 /*! \{ */
81 virtual bool isOpen(void);
83 /*! \} */
84 /*---------------------------------------------------------------------*/
85 /*! \name Read/Write */
86 /*! \{ */
88 virtual bool readBlockA16(Vec2i vSampleOrigin,
89 Int32 iTextureSize,
90 UInt16 *pTarget,
91 Int32 iTargetSizeBytes);
93 virtual bool readBlockA16(Vec2i vSampleOrigin,
94 Int32 iTextureSize,
95 Int16 *pTarget,
96 Int32 iTargetSizeBytes);
98 /*! \} */
99 /*========================= PROTECTED ===============================*/
101 protected:
103 UInt32 _uiRows;
104 UInt32 _uiColumns;
106 std::vector<ImageBlockAccessorPtr> _vImages;
107 std::vector<Rectangle2i> _vSampleDescs;
109 std::vector<Int16> _vI16Buffer;
111 /*---------------------------------------------------------------------*/
112 /*! \name Default Constructor */
113 /*! \{ */
115 TiledImageBlockAccessor(void);
117 /*! \} */
118 /*---------------------------------------------------------------------*/
119 /*! \name Read/Write */
120 /*! \{ */
122 void open(const Char8 *szFilename);
124 /*! \} */
125 /*---------------------------------------------------------------------*/
126 /*! \name Read/Write */
127 /*! \{ */
129 bool read2HBlocksA16(Int32 iLow,
130 Int32 iHeigh,
131 Vec2i vSampleOrigin,
132 Int32 iTextureSize,
133 Int16 *pTarget,
134 Int32 iTargetSizeBytes);
136 bool read2VBlocksA16(Int32 iLow,
137 Int32 iHeigh,
138 Vec2i vSampleOrigin,
139 Int32 iTextureSize,
140 Int16 *pTarget,
141 Int32 iTargetSizeBytes);
143 bool read4BlocksA16 (Int32 iLow,
144 Int32 iHeigh,
145 Vec2i vSampleOrigin,
146 Int32 iTextureSize,
147 Int16 *pTarget,
148 Int32 iTargetSizeBytes);
150 /*! \} */
151 /*========================== PRIVATE ================================*/
153 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 =================================*/
171 public:
173 typedef ImageBlockAccessor Inherited;
175 /*---------------------------------------------------------------------*/
176 /*! \name Destructor */
177 /*! \{ */
179 virtual ~DefaultBlockAccessor(void);
181 /*! \} */
182 /*---------------------------------------------------------------------*/
183 /*! \name Read/Write */
184 /*! \{ */
186 virtual bool isOpen(void);
188 /*! \} */
189 /*---------------------------------------------------------------------*/
190 /*! \name Read/Write */
191 /*! \{ */
193 /*! \} */
194 /*---------------------------------------------------------------------*/
195 /*! \name Read/Write */
196 /*! \{ */
198 /*! \} */
199 /*---------------------------------------------------------------------*/
200 /*! \name Read/Write */
201 /*! \{ */
203 virtual bool readBlockA16(Vec2i vSampleOrigin,
204 Int32 iTextureSize,
205 UInt16 *pTarget,
206 Int32 iTargetSizeBytes);
208 virtual bool readBlockA16(Vec2i vSampleOrigin,
209 Int32 iTextureSize,
210 Int16 *pTarget,
211 Int32 iTargetSizeBytes);
213 /*! \} */
214 /*========================= PROTECTED ===============================*/
216 protected:
218 Int32 _iDefaultValue;
220 /*---------------------------------------------------------------------*/
221 /*! \name Default Constructor */
222 /*! \{ */
224 DefaultBlockAccessor(void);
226 /*! \} */
227 /*---------------------------------------------------------------------*/
228 /*! \name Read/Write */
229 /*! \{ */
231 void open(const Char8 *szFilename);
233 /*! \} */
234 /*========================== PRIVATE ================================*/
236 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 =================================*/
258 public:
260 /*---------------------------------------------------------------------*/
261 /*! \name Destructor */
262 /*! \{ */
264 virtual ~ITFImageFileType(void);
266 /*! \} */
267 /*---------------------------------------------------------------------*/
268 /*! \name Read/Write */
269 /*! \{ */
271 virtual bool validateHeader(const Char8 *fileName,
272 bool &implemented);
274 /*! \} */
275 /*---------------------------------------------------------------------*/
276 /*! \name Type */
277 /*! \{ */
279 virtual ImageBlockAccessorPtr open(const Char8 *fileName);
281 /*! \} */
282 /*========================= PROTECTED ===============================*/
284 protected:
286 /*---------------------------------------------------------------------*/
287 /*! \name Default Constructor */
288 /*! \{ */
290 ITFImageFileType (const Char8 *mimeType,
291 const Char8 *suffixArray[],
292 UInt16 suffixByteCount,
293 UInt32 flags );
295 /*! \} */
296 /*---------------------------------------------------------------------*/
297 /*! \name Copy Op */
298 /*! \{ */
300 ITFImageFileType (const ITFImageFileType &obj);
301 const ITFImageFileType &operator =(const ITFImageFileType &obj);
303 /*! \} */
304 /*========================== PRIVATE ================================*/
306 private:
308 typedef ImageFileType Inherited;
310 static ITFImageFileType _the;
313 typedef ITFImageFileType *ITFImageFileTypeP;
315 OSG_END_NAMESPACE
317 #endif // _OSGITFIMAGEFILETYPE_H_