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

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

#ifndef ImageEnViewHPP
#define ImageEnViewHPP
#include <Menus.hpp>
#include <iedefs.hpp>
#include <ExtCtrls.hpp>
#include <StdCtrls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
#include <Controls.hpp>
#include <Graphics.hpp>
#include <Messages.hpp>
#include <Windows.hpp>
#include <SysInit.hpp>
#include <System.hpp>

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

namespace Imageenview
{
//-- type declarations -------------------------------------------------------
#pragma pack(push, 1)
struct TBitmapInfoHeader256
{
	int biSize;
	int biWidth;
	int biHeight;
	Word biPlanes;
	Word biBitCount;
	int biCompression;
	int biSizeImage;
	int biXPelsPerMeter;
	int biYPelsPerMeter;
	int biClrUsed;
	int biClrImportant;
	tagRGBQUAD Palette[2];
} ;
#pragma pack(pop)

typedef int hDrawDib;

struct TDrawDibTime
{
	int timeCount;
	int timeDraw;
	int timeDecompress;
	int timeDither;
	int timeStretch;
	int timeBlt;
	int timeSetDIBits;
} ;

typedef void __fastcall (__closure *TViewChangeEvent)(System::TObject* Sender, int Change);

enum TIEMouseInteractItems { miZoom, miScroll, miSelect, miSelectPolygon, miSelectCircle, miSelectZoom 
	};

typedef Set<TIEMouseInteractItems, miZoom, miSelectZoom>  TIEMouseInteract;

typedef tagPOINT TPointArray[134217728];

typedef TPointArray *PPointArray;

struct TIEAnimPoly
{
	TPointArray *Poly;
	int PolyCount;
	Graphics::TColor Color1;
	Graphics::TColor Color2;
	bool Animated;
	int AniFt;
	int C1;
	Graphics::TCanvas* Canvas;
	int RX1;
	int RY1;
	int RX2;
	int RY2;
	bool Enabled;
} ;

typedef TIEAnimPoly *PIEAnimPoly;

typedef void __fastcall (__closure *TIEBitmapChangeEvent)(System::TObject* Sender);

typedef TIEBitmapChangeEvent *PIEBitmapChangeEvent;

enum TIESelectionBase { iesbClientArea, iesbBitmap };

enum TIEBackgroundStyle { iebsSolid, iebsHorizontal, iebsVertical, iebsFDiagonal, iebsBDiagonal, iebsCross, 
	iebsDiagCross, iebsChessboard, iebsDiagonals };

class DELPHICLASS TIEView;
class PASCALIMPLEMENTATION TIEView : public Controls::TCustomControl 
{
	typedef Controls::TCustomControl inherited;
	
private:
	TFormBorderStyle FBorderStyle;
	Classes::TList* fBmpChange;
	void __fastcall SetBorderStyle(Forms::TBorderStyle Value);
	
protected:
	Graphics::TColor fBackGround;
	int fDPIX;
	int fDPIY;
	virtual void __fastcall SetBackGround(Graphics::TColor cl);
	virtual Graphics::TBitmap* __fastcall GetFBitmap(void);
	virtual void __fastcall CreateParams(Controls::TCreateParams &Params);
	
public:
	virtual void __fastcall SetDPIX(int dpiX);
	virtual void __fastcall SetDPIY(int dpiY);
	virtual void __fastcall SetDPI(int dpiX, int dpiY);
	virtual void __fastcall ImageChange(void);
	__fastcall virtual TIEView(Classes::TComponent* Owner);
	__fastcall virtual ~TIEView(void);
	__property int DpiX = {read=fDPIX, write=SetDPIX, nodefault};
	__property int DpiY = {read=fDPIY, write=SetDPIY, nodefault};
	__property Graphics::TBitmap* Bitmap = {read=GetFBitmap};
	void __fastcall CallBitmapChangeEvents(void);
	void __fastcall RegisterBitmapChangeEvent(TIEBitmapChangeEvent v);
	void __fastcall RemoveBitmapChangeEvent(TIEBitmapChangeEvent v);
	
__published:
	__property Graphics::TColor Background = {read=fBackGround, write=SetBackGround, default=-2147483633
		};
	__property Ctl3D ;
	__property ParentCtl3D ;
	__property Forms::TBorderStyle BorderStyle = {read=FBorderStyle, write=SetBorderStyle, default=1};
public:
		
	/* TWinControl.CreateParented */ __fastcall TIEView(HWND ParentWindow) : Controls::TCustomControl(ParentWindow
		) { }
	
};

class DELPHICLASS TImageEnView;
typedef TImageEnView* *PImageEnView;

class PASCALIMPLEMENTATION TImageEnView : public Imageenview::TIEView 
{
	typedef Imageenview::TIEView inherited;
	
private:
	Graphics::TBitmap* fUndoBitmap;
	Controls::TCursor fLCursor;
	Classes::TNotifyEvent fOnImageChange;
	TViewChangeEvent fOnViewChange;
	bool fCenter;
	bool fDBToDraw;
	TResampleFilter fZoomFilter;
	TResampleFilter fSaveZoomFilter;
	int fStable;
	bool fDelayZoomFilter;
	TIEBackgroundStyle fBackgroundStyle;
	int fHSVX1;
	int fHSVY1;
	Graphics::TBitmap* fTBitmap;
	int fBitmapWidth;
	int fBitmapHeight;
	void __fastcall AniPolyFunc(System::TObject* Sender);
	void __fastcall SetViewX(int v);
	void __fastcall SetViewY(int v);
	void __fastcall SetZoom(int v);
	int __fastcall GetSelX1(void);
	int __fastcall GetSelY1(void);
	int __fastcall GetSelX2(void);
	int __fastcall GetSelY2(void);
	void __fastcall SetCenter(bool v);
	TIEMouseInteract __fastcall GetMouseInteract(void);
	void __fastcall SetBackgroundStyle(TIEBackgroundStyle v);
	void __fastcall DoSelectionChange(void);
	
protected:
	int fViewX;
	int fViewY;
	int fZoom;
	int fHDrawDib;
	int fHDrawDib2;
	TScrollStyle fScrollBars;
	int fLockPaint;
	int fOffX;
	int fOffY;
	int fExtX;
	int fExtY;
	int fZZWW;
	int fZZHH;
	Graphics::TBitmap* fBitmap;
	TBitmapInfoHeader256 fBitmapInfoHeader256;
	bool fDoubleBuffer;
	bool fAutoFit;
	bool fUpdateInvalidate;
	bool fSel;
	bool fPolySelecting;
	bool fRectSelecting;
	bool fCircSelecting;
	int fMMoveX;
	int fMMoveY;
	int fHSX1;
	int fHSY1;
	TIEAnimPoly *fHPolySel;
	TIESelectionBase fSelectionBase;
	Classes::TNotifyEvent fOnSelectionChange;
	Classes::TList* fAnimPoly;
	Extctrls::TTimer* fAnimPolyTimer;
	TIEMouseInteract fMouseInteract;
	virtual void __fastcall SetBackGround(Graphics::TColor cl);
	void __fastcall PolyDraw1(void);
	virtual void __fastcall SetScrollBars(Stdctrls::TScrollStyle v);
	void __fastcall GetMaxViewXY(int &mx, int &my);
	HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);
	HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Messages::TMessage &Message);
	HIDESBASE MESSAGE void __fastcall WMVScroll(Messages::TMessage &Message);
	HIDESBASE MESSAGE void __fastcall WMHScroll(Messages::TMessage &Message);
	void __fastcall SaveCursor(Controls::TCursor newc);
	void __fastcall RestoreCursor(void);
	void __fastcall ShowSelectionEx(bool d);
	void __fastcall HideSelectionEx(bool dd);
	void __fastcall SetAnimatedSel(bool v);
	bool __fastcall GetAnimatedSel(void);
	HPALETTE __fastcall _CreatePalette(void);
	int __fastcall GetIdealComponentWidth(void);
	int __fastcall GetIdealComponentHeight(void);
	DYNAMIC bool __fastcall PaletteChanged(bool Foreground);
	DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, 
		int Y);
	DYNAMIC void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y);
	DYNAMIC void __fastcall MouseUp(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int 
		Y);
	HIDESBASE MESSAGE void __fastcall WMLButtonDblClk(Messages::TWMMouse &Message);
	tagPOINT __fastcall GetPolySel(int idx);
	int __fastcall GetPolySelCount(void);
	virtual void __fastcall SetMouseInteract(TIEMouseInteract v);
	void __fastcall AnimPolygonAddPtEx(int ap, int x, int y);
	void __fastcall SetSelColor1(Graphics::TColor c);
	void __fastcall SetSelColor2(Graphics::TColor c);
	Graphics::TColor __fastcall GetSelColor1(void);
	Graphics::TColor __fastcall GetSelColor2(void);
	virtual void __fastcall ViewChange(int c);
	void __fastcall SetZoomFilter(Iedefs::TResampleFilter v);
	virtual void __fastcall SubMouseMoveScroll(int scx, int scy);
	void __fastcall MouseMoveScroll(void);
	virtual Graphics::TBitmap* __fastcall GetFBitmap(void);
	void __fastcall SetVisibleSelection(bool vv);
	bool __fastcall GetVisibleSelection(void);
	void __fastcall DrawBackground(Graphics::TCanvas* Canvas);
	PPointArray __fastcall GetPolySelArray(void);
	
public:
	__fastcall virtual TImageEnView(Classes::TComponent* Owner);
	__fastcall virtual ~TImageEnView(void);
	virtual void __fastcall Paint(void);
	virtual void __fastcall Select(int x1, int y1, int x2, int y2);
	void __fastcall DeSelect(void);
	__property int SelX1 = {read=GetSelX1, nodefault};
	__property int SelY1 = {read=GetSelY1, nodefault};
	__property int SelX2 = {read=GetSelX2, nodefault};
	__property int SelY2 = {read=GetSelY2, nodefault};
	virtual void __fastcall AddSelPoint(int x, int y);
	__property tagPOINT PolySel[int idx] = {read=GetPolySel};
	__property int PolySelCount = {read=GetPolySelCount, nodefault};
	__property PPointArray PolySelPoints = {read=GetPolySelArray};
	__property bool Selected = {read=fSel, nodefault};
	__property bool VisibleSelection = {read=GetVisibleSelection, write=SetVisibleSelection, nodefault}
		;
	int __fastcall AnimPolygonNew(Graphics::TColor VColor1, Graphics::TColor VColor2, bool VAnimated);
	void __fastcall AnimPolygonDel(int ap);
	void __fastcall AnimPolygonAddPt(int ap, int x, int y);
	void __fastcall AnimPolygonClear(int ap);
	void __fastcall CopyFromPolygon(Graphics::TBitmap* Source, const tagPOINT * Polygon, const int Polygon_Size
		, int PolygonLen, const tagPOINT &Position);
	void __fastcall CopyToPolygon(Graphics::TBitmap* Dest, const tagPOINT * Polygon, const int Polygon_Size
		, int PolygonLen, const tagPOINT &Position);
	virtual void __fastcall Update(void);
	void __fastcall Fit(void);
	__property int ViewX = {read=fViewX, write=SetViewX, nodefault};
	__property int ViewY = {read=fViewY, write=SetViewY, nodefault};
	void __fastcall SetViewXY(int x, int y);
	__property int Zoom = {read=fZoom, write=SetZoom, nodefault};
	void __fastcall ZoomSelection(void);
	void __fastcall ZoomAt(int x, int y, int ZoomVal);
	__property ClientWidth ;
	__property ClientHeight ;
	__property int IdealComponentWidth = {read=GetIdealComponentWidth, nodefault};
	__property int IdealComponentHeight = {read=GetIdealComponentHeight, nodefault};
	void __fastcall LockPaint(void);
	int __fastcall UnLockPaint(void);
	int __fastcall NPUnLockPaint(void);
	__property int LockPaintCount = {read=fLockPaint, nodefault};
	HIDESBASE virtual void __fastcall PaintTo(Graphics::TCanvas* Canvas);
	void __fastcall DrawTo(Graphics::TCanvas* Canvas);
	__property int OffsetX = {read=fOffX, nodefault};
	__property int OffsetY = {read=fOffY, nodefault};
	__property int ExtentX = {read=fExtX, nodefault};
	__property int ExtentY = {read=fExtY, nodefault};
	__property bool DelayZoomFilter = {read=fDelayZoomFilter, write=fDelayZoomFilter, default=0};
	__property MouseCapture ;
	Graphics::TCanvas* __fastcall GetCanvas(void);
	virtual void __fastcall Assign(Classes::TPersistent* Source);
	void __fastcall AssignSelTo(Classes::TPersistent* Dest);
	virtual void __fastcall ImageChange(void);
	int __fastcall YScr2Bmp(int y);
	int __fastcall XScr2Bmp(int x);
	int __fastcall YBmp2Scr(int y);
	int __fastcall XBmp2Scr(int x);
	virtual void __fastcall SetBounds(int ALeft, int ATop, int AWidth, int AHeight);
	__property Graphics::TColor SelColor1 = {read=GetSelColor1, write=SetSelColor1, default=0};
	__property Graphics::TColor SelColor2 = {read=GetSelColor2, write=SetSelColor2, default=16777215};
	void __fastcall Clear(void);
	void __fastcall Blank(void);
	
__published:
	__property Iedefs::TResampleFilter ZoomFilter = {read=fZoomFilter, write=SetZoomFilter, default=0};
		
	__property Stdctrls::TScrollStyle ScrollBars = {read=fScrollBars, write=SetScrollBars, default=0};
	__property TViewChangeEvent OnViewChange = {read=fOnViewChange, write=fOnViewChange};
	__property Classes::TNotifyEvent OnImageChange = {read=fOnImageChange, write=fOnImageChange};
	__property bool AnimatedSel = {read=GetAnimatedSel, write=SetAnimatedSel, default=1};
	__property bool Center = {read=fCenter, write=SetCenter, default=0};
	__property TIEMouseInteract MouseInteract = {read=GetMouseInteract, write=SetMouseInteract, default=0
		};
	__property bool DoubleBuffer = {read=fDoubleBuffer, write=fDoubleBuffer, default=0};
	__property bool AutoFit = {read=fAutoFit, write=fAutoFit, default=0};
	__property TIESelectionBase SelectionBase = {read=fSelectionBase, write=fSelectionBase, default=0};
		
	__property TIEBackgroundStyle BackgroundStyle = {read=fBackgroundStyle, write=SetBackgroundStyle, default=0
		};
	__property Classes::TNotifyEvent OnSelectionChange = {read=fOnSelectionChange, write=fOnSelectionChange
		};
	__property Align ;
	__property DragCursor ;
	__property DragMode ;
	__property Enabled ;
	__property ParentShowHint ;
	__property PopupMenu ;
	__property ShowHint ;
	__property Visible ;
	__property TabOrder ;
	__property TabStop ;
	__property OnClick ;
	__property OnDblClick ;
	__property OnDragDrop ;
	__property OnDragOver ;
	__property OnEndDrag ;
	__property OnMouseDown ;
	__property OnMouseMove ;
	__property OnMouseUp ;
	__property OnStartDrag ;
	__property OnKeyDown ;
	__property OnKeyPress ;
	__property OnKeyUp ;
public:
	/* TWinControl.CreateParented */ __fastcall TImageEnView(HWND ParentWindow) : Imageenview::TIEView(
		ParentWindow) { }
	
};

//-- var, const, procedure ---------------------------------------------------
#define DDF_UPDATE (Byte)(2)
#define DDF_SAME_HDC (Byte)(4)
#define DDF_SAME_DRAW (Byte)(8)
#define DDF_DONTDRAW (Byte)(16)
#define DDF_ANIMATE (Byte)(32)
#define DDF_BUFFER (Byte)(64)
#define DDF_JUSTDRAWIT (Byte)(128)
#define DDF_FULLSCREEN (Word)(256)
#define DDF_BACKGROUNDPAL (Word)(512)
#define DDF_NOTKEYFRAME (Word)(1024)
#define DDF_HURRYUP (Word)(2048)
#define DDF_HALFTONE (Word)(4096)
#define DDF_PREROLL (Byte)(16)
#define DDF_SAME_DIB (Byte)(8)
#define DDF_SAME_SIZE (Byte)(8)
#define PD_CAN_DRAW_DIB (Byte)(1)
#define PD_CAN_STRETCHDIB (Byte)(2)
#define PD_STRETCHDIB_1_1_OK (Byte)(4)
#define PD_STRETCHDIB_1_2_OK (Byte)(8)
#define PD_STRETCHDIB_1_N_OK (Byte)(16)
extern PACKAGE int gAnimDim;
extern PACKAGE int gSystemColors;
extern PACKAGE int gSystemDPIX;
extern PACKAGE int gSystemDPIY;
extern "C" bool __stdcall DrawDibBegin(int hdd, int hDC, int dxDest, int dyDest, tagBITMAPINFOHEADER 
	&lpbi, int dxSrc, int dySrc, int wFlags);
extern "C" bool __stdcall DrawDibChangePalette(int hdd, int iStart, int iLen, tagPALETTEENTRY &lppe)
	;
extern "C" bool __stdcall DrawDibClose(int hdd);
extern "C" bool __stdcall DrawDibDraw(int hdd, int hDC, int xDst, int yDst, int dxDst, int dyDst, tagBITMAPINFOHEADER 
	&lpbi, void * Bits, int xSrc, int ySrc, int dxSrc, int dySrc, int wFlags);
extern "C" bool __stdcall DrawDibEnd(int hdd);
extern "C" void * __stdcall DrawDibGetBuffer(int hdd, tagBITMAPINFOHEADER &lpbi, int dwSize, int dwFlags
	);
extern "C" int __stdcall DrawDibGetPalette(int hdd);
extern "C" int __stdcall DrawDibOpen(void);
extern "C" bool __stdcall DrawDibProfileDisplay(tagBITMAPINFOHEADER &lpbi);
extern "C" int __stdcall DrawDibRealize(int hdd, int hDC, BOOL fBackground);
extern "C" bool __stdcall DrawDibSetPalette(int hdd, int hpal);
extern "C" bool __stdcall DrawDibStart(int hdd, int rate);
extern "C" bool __stdcall DrawDibStop(int hdd);
extern "C" bool __stdcall DrawDibTime(int hdd, TDrawDibTime &lpddtime);
extern PACKAGE void __fastcall SetSBPageSize(int HScrollBar, int fnBar, int PageSize, bool Redraw);
extern PACKAGE void __fastcall InitializeBitmapInfoHeader(HBITMAP Bitmap, tagBITMAPINFOHEADER &BI, int 
	Colors);
extern PACKAGE bool __fastcall _IsRectangle(PPointArray p, int n);

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