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

pltiffencex.cpp

Go to the documentation of this file.
00001 /*
00002 /--------------------------------------------------------------------
00003 |
00004 |      $Id: pltiffencex.cpp,v 1.1 2004/05/21 21:02:53 maxx Exp $
00005 |      TIFF Encoder Class
00006 |
00007 |      TIFF file encoder. Uses LIBTIFF to do the actual conversion.
00008 |
00009 |      Copyright (c) 1996-1998 Ulrich von Zadow
00010 |
00011 \--------------------------------------------------------------------
00012 */
00013 
00014 #include "plstdpch.h"
00015 
00016 // Not quite ready for prime-time; bdelmee; 2/99
00017 // I mostly needed monochrome TIFF writing, which seems robust enough.
00018 // Palette or RGB writing seems to work but has not been sufficiently tested.
00019 
00020 #include <stdarg.h>
00021 #include "pltiffenc.h"
00022 #include "pltiffencex.h"
00023 #include "plbitmap.h"
00024 #include "plexcept.h"
00025 
00026 extern "C"
00027 {
00028 #include "tiffio.h"   // for the tags definitions
00029 #include "tif_msrc.h"
00030 }
00031 
00032 
00034 // more format-specific encoder
00035 
00036 
00037 PLTIFFEncoderEx::PLTIFFEncoderEx() 
00038   : PLTIFFEncoder(),
00039     m_TiffToken(0)
00040 {}
00041 
00042 
00043 
00044 PLTIFFEncoderEx::~PLTIFFEncoderEx()
00045 {
00046   Dissociate();
00047 }
00048 
00049 
00050 bool PLTIFFEncoderEx::Associate( PLDataSink* pDataSnk )
00051 {
00052   m_TiffToken = TIFFOpenMem (pDataSnk->m_pStartData,
00053                              pDataSnk->m_nMaxFileSize,
00054                              &(pDataSnk->m_nCurPos));
00055   return m_TiffToken != 0;
00056 }
00057 
00058 
00059 void PLTIFFEncoderEx::Dissociate()
00060 {
00061   if ( m_TiffToken )
00062   {
00063     TIFFClose( m_TiffToken );
00064     m_TiffToken = 0;
00065   }
00066 }
00067 
00068 
00069 void PLTIFFEncoderEx::DoEncode (PLBmp * pBmp, PLDataSink* /* pDataSnk */)
00070 {
00071   PLASSERT( m_TiffToken );
00072   // call base version on open tiff descriptor
00073   PLTIFFEncoder::DoTiffEncode( pBmp, m_TiffToken );
00074 }
00075 
00076 
00077 // The following two calls make their base class equivalent usable,
00078 // without requiring the user to know about the libtiff internals (TIFF*)
00079 int PLTIFFEncoderEx::SetBaseTags( PLBmp* pBmp )
00080 {
00081   return PLTIFFEncoder::SetBaseTags( m_TiffToken, pBmp );
00082 }
00083 
00084 
00085 int PLTIFFEncoderEx::SetField( int tag_id, ... )
00086 {
00087   int retv;
00088   va_list marker;
00089 
00090   va_start( marker, tag_id );     /* Initialize variable arguments. */
00091   retv = TIFFVSetField( m_TiffToken, tag_id, marker );
00092   va_end( marker );              /* Reset variable arguments.      */
00093 
00094   return retv;
00095 }
00096 /*
00097 /--------------------------------------------------------------------
00098 |
00099 |      $Log: pltiffencex.cpp,v $
00100 |      Revision 1.1  2004/05/21 21:02:53  maxx
00101 |      Initial Version of vuVolume, moderatly changed to make it compile on my windows and linux machine.
00102 |
00103 |      Revision 1.1  2002/11/13 01:57:57  mspindle
00104 |      *** empty log message ***
00105 |
00106 |      Revision 1.1  2001/09/16 19:03:22  uzadow
00107 |      Added global name prefix PL, changed most filenames.
00108 |
00109 |      Revision 1.5  2001/02/04 14:31:52  uzadow
00110 |      Member initialization list cleanup (Erik Hoffmann).
00111 |
00112 |      Revision 1.4  2000/01/16 20:43:15  anonymous
00113 |      Removed MFC dependencies
00114 |
00115 |      Revision 1.3  2000/01/10 23:53:00  Ulrich von Zadow
00116 |      Changed formatting & removed tabs.
00117 |
00118 |      Revision 1.2  1999/12/02 17:07:34  Ulrich von Zadow
00119 |      Changes by bdelmee.
00120 |
00121 |      Revision 1.1  1999/10/19 21:30:42  Ulrich von Zadow
00122 |      B. Delmee - Initial revision
00123 |
00124 |
00125 \--------------------------------------------------------------------
00126 */

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