- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# jpeg.h

    00001 #pragma once
    00002
    00003 class CJpegEncoder
    00004 {
    00005         static const int ColorComponents = 3;
    00006
    00007         int m_w, m_h;
    00008         BYTE* m_p;
    00009
    00010         unsigned int m_bbuff, m_bwidth;
    00011         bool PutBit(int b, int n);
    00012         void Flush();
    00013         int GetBitWidth(short q);
    00014
    00015         void WriteSOI();
    00016         void WriteDQT();
    00017         void WriteSOF0();
    00018         void WriteDHT();
    00019         void WriteSOS();
    00020         void WriteEOI();
    00021
    00022 protected:
    00023         virtual bool PutByte(BYTE b) = 0;
    00024         virtual bool PutBytes(const void* pData, int len) = 0;
    00025         virtual bool Encode(const BYTE* dib);
    00026
    00027 public:
    00028         CJpegEncoder();
    00029 };
    00030
    00031 class CJpegEncoderFile : public CJpegEncoder
    00032 {
    00033         CString m_fn;
    00034         FILE* m_file;
    00035
    00036 protected:
    00037         bool PutByte(BYTE b);
    00038         bool PutBytes(const void* pData, int len);
    00039
    00040 public:
    00041         CJpegEncoderFile(LPCTSTR fn);
    00042
    00043         bool Encode(const BYTE* dib);
    00044 };
    00045
    00046 class CJpegEncoderMem : public CJpegEncoder
    00047 {
    00048         CArray<BYTE>* m_pdata;
    00049
    00050 protected:
    00051         bool PutByte(BYTE b);
    00052         bool PutBytes(const void* pData, int len);
    00053
    00054 public:
    00055         CJpegEncoderMem();
    00056
    00057         bool Encode(const BYTE* dib, CArray<BYTE>& data);
    00058 };
    00059