1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
/*
/--------------------------------------------------------------------
|
| $Id: pltiffencex.cpp,v 1.4 2004/09/11 12:41:35 uzadow Exp $
| TIFF Encoder Class
|
| TIFF file encoder. Uses LIBTIFF to do the actual conversion.
|
| Copyright (c) 1996-2002 Ulrich von Zadow
|
\--------------------------------------------------------------------
*/
// Not quite ready for prime-time; bdelmee; 2/99
// I mostly needed monochrome TIFF writing, which seems robust enough.
// Palette or RGB writing seems to work but has not been sufficiently tested.
#include <stdarg.h>
#include "pltiffenc.h"
#include "pltiffencex.h"
#include "plbitmap.h"
#include "plexcept.h"
extern "C"
{
#include "tiffio.h" // for the tags definitions
#include "tif_msrc.h"
}
/////////////////////////////////////////////////////////////////////
// more format-specific encoder
PLTIFFEncoderEx::PLTIFFEncoderEx()
: PLTIFFEncoder(),
m_TiffToken(0)
{}
PLTIFFEncoderEx::~PLTIFFEncoderEx()
{
Dissociate();
}
bool PLTIFFEncoderEx::Associate( PLDataSink* pDataSnk )
{
m_TiffToken = TIFFOpenMem (pDataSnk->m_pStartData,
pDataSnk->m_nMaxFileSize,
&(pDataSnk->m_nCurPos));
return m_TiffToken != 0;
}
void PLTIFFEncoderEx::Dissociate()
{
if ( m_TiffToken )
{
TIFFClose( m_TiffToken );
m_TiffToken = 0;
}
}
void PLTIFFEncoderEx::DoEncode (PLBmpBase * pBmp, PLDataSink* /* pDataSnk */)
{
PLASSERT( m_TiffToken );
// call base version on open tiff descriptor
PLTIFFEncoder::DoTiffEncode( pBmp, m_TiffToken );
}
// The following two calls make their base class equivalent usable,
// without requiring the user to know about the libtiff internals (TIFF*)
int PLTIFFEncoderEx::SetBaseTags(PLBmpBase* pBmp )
{
return PLTIFFEncoder::SetBaseTags( m_TiffToken, pBmp );
}
int PLTIFFEncoderEx::SetField( int tag_id, ... )
{
int retv;
va_list marker;
va_start( marker, tag_id ); /* Initialize variable arguments. */
retv = TIFFVSetField( m_TiffToken, tag_id, marker );
va_end( marker ); /* Reset variable arguments. */
return retv;
}
/*
/--------------------------------------------------------------------
|
| $Log: pltiffencex.cpp,v $
| Revision 1.4 2004/09/11 12:41:35 uzadow
| removed plstdpch.h
|
| Revision 1.3 2004/06/19 18:16:33 uzadow
| Documentation update
|
| Revision 1.2 2002/03/31 13:36:42 uzadow
| Updated copyright.
|
| Revision 1.1 2001/09/16 19:03:22 uzadow
| Added global name prefix PL, changed most filenames.
|
| Revision 1.5 2001/02/04 14:31:52 uzadow
| Member initialization list cleanup (Erik Hoffmann).
|
| Revision 1.4 2000/01/16 20:43:15 anonymous
| Removed MFC dependencies
|
| Revision 1.3 2000/01/10 23:53:00 Ulrich von Zadow
| Changed formatting & removed tabs.
|
| Revision 1.2 1999/12/02 17:07:34 Ulrich von Zadow
| Changes by bdelmee.
|
| Revision 1.1 1999/10/19 21:30:42 Ulrich von Zadow
| B. Delmee - Initial revision
|
|
\--------------------------------------------------------------------
*/
|