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

Representations/Perception/JPEGImage.h

Go to the documentation of this file.
00001 /**
00002  * @file JPEGImage.h
00003  * 
00004  * Declaration of class JPEGImage
00005  */ 
00006 
00007 #ifndef __JPEGImage_h_
00008 #define __JPEGImage_h_
00009 
00010 #include "Image.h"
00011 #include <stdio.h>
00012 
00013 // INT32 and FAR conflict with any other header files...
00014 #define INT32 _INT32
00015 #undef FAR
00016 #include "Tools/JPEGlib/jpeglib.h"
00017 #undef INT32
00018 #undef FAR
00019 
00020 class JPEGImage;
00021 
00022 /**
00023  * Streaming operator that writes a JPEGImage to a stream.
00024  * @param stream The stream to write on.
00025  * @param image The JPEGImage object.
00026  * @return The stream.
00027  */ 
00028 Out& operator<<(Out& stream,const JPEGImage& image);
00029 
00030 /**
00031  * Streaming operator that reads a JPEGImage from a stream.
00032  * @param stream The stream to read from.
00033  * @param image The JPEGImage object.
00034  * @return The stream.
00035  */ 
00036 In& operator>>(In& stream,JPEGImage& image);
00037 
00038 /**
00039  * Definition of a class for JPEG-compressed images.
00040  */
00041 class JPEGImage : public Image
00042 {
00043   private:
00044     /**
00045      * The class is required during JPEG-compression to access
00046      * the main JPEGImage object from library handlers.
00047      */
00048     class DestDescriptor : public jpeg_destination_mgr
00049     {
00050       public:
00051         JPEGImage* theObject; /**< A pointer to the JPEGImage object. */
00052     };
00053 
00054     unsigned size; /**< The size of the JPEG image. */
00055 
00056     //!@name Handlers for JPEG-compression
00057     //!@{
00058     static void onDestInit(j_compress_ptr cInfo);
00059     static int onDestEmpty(j_compress_ptr);
00060     static void onDestTerm(j_compress_ptr cInfo);
00061 
00062     static void onSrcSkip(j_decompress_ptr cInfo,long numBytes);
00063     static int onSrcEmpty(j_decompress_ptr);
00064     static void onSrcIgnore(j_decompress_ptr);
00065     //!@}
00066 
00067   public:
00068     /** 
00069      * Empty constructor. 
00070      */
00071     JPEGImage() {size = 0;}
00072 
00073     /** 
00074      * Constructs a JPEG image from an image.
00075      * @param src The image used as template.
00076      */
00077     JPEGImage(const Image& src);
00078 
00079     /**
00080      * Assignment operator.
00081      * @param src The image used as template.
00082      * @return The resulting JPEG image.
00083      */
00084     JPEGImage& operator=(const Image& src);
00085 
00086     /**
00087      * Uncompress image.
00088      * @param dest Will receive the uncompressed image.
00089      */
00090     void toImage(Image& dest) const;
00091 
00092   friend Out& operator<<(Out& stream,const JPEGImage& image);
00093   friend In& operator>>(In& stream,JPEGImage& image);
00094 };
00095 
00096 #endif //__JPEGImage_h_
00097 
00098 /*
00099  * Change log :
00100  * 
00101  * $Log: JPEGImage.h,v $
00102  * Revision 1.1.1.1  2004/05/22 17:25:50  cvsadm
00103  * created new repository GT2004_WM
00104  *
00105  * Revision 1.1  2003/10/07 10:09:36  cvsadm
00106  * Created GT2004 (M.J.)
00107  *
00108  * Revision 1.1.1.1  2003/07/02 09:40:22  cvsadm
00109  * created new repository for the competitions in Padova from the 
00110  * tamara CVS (Tuesday 2:00 pm)
00111  *
00112  * removed unused solutions
00113  *
00114  * Revision 1.4  2003/05/26 12:51:51  dueffert
00115  * does not work without const for some reason
00116  *
00117  * Revision 1.3  2003/05/23 11:24:25  dueffert
00118  * cast warnings removed, hopefully nobody wants to change (now non-const) src in JPEGImage's =operator...
00119  *
00120  * Revision 1.2  2003/01/22 13:47:20  roefer
00121  * Comment added
00122  *
00123  * Revision 1.1  2002/10/11 13:54:44  roefer
00124  * JPEGImage added
00125  *
00126  *
00127  */

Generated on Thu Sep 23 19:57:36 2004 for GT2004 by doxygen 1.3.6