Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

pljpegenc.h

00001 /*
00002 /--------------------------------------------------------------------
00003 |
00004 |      $Id: pljpegenc.h,v 1.4 2003/04/19 19:03:52 uzadow Exp $
00005 |
00006 |      Copyright (c) 1996-2002 Ulrich von Zadow
00007 |
00008 \--------------------------------------------------------------------
00009 */
00010 
00011 #ifndef INCL_PLJPEGENC
00012 #define INCL_PLJPEGENC
00013 
00014 #ifndef INCL_PLPICENC
00015 #include "plpicenc.h"
00016 #endif
00017 
00018 #include "plexif.h"
00019 
00020 struct jpeg_compress_struct;
00021 struct jpeg_error_mgr;
00022 
00023 //! JPEG file encoder. Uses the independent JPEG group's library
00024 //! to do the actual conversion.
00025 class PLJPEGEncoder : public PLPicEncoder
00026 {
00027 
00028 public:
00029   //! Creates an encoder
00030   PLJPEGEncoder
00031     ();
00032 
00033   //! Destroys a encoder
00034   ~PLJPEGEncoder
00035     ();
00036 
00037   // todo: Notification not yet implemented for encoding.
00038   /*
00039   static void JNotification
00040     (j_common_ptr cinfo
00041     );
00042   */
00043 
00044   //! Set the compression quality on a scale from 0 to 100.
00045   void SetQuality(int iQuality);
00046   //! Enable or disable the generation of optimal Huffmann coding tables.
00047   void SetOptimizeCoding(bool bOptimizeCoding);
00048   //! Set the smoothing factor (<=100). 0 turns it off.
00049   void SetSmoothingFactor(int iSmoothingFactor);
00050   //! Set the resolution information (DPI) for the image.
00051   void SetDensity(unsigned int uiX, unsigned int uiY);
00052 
00053   //! Set Exif (digital camera) Data for the next encode. The encoder only 
00054   //! holds on to the Exif data until the next encode.
00055   void SetExifData(PLExif& ExifData);
00056 
00057 protected:
00058   // Sets up the jpeg library data source and error handler and
00059   // calls the jpeg encoder.
00060   void DoEncode
00061     ( PLBmp * pBmp,
00062       PLDataSink * pDataSink
00063     );
00064 
00065 private:
00066   // Assumes IJPEG decoder is already set up.
00067   void encodeRGB
00068     ( PLBmp * pBmp,
00069       int iScanLines
00070     );
00071 
00072   jpeg_compress_struct * m_pcinfo;  // IJPEG encoder state.
00073   jpeg_error_mgr       * m_pjerr;   // Custom error manager.
00074 
00075   int iQuality_;
00076   bool bOptimizeCoding_;
00077   int iSmoothingFactor_;
00078   unsigned int uiDensityX_;
00079   unsigned int uiDensityY_;
00080   PLExif* m_pExifData;
00081 };
00082 
00083 #endif
00084 
00085 /*
00086 /--------------------------------------------------------------------
00087 |
00088 |      $Log: pljpegenc.h,v $
00089 |      Revision 1.4  2003/04/19 19:03:52  uzadow
00090 |      Exif save (windows)
00091 |
00092 |      Revision 1.3  2002/02/24 13:00:21  uzadow
00093 |      Documentation update; removed buggy PLFilterRotate.
00094 |
00095 |      Revision 1.2  2001/10/06 20:44:45  uzadow
00096 |      Linux compatibility
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.5  2000/05/22 17:43:25  Ulrich von Zadow
00102 |      Added SetQuality(), SetDensity(), SetOptimizeCoding() and
00103 |      SetSmoothingFactor().
00104 |
00105 |      Revision 1.4  2000/01/16 20:43:13  anonymous
00106 |      Removed MFC dependencies
00107 |
00108 |      Revision 1.3  1999/12/08 15:39:45  Ulrich von Zadow
00109 |      Unix compatibility changes
00110 |
00111 |      Revision 1.2  1999/11/27 18:45:48  Ulrich von Zadow
00112 |      Added/Updated doc comments.
00113 |
00114 |      Revision 1.1  1999/10/19 21:28:05  Ulrich von Zadow
00115 |      Added jpeg encoder
00116 |
00117 |
00118 \--------------------------------------------------------------------
00119 */

Generated on Sun Jun 6 13:42:22 2004 for paintlib by doxygen 1.3.2