// Borland C++ Builder
// Copyright (c) 1995, 1998 by Borland International
// All rights reserved

// (DO NOT EDIT: machine generated header) 'mwajpeg.pas' rev: 3.00

#ifndef mwajpegHPP
#define mwajpegHPP
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <Windows.hpp>
#include <Classes.hpp>
#include <jpeglib.hpp>
#include <SysInit.hpp>
#include <System.hpp>

//-- user supplied -----------------------------------------------------------

namespace Mwajpeg
{
//-- type declarations -------------------------------------------------------
typedef void __fastcall (__closure *TWarningEvent)(const System::AnsiString warning_message);

class DELPHICLASS TJPEGBase;
class PASCALIMPLEMENTATION TJPEGBase : public Classes::TComponent 
{
	typedef Classes::TComponent inherited;
	
private:
	Jpeglib::jpeg_common_struct *JPEGObject;
	bool FInAbort;
	bool FInProgress;
	bool FAbortRequested;
	Classes::TNotifyEvent FOnProgressReport;
	TWarningEvent FOnWarning;
	int __fastcall GetWarnings(void);
	int __fastcall GetTraceLevel(void);
	int __fastcall GetPercentDone(void);
	void __fastcall SetTraceLevel(int value);
	virtual void __fastcall CreateJPEGObject(Jpeglib::jpeg_error_mgr_ptr err) = 0;
	
protected:
	virtual void __fastcall Error(void);
	virtual void __fastcall Warning(int msg_level);
	virtual void __fastcall DoProgress(void);
	int __fastcall Round4(int i);
	
public:
	__fastcall virtual TJPEGBase(Classes::TComponent* AOwner);
	__fastcall virtual ~TJPEGBase(void);
	virtual void __fastcall Abort(void);
	__property int Warnings = {read=GetWarnings, nodefault};
	__property int Trace_Level = {read=GetTraceLevel, write=SetTraceLevel, nodefault};
	__property int PercentDone = {read=GetPercentDone, nodefault};
	__property Classes::TNotifyEvent OnProgressReport = {read=FOnProgressReport, write=FOnProgressReport
		};
	__property TWarningEvent OnWarning = {read=FOnWarning, write=FOnWarning};
};

enum TBitmapResolution { bmDefault, bm16Colour, bm256Colour, bm24bit };

typedef int TImageSize;

class DELPHICLASS TJPEGCompressor;
class PASCALIMPLEMENTATION TJPEGCompressor : public Mwajpeg::TJPEGBase 
{
	typedef Mwajpeg::TJPEGBase inherited;
	
private:
	System::AnsiString FComment;
	bool FProgressiveJPEG;
	bool FWriteAllTables;
	int FQuality;
	bool FGrayscaleOutput;
	Classes::TNotifyEvent FOnWriteMarkers;
	Jpeglib::JOCTET_PTR __fastcall GetNextOut(void);
	int __fastcall GetFreeIn(void);
	void __fastcall SetNextOut(Jpeglib::JOCTET_PTR value);
	void __fastcall SetFreeIn(int value);
	void __fastcall SetQuality(int Value);
	virtual void __fastcall CreateJPEGObject(Jpeglib::jpeg_error_mgr_ptr err);
	int __fastcall Getcinfoinput_components(void);
	Cardinal __fastcall Getcinfoimage_width(void);
	double __fastcall Getcinfoinput_gamma(void);
	int __fastcall Getcinfodata_precision(void);
	Jpeglib::J_COLOR_SPACE __fastcall Getcinfojpeg_color_space(void);
	Jpeglib::J_DCT_METHOD __fastcall Getcinfodct_method(void);
	bool __fastcall Getcinfooptimize_coding(void);
	Cardinal __fastcall Getcinforestart_interval(void);
	int __fastcall Getcinforestart_in_rows(void);
	int __fastcall Getcinfosmoothing_factor(void);
	bool __fastcall Getcinfowrite_JFIF_header(void);
	Byte __fastcall Getcinfodensity_unit(void);
	Word __fastcall GetcinfoX_density(void);
	Word __fastcall GetcinfoY_Density(void);
	bool __fastcall Getcinfowrite_Adobe_marker(void);
	Cardinal __fastcall Getcinfoimage_height(void);
	void __fastcall Setcinfoinput_components(int Value);
	void __fastcall Setcinfoimage_width(Cardinal Value);
	void __fastcall Setcinfoinput_gamma(double Value);
	void __fastcall Setcinfodata_precision(int Value);
	void __fastcall Setcinfojpeg_color_space(Jpeglib::J_COLOR_SPACE Value);
	void __fastcall Setcinfodct_method(Jpeglib::J_DCT_METHOD Value);
	void __fastcall Setcinfooptimize_coding(bool Value);
	void __fastcall Setcinforestart_interval(Cardinal Value);
	void __fastcall Setcinforestart_in_rows(int Value);
	void __fastcall Setcinfosmoothing_factor(int Value);
	void __fastcall Setcinfowrite_JFIF_header(bool Value);
	void __fastcall Setcinfodensity_unit(Byte Value);
	void __fastcall SetcinfoX_density(Word Value);
	void __fastcall SetcinfoY_Density(Word Value);
	void __fastcall Setcinfowrite_Adobe_marker(bool Value);
	void __fastcall Setcinfoimage_height(Cardinal Value);
	
protected:
	Jpeglib::jpeg_compress_struct cinfo;
	virtual void __fastcall InitDestination(void) = 0;
	virtual bool __fastcall EmptyOutputBuffer(void) = 0;
	virtual void __fastcall TermDestination(void) = 0;
	void __fastcall SetColorSpace(Jpeglib::J_COLOR_SPACE value);
	void __fastcall Bitmap2DIB(Graphics::TBitmap* Bitmap, TBitmapResolution Resolution, void *BitMapInfo
		, void *bits);
	void __fastcall GetBitmapInfoHeader(HBITMAP Bitmap, TBitmapResolution Resolution, tagBITMAPINFOHEADER 
		&BitmapInfoHeader);
	void __fastcall GetDIBSizes(HBITMAP Bitmap, TBitmapResolution Resolution, int &InfoHeaderSize, int 
		&ImageSize);
	void __fastcall WriteDIBitmap(const tagBITMAPINFO &BitmapInfo, char * bits);
	void __fastcall WriteBitmap(Graphics::TBitmap* bitmap);
	void __fastcall WriteStretchedBitmap(Graphics::TBitmap* bitmap, int width, int height);
	void __fastcall WriteMetaFile(Graphics::TMetafile* metafile, int width, int height);
	__property Jpeglib::JOCTET_PTR next_out = {read=GetNextOut, write=SetNextOut};
	__property int free_in = {read=GetFreeIn, write=SetFreeIn, nodefault};
	__property int InputComponents = {read=Getcinfoinput_components, write=Setcinfoinput_components, nodefault
		};
	__property Cardinal ImageWidth = {read=Getcinfoimage_width, write=Setcinfoimage_width, nodefault};
	__property Cardinal ImageHeight = {read=Getcinfoimage_height, write=Setcinfoimage_height, nodefault
		};
	
public:
	__fastcall virtual TJPEGCompressor(Classes::TComponent* AOwner);
	__fastcall virtual ~TJPEGCompressor(void);
	void __fastcall AddQuantTable(int which_tbl, const Jpeglib::uint_ptr basic_table, int scale_factor, 
		bool force_baseline);
	void __fastcall WriteMarker(int Marker, const void *buf, int Count);
	__property bool GrayscaleOutput = {read=FGrayscaleOutput, write=FGrayscaleOutput, nodefault};
	__property System::AnsiString Comment = {read=FComment, write=FComment};
	__property int Quality = {read=FQuality, write=SetQuality, default=75};
	__property bool ProgressiveJPEG = {read=FProgressiveJPEG, write=FProgressiveJPEG, nodefault};
	__property double InputGamma = {read=Getcinfoinput_gamma, write=Setcinfoinput_gamma};
	__property int DataPrecision = {read=Getcinfodata_precision, write=Setcinfodata_precision, nodefault
		};
	__property Jpeglib::J_COLOR_SPACE OutputColorSpace = {read=Getcinfojpeg_color_space, write=Setcinfojpeg_color_space
		, nodefault};
	__property Jpeglib::J_DCT_METHOD DCTMethod = {read=Getcinfodct_method, write=Setcinfodct_method, nodefault
		};
	__property bool OptimizeCoding = {read=Getcinfooptimize_coding, write=Setcinfooptimize_coding, nodefault
		};
	__property Cardinal RestartInterval = {read=Getcinforestart_interval, write=Setcinforestart_interval
		, nodefault};
	__property int RestartInRows = {read=Getcinforestart_in_rows, write=Setcinforestart_in_rows, nodefault
		};
	__property int SmoothingFactor = {read=Getcinfosmoothing_factor, write=Setcinfosmoothing_factor, nodefault
		};
	__property bool WriteJFIFHeader = {read=Getcinfowrite_JFIF_header, write=Setcinfowrite_JFIF_header, 
		nodefault};
	__property Byte DensityUnit = {read=Getcinfodensity_unit, write=Setcinfodensity_unit, nodefault};
	__property Word X_Density = {read=GetcinfoX_density, write=SetcinfoX_density, nodefault};
	__property Word Y_Density = {read=GetcinfoY_Density, write=SetcinfoY_Density, nodefault};
	__property bool WriteAdobeMarker = {read=Getcinfowrite_Adobe_marker, write=Setcinfowrite_Adobe_marker
		, nodefault};
	__property bool WriteAllTables = {read=FWriteAllTables, write=FWriteAllTables, default=1};
	__property Classes::TNotifyEvent OnWriteMarkers = {read=FOnWriteMarkers, write=FOnWriteMarkers};
};

typedef void __fastcall (__closure *TJPEGCommentEvent)(TJPEGBase* sender, char * comment);

typedef void __fastcall (__closure *TJPEGMarkerEvent)(TJPEGBase* sender, int Marker, bool &done);

enum TJPEGOutputType { jp24bit, jp8bit, jp4bit, jpGrayscale };

class DELPHICLASS TJPEGDecompressor;
class PASCALIMPLEMENTATION TJPEGDecompressor : public Mwajpeg::TJPEGBase 
{
	typedef Mwajpeg::TJPEGBase inherited;
	
private:
	TJPEGCommentEvent FOnJPEGComment;
	J_DCT_METHOD FDCT_METHOD;
	bool FDoFancyUpSampling;
	bool FDoBlockSmoothing;
	bool FGrayScaleOutput;
	bool FTwoPassQuantize;
	J_DITHER_MODE FDitherMode;
	int FColoursIn8bitMode;
	TJPEGMarkerEvent FOnJPEGMarker;
	virtual void __fastcall CreateJPEGObject(Jpeglib::jpeg_error_mgr_ptr err);
	Jpeglib::JOCTET_PTR __fastcall GetNextInputByte(void);
	int __fastcall GetBytesInBuffer(void);
	void __fastcall SetNextInputByte(Jpeglib::JOCTET_PTR value);
	void __fastcall SetBytesInBuffer(int value);
	bool __fastcall HandleJPEGComment(void);
	bool __fastcall HandleAPPMarker(void);
	Jpeglib::J_COLOR_SPACE __fastcall Getcinfoout_color_space(void);
	Cardinal __fastcall Getcinfoscale_num(void);
	Cardinal __fastcall Getcinfoscale_denom(void);
	double __fastcall Getcinfooutput_gamma(void);
	bool __fastcall Getcinfoquantize_colors(void);
	int __fastcall Getcinfodesired_number_of_colors(void);
	Jpeglib::JSAMPARRAY __fastcall Getcinfocolormap(void);
	int __fastcall Getcinfoactual_number_of_colors(void);
	Cardinal __fastcall Getcinfoimage_width(void);
	Cardinal __fastcall Getcinfoimage_height(void);
	Jpeglib::J_COLOR_SPACE __fastcall Getcinfojpeg_color_space(void);
	bool __fastcall Getcinfosaw_JFIF_marker(void);
	Byte __fastcall Getcinfodensity_unit(void);
	Word __fastcall GetcinfoX_density(void);
	Word __fastcall GetcinfoY_density(void);
	Byte __fastcall GetcinfoAdobe_transform(void);
	bool __fastcall Getcinfoenable_1pass_quant(void);
	bool __fastcall Getcinfoenable_external_quant(void);
	bool __fastcall Getcinfoenable_2pass_quant(void);
	Cardinal __fastcall Getcinfooutput_height(void);
	Cardinal __fastcall Getcinfooutput_width(void);
	void __fastcall Setcinfoout_color_space(Jpeglib::J_COLOR_SPACE Value);
	void __fastcall Setcinfoscale_num(Cardinal Value);
	void __fastcall Setcinfoscale_denom(Cardinal Value);
	void __fastcall Setcinfooutput_gamma(double Value);
	void __fastcall Setcinfoquantize_colors(bool Value);
	void __fastcall Setcinfodesired_number_of_colors(int Value);
	void __fastcall Setcinfocolormap(Jpeglib::JSAMPARRAY Value);
	void __fastcall Setcinfoactual_number_of_colors(int Value);
	void __fastcall Setcinfoimage_width(Cardinal Value);
	void __fastcall Setcinfoimage_height(Cardinal Value);
	void __fastcall Setcinfojpeg_color_space(Jpeglib::J_COLOR_SPACE Value);
	void __fastcall Setcinfosaw_JFIF_marker(bool Value);
	void __fastcall Setcinfodensity_unit(Byte Value);
	void __fastcall SetcinfoX_density(Word Value);
	void __fastcall SetcinfoY_density(Word Value);
	void __fastcall SetcinfoAdobe_transform(Byte Value);
	void __fastcall Setcinfoenable_1pass_quant(bool Value);
	void __fastcall Setcinfoenable_external_quant(bool Value);
	void __fastcall Setcinfoenable_2pass_quant(bool Value);
	void __fastcall Setcinfooutput_height(Cardinal Value);
	void __fastcall Setcinfooutput_width(Cardinal Value);
	
protected:
	Jpeglib::jpeg_decompress_struct cinfo;
	virtual void __fastcall InitSource(void) = 0;
	virtual bool __fastcall FillInputBuffer(void) = 0;
	virtual void __fastcall SkipInputBytes(int num_bytes) = 0;
	virtual bool __fastcall ResyncToRestart(int desired) = 0;
	virtual void __fastcall TermSource(void) = 0;
	virtual bool __fastcall DoJPEGComment(char * comment);
	void __fastcall ReadDIBitmap(tagBITMAPINFO &BitMapInfo, TJPEGOutputType OutputType, void * bits);
	Graphics::TBitmap* __fastcall ReadBitmap(void);
	void __fastcall ReadWinBitmap(HBITMAP &Bitmap, HPALETTE &Palette);
	virtual void __fastcall ReadHeader(void);
	__property Jpeglib::JOCTET_PTR NextInputByte = {read=GetNextInputByte, write=SetNextInputByte};
	__property int BytesInBuffer = {read=GetBytesInBuffer, write=SetBytesInBuffer, nodefault};
	__property Jpeglib::J_COLOR_SPACE OutputColorSpace = {read=Getcinfoout_color_space, write=Setcinfoout_color_space
		, nodefault};
	__property Cardinal ScaleNum = {read=Getcinfoscale_num, write=Setcinfoscale_num, nodefault};
	__property Cardinal ScaleDenom = {read=Getcinfoscale_denom, write=Setcinfoscale_denom, nodefault};
	__property double OutputGamma = {read=Getcinfooutput_gamma, write=Setcinfooutput_gamma};
	__property bool QuantizeColors = {read=Getcinfoquantize_colors, write=Setcinfoquantize_colors, nodefault
		};
	__property int NumColorsDesired = {read=Getcinfodesired_number_of_colors, write=Setcinfodesired_number_of_colors
		, nodefault};
	__property Jpeglib::JSAMPARRAY ColorMap = {read=Getcinfocolormap, write=Setcinfocolormap};
	__property int ActualColorsInMap = {read=Getcinfoactual_number_of_colors, write=Setcinfoactual_number_of_colors
		, nodefault};
	
public:
	__fastcall virtual TJPEGDecompressor(Classes::TComponent* AOwner);
	__fastcall virtual ~TJPEGDecompressor(void);
	int __fastcall GetBitmapInfoSize(TJPEGOutputType OutputType);
	int __fastcall GetDIBitsSize(TJPEGOutputType OutputType);
	Byte __fastcall GetByte(void);
	__property TJPEGCommentEvent OnJPEGComment = {read=FOnJPEGComment, write=FOnJPEGComment};
	__property TJPEGMarkerEvent OnJPEGMarker = {read=FOnJPEGMarker, write=FOnJPEGMarker};
	__property bool GrayScaleOutput = {read=FGrayScaleOutput, write=FGrayScaleOutput, nodefault};
	__property Cardinal Width = {read=Getcinfoimage_width, write=Setcinfoimage_width, nodefault};
	__property Cardinal Height = {read=Getcinfoimage_height, write=Setcinfoimage_height, nodefault};
	__property Jpeglib::J_COLOR_SPACE ColorSpace = {read=Getcinfojpeg_color_space, write=Setcinfojpeg_color_space
		, nodefault};
	__property bool JFIFMarkerPresent = {read=Getcinfosaw_JFIF_marker, write=Setcinfosaw_JFIF_marker, nodefault
		};
	__property Byte DensityUnit = {read=Getcinfodensity_unit, write=Setcinfodensity_unit, nodefault};
	__property Word X_Density = {read=GetcinfoX_density, write=SetcinfoX_density, nodefault};
	__property Word Y_Density = {read=GetcinfoY_density, write=SetcinfoY_density, nodefault};
	__property Byte AdobeTransform = {read=GetcinfoAdobe_transform, write=SetcinfoAdobe_transform, nodefault
		};
	__property bool TwoPassQuantize = {read=FTwoPassQuantize, write=FTwoPassQuantize, default=1};
	__property int ColoursIn8bitMode = {read=FColoursIn8bitMode, write=FColoursIn8bitMode, default=64};
		
	__property Jpeglib::J_DITHER_MODE DitherMode = {read=FDitherMode, write=FDitherMode, default=2};
	__property Jpeglib::J_DCT_METHOD DCTMethod = {read=FDCT_METHOD, write=FDCT_METHOD, default=0};
	__property bool DoFancyUpSampling = {read=FDoFancyUpSampling, write=FDoFancyUpSampling, default=1};
		
	__property bool DoBlockSmoothing = {read=FDoBlockSmoothing, write=FDoBlockSmoothing, default=1};
	__property bool Enable1PassQuant = {read=Getcinfoenable_1pass_quant, write=Setcinfoenable_1pass_quant
		, nodefault};
	__property bool EnableExternalQuant = {read=Getcinfoenable_external_quant, write=Setcinfoenable_external_quant
		, nodefault};
	__property bool Enable2PassQuant = {read=Getcinfoenable_2pass_quant, write=Setcinfoenable_2pass_quant
		, nodefault};
	__property Cardinal OutputHeight = {read=Getcinfooutput_height, write=Setcinfooutput_height, nodefault
		};
	__property Cardinal OutputWidth = {read=Getcinfooutput_width, write=Setcinfooutput_width, nodefault
		};
};

class DELPHICLASS TJPEGStreamCompressor;
class PASCALIMPLEMENTATION TJPEGStreamCompressor : public Mwajpeg::TJPEGCompressor 
{
	typedef Mwajpeg::TJPEGCompressor inherited;
	
private:
	Classes::TStream* FStream;
	void *FBuffer;
	int FBufSize;
	void __fastcall SetBufSize(int Value);
	
protected:
	virtual void __fastcall InitDestination(void);
	virtual bool __fastcall EmptyOutputBuffer(void);
	virtual void __fastcall TermDestination(void);
	void __fastcall OpenStream(Classes::TStream* Stream);
	void __fastcall CloseStream(void);
	
public:
	__fastcall virtual TJPEGStreamCompressor(Classes::TComponent* AOwner);
	__fastcall virtual ~TJPEGStreamCompressor(void);
	void __fastcall SavePictureToStream(Graphics::TPicture* Picture, Classes::TStream* Stream);
	void __fastcall SaveStretchedPictureToStream(Graphics::TPicture* Picture, int width, int height, Classes::TStream* 
		Stream);
	void __fastcall SaveBitMapToStream(Graphics::TBitmap* bitmap, Classes::TStream* Stream);
	void __fastcall SaveStretchedBitMapToStream(Graphics::TBitmap* bitmap, int width, int height, Classes::TStream* 
		Stream);
	void __fastcall SaveDIBitmapToStream(Classes::TStream* Stream, const tagBITMAPINFO &BitmapInfo, char * 
		bits);
	void __fastcall SaveMetaFileToStream(Graphics::TMetafile* metafile, Classes::TStream* Stream, int width
		, int height);
	__property int BufSize = {read=FBufSize, write=SetBufSize, default=4096};
};

class DELPHICLASS TJPEGStreamDecompressor;
class PASCALIMPLEMENTATION TJPEGStreamDecompressor : public Mwajpeg::TJPEGDecompressor 
{
	typedef Mwajpeg::TJPEGDecompressor inherited;
	
private:
	Classes::TStream* FStream;
	char *FBuffer;
	int FBufSize;
	
protected:
	virtual void __fastcall InitSource(void);
	virtual bool __fastcall FillInputBuffer(void);
	virtual void __fastcall SkipInputBytes(int num_bytes);
	virtual bool __fastcall ResyncToRestart(int desired);
	void __fastcall SetBufSize(int Value);
	virtual void __fastcall TermSource(void);
	
public:
	void __fastcall OpenStream(Classes::TStream* Stream);
	void __fastcall CloseStream(void);
	__fastcall virtual TJPEGStreamDecompressor(Classes::TComponent* AOwner);
	__fastcall virtual ~TJPEGStreamDecompressor(void);
	void __fastcall ConvertToDIB(Classes::TStream* Source, Classes::TStream* Destination, TJPEGOutputType 
		OutputType);
	void __fastcall LoadPictureFromStream(Graphics::TPicture* Picture, Classes::TStream* Stream);
	void __fastcall LoadPictureFromResource(Graphics::TPicture* Picture, int Instance, const System::AnsiString 
		ResName);
	void __fastcall LoadPictureFromResID(Graphics::TPicture* Picture, int Instance, int ResID);
	Graphics::TBitmap* __fastcall ReadBitMapFromStream(Classes::TStream* Stream);
	void __fastcall ReadDIBitmapFromStream(Classes::TStream* Stream, tagBITMAPINFO &BitMapInfo, TJPEGOutputType 
		OutputType, int &bits);
	__property int BufSize = {read=FBufSize, write=SetBufSize, default=4096};
};

class DELPHICLASS TJPEGFileDecompressor;
class PASCALIMPLEMENTATION TJPEGFileDecompressor : public Mwajpeg::TJPEGStreamDecompressor 
{
	typedef Mwajpeg::TJPEGStreamDecompressor inherited;
	
public:
	void __fastcall LoadPictureFromFile(Graphics::TPicture* Picture, const System::AnsiString FileName)
		;
	
__published:
	__property Warnings ;
	__property Trace_Level ;
	__property PercentDone ;
	__property ColoursIn8bitMode ;
	__property GrayScaleOutput ;
	__property OnJPEGComment ;
	__property OnJPEGMarker ;
	__property TwoPassQuantize ;
	__property DitherMode ;
	__property DCTMethod ;
	__property DoFancyUpSampling ;
	__property DoBlockSmoothing ;
	__property OnProgressReport ;
	__property OnWarning ;
public:
	/* TJPEGStreamDecompressor.create */ __fastcall virtual TJPEGFileDecompressor(Classes::TComponent* 
		AOwner) : Mwajpeg::TJPEGStreamDecompressor(AOwner) { }
	/* TJPEGStreamDecompressor.Destroy */ __fastcall virtual ~TJPEGFileDecompressor(void) { }
	
};

class DELPHICLASS TJPEGFileCompressor;
class PASCALIMPLEMENTATION TJPEGFileCompressor : public Mwajpeg::TJPEGStreamCompressor 
{
	typedef Mwajpeg::TJPEGStreamCompressor inherited;
	
public:
	void __fastcall SavePictureToFile(Graphics::TPicture* Picture, const System::AnsiString FileName);
	void __fastcall SaveStretchedPictureToFile(Graphics::TPicture* Picture, int width, int height, const 
		System::AnsiString FileName);
	void __fastcall SaveBitmapToFile(Graphics::TBitmap* bitmap, const System::AnsiString FileName);
	void __fastcall SaveStretchedBitmapToFile(Graphics::TBitmap* bitmap, int width, int height, const System::AnsiString 
		FileName);
	void __fastcall SaveMetafileToFile(Graphics::TMetafile* metafile, int width, int height, const System::AnsiString 
		FileName);
	
__published:
	__property Warnings ;
	__property Trace_Level ;
	__property PercentDone ;
	__property GrayscaleOutput ;
	__property Comment ;
	__property Quality ;
	__property InputGamma ;
	__property ProgressiveJPEG ;
	__property DCTMethod ;
	__property OptimizeCoding ;
	__property RestartInterval ;
	__property RestartInRows ;
	__property SmoothingFactor ;
	__property WriteJFIFHeader ;
	__property DensityUnit ;
	__property X_Density ;
	__property Y_Density ;
	__property WriteAllTables ;
	__property OnProgressReport ;
	__property OnWriteMarkers ;
	__property OnWarning ;
public:
	/* TJPEGStreamCompressor.create */ __fastcall virtual TJPEGFileCompressor(Classes::TComponent* AOwner
		) : Mwajpeg::TJPEGStreamCompressor(AOwner) { }
	/* TJPEGStreamCompressor.Destroy */ __fastcall virtual ~TJPEGFileCompressor(void) { }
	
};

class DELPHICLASS TJPEGBitmap;
class PASCALIMPLEMENTATION TJPEGBitmap : public Graphics::TBitmap 
{
	typedef Graphics::TBitmap inherited;
	
private:
	bool FSaveAsBitmap;
	TJPEGStreamDecompressor* FDecompressor;
	TJPEGStreamCompressor* FCompressor;
	Classes::TNotifyEvent FProgressEvent;
	void __fastcall HandleDecompressOnProgress(System::TObject* Sender);
	void __fastcall HandleCompressOnProgress(System::TObject* Sender);
	
public:
	virtual void __fastcall LoadFromStream(Classes::TStream* Stream);
	virtual void __fastcall SaveToStream(Classes::TStream* Stream);
	virtual void __fastcall SaveToFile(const System::AnsiString FileName);
public:
	/* TBitmap.Create */ __fastcall virtual TJPEGBitmap(void) : Graphics::TBitmap() { }
	/* TBitmap.Destroy */ __fastcall virtual ~TJPEGBitmap(void) { }
	
};

//-- var, const, procedure ---------------------------------------------------
#define DefaultBufSize (Word)(4096)
#define DefaultQuality (Byte)(75)
#define sJPEGResourceType "JPEG"
#define DefaultColoursIn8bitMode (Byte)(64)
extern PACKAGE bool UseIsIllegal;
extern PACKAGE Graphics::TBitmap* __fastcall ReSizeBitmap(Graphics::TBitmap* bitmap, int width, int 
	height);
extern PACKAGE Graphics::TBitmap* __fastcall CropBitmap(Graphics::TBitmap* bitmap, int width, int height
	, const Windows::TRect &Clip);
extern PACKAGE Graphics::TBitmap* __fastcall MetaToBitmap(Graphics::TMetafile* metafile, int Width, 
	int Height);

}	/* namespace Mwajpeg */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Mwajpeg;
#endif
//-- end unit ----------------------------------------------------------------
#endif	// mwajpeg
