Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

pltiffdecex.cpp

Go to the documentation of this file.
00001 /*
00002 |
00003 |      $Id: pltiffdecex.cpp,v 1.1 2004/05/21 21:02:53 maxx Exp $
00004 |      TIFF Decoder Class
00005 |
00006 |      Copyright (c) 1996-1998 Ulrich von Zadow
00007 |
00008 \--------------------------------------------------------------------
00009 */
00010 
00011 #include "plstdpch.h"
00012 #include "pltiffdec.h"
00013 #include "pltiffdecex.h"
00014 #include "plexcept.h"
00015 
00016 extern "C"
00017 {
00018 #include "tif_msrc.h"
00019 }
00020 
00021 
00023 // slightly more capable decoder...
00024 
00025 PLTIFFDecoderEx::PLTIFFDecoderEx() 
00026   : PLTIFFDecoder(),
00027     m_TiffToken(0)
00028 {}
00029 
00030 
00031 
00032 PLTIFFDecoderEx::~PLTIFFDecoderEx()
00033 {
00034   Dissociate();
00035 }
00036 
00037 
00038 bool PLTIFFDecoderEx::Associate( PLDataSource* pDataSrc )
00039 {
00040   m_TiffToken = TIFFOpenMem (pDataSrc->ReadEverything(),
00041                              pDataSrc->GetFileSize(),
00042                              NULL);
00043   return m_TiffToken != 0;
00044 }
00045 
00046 
00047 void PLTIFFDecoderEx::Dissociate()
00048 {
00049   if ( m_TiffToken )
00050   {
00051     TIFFClose( m_TiffToken );
00052     m_TiffToken = 0;
00053   }
00054 }
00055 
00056 
00057 void PLTIFFDecoderEx::DoDecode (PLBmp * pBmp,
00058                                PLDataSource * pDataSrc)
00059 {
00060   PLASSERT( m_TiffToken );
00061 
00062   // call base version on associated data source
00063   PLTIFFDecoder::DoTiffDecode(
00064     pBmp,
00065     pDataSrc,
00066     m_TiffToken
00067   );
00068 }
00069 
00070 // It'd be nicer to define a bunch of type-safe functions like:
00071 //    uint32  PLTIFFDecoderEx::GetImageLength();
00072 //    CString PLTIFFDecoderEx::GetImageDescription();
00073 int PLTIFFDecoderEx::GetField( int tag_id, ... )
00074 {
00075   va_list marker;
00076   int retv;
00077 
00078   va_start( marker, tag_id );     /* Initialize variable arguments. */
00079   retv = TIFFVGetFieldDefaulted( m_TiffToken, (ttag_t) tag_id, marker );
00080   va_end( marker );              /* Reset variable arguments.      */
00081 
00082   return retv;
00083 }
00084 
00085 /*
00086 /--------------------------------------------------------------------
00087 |
00088 |      $Log: pltiffdecex.cpp,v $
00089 |      Revision 1.1  2004/05/21 21:02:53  maxx
00090 |      Initial Version of vuVolume, moderatly changed to make it compile on my windows and linux machine.
00091 |
00092 |      Revision 1.1  2002/11/13 01:58:22  mspindle
00093 |      *** empty log message ***
00094 |
00095 |      Revision 1.2  2001/10/21 17:12:40  uzadow
00096 |      Added PSD decoder beta, removed BPPWanted from all decoders, added PLFilterPixel.
00097 |
00098 |      Revision 1.1  2001/09/16 19:03:22  uzadow
00099 |      Added global name prefix PL, changed most filenames.
00100 |
00101 |      Revision 1.6  2001/02/04 14:31:52  uzadow
00102 |      Member initialization list cleanup (Erik Hoffmann).
00103 |
00104 |      Revision 1.5  2000/12/18 22:42:52  uzadow
00105 |      Replaced RGBAPIXEL with PLPixel32.
00106 |
00107 |      Revision 1.4  2000/01/16 20:43:15  anonymous
00108 |      Removed MFC dependencies
00109 |
00110 |      Revision 1.3  2000/01/10 23:53:00  Ulrich von Zadow
00111 |      Changed formatting & removed tabs.
00112 |
00113 |      Revision 1.2  2000/01/09 22:24:10  Ulrich von Zadow
00114 |      Corrected tiff callback bug.
00115 |
00116 |      Revision 1.1  1999/10/19 21:30:42  Ulrich von Zadow
00117 |      B. Delmee - Initial revision
00118 |
00119 |
00120 \--------------------------------------------------------------------
00121 */

Generated on Wed Dec 15 21:20:30 2004 for vuVolume by  doxygen 1.3.9.1