00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: plpicenc.h,v 1.4 2003/08/03 12:03:20 uzadow Exp $ 00005 | 00006 | Copyright (c) 1996-2002 Ulrich von Zadow 00007 | 00008 \-------------------------------------------------------------------- 00009 */ 00010 00011 #ifndef INCL_PLPICENC 00012 #define INCL_PLPICENC 00013 00014 #ifndef INCL_PLBITMAP 00015 #include "plbitmap.h" 00016 #endif 00017 00018 #ifndef INCL_PLDATASNK 00019 #include "pldatasink.h" 00020 #endif 00021 00022 #ifndef AFX_PLOBJECT_H__E40881E3_C809_11D3_97BC_0050046F615E__INCLUDED_ 00023 #include "plobject.h" 00024 #endif 00025 00026 // the details of the bitmap class are not needed here 00027 class PLBmp; 00028 00029 //! Base class for image encoders. 00030 //! PLPicEncoder is an abstract base class. It defines common routines 00031 //! for all encoders. Encoders for specific file formats can be 00032 //! derived from this class. Objects of this class interact with a 00033 //! PLDataSink to encode bitmaps. 00034 class PLPicEncoder : public PLObject 00035 { 00036 00037 public: 00038 //! Empty constructor. The actual initialization takes place in a 00039 //! derived class. 00040 PLPicEncoder 00041 (); 00042 00043 //! Destructor. Frees memory allocated. 00044 virtual ~PLPicEncoder 00045 (); 00046 00047 //! Encodes a bitmap to a file and stores. 00048 virtual void MakeFileFromBmp( 00049 const char *, 00050 PLBmp* 00051 ); 00052 00053 #ifdef _WINDOWS 00054 virtual void MakeFileFromBmpW( 00055 const wchar_t *, 00056 PLBmp* 00057 ); 00058 #endif 00059 00060 //! Encodes a picture to a pre-existing data destination (sink). 00061 virtual void SaveBmp( PLBmp*, PLDataSink* ); 00062 00063 //! 00064 void SetTraceConfig( int Level, char * pszFName ); 00065 00066 // This function is needed by callbacks outside of any object, 00067 // so it's public and static. It should not be called from 00068 // outside of the library. 00069 static void raiseError( int Code, char * pszErr ); 00070 00071 //! 00072 void Trace( int TraceLevel, const char * pszMessage ); 00073 00074 protected: 00075 //! Implements the actual encoding process. Uses variables local to the 00076 //! object to retrieve and store the data. Implemented in derived classes. 00077 //! 00078 virtual void DoEncode 00079 ( PLBmp* pBmp, 00080 PLDataSink* pDataSrc 00081 ) = 0; 00082 }; 00083 #endif 00084 /* 00085 /-------------------------------------------------------------------- 00086 | 00087 | $Log: plpicenc.h,v $ 00088 | Revision 1.4 2003/08/03 12:03:20 uzadow 00089 | Added unicode support; fixed some header includes. 00090 | 00091 | Revision 1.3 2002/02/24 13:00:26 uzadow 00092 | Documentation update; removed buggy PLFilterRotate. 00093 | 00094 | Revision 1.2 2001/10/06 20:44:45 uzadow 00095 | Linux compatibility 00096 | 00097 | Revision 1.1 2001/09/16 19:03:22 uzadow 00098 | Added global name prefix PL, changed most filenames. 00099 | 00100 | Revision 1.7 2000/01/16 20:43:14 anonymous 00101 | Removed MFC dependencies 00102 | 00103 | Revision 1.6 2000/01/08 15:51:30 Ulrich von Zadow 00104 | Misc. modifications to png encoder. 00105 | 00106 | Revision 1.5 1999/11/27 18:45:48 Ulrich von Zadow 00107 | Added/Updated doc comments. 00108 | 00109 | Revision 1.4 1999/10/19 21:28:05 Ulrich von Zadow 00110 | Added jpeg encoder 00111 | 00112 | Revision 1.3 1999/10/03 18:50:50 Ulrich von Zadow 00113 | Added automatic logging of changes. 00114 | 00115 | 00116 \-------------------------------------------------------------------- 00117 */