| Class TBigBitmapViewer (unit BitView) |
TGraphicControl
filename will have its owner property editor Is this use for "type" documented anywhere?
| Constructors |
constructor Create (AOwner : TComponent);| Functions |
procedure Close;set active to false
destructor Destroy;
procedure Open;set active to true
procedure Changes;Process changes to the TGraphicControl depending on size of the image compared to the form.
procedure CloseViewer;
procedure GetBitmapPalette;
procedure OpenViewer;
procedure Paint;
procedure SetActive (Value : boolean);Property Methods:
procedure SetAutoSize (Value : boolean);
procedure SetCentre (Value : boolean);
procedure SetDummyInt (Value : integer);
procedure SetFilename (const Value : TBMPFilename);
procedure SetStretch (Value : boolean);| Properties |
property Active : boolean
property Align :
property AutoSize : boolean
property BitmapHeight : integer
property BitmapWidth : integer
property Centre : boolean
property Colours : integer
property DragCursor :
property DragMode :
property Enabled :
property Filename : TBMPFilename
property ParentShowHint :
property PopupMenu :
property ShowHint :
property Stretch : boolean
property Visible :
property BitmapFileHeader : PBitmapFileHeader
property BitmapInfo : PBitmapInfo
property BitmapInfoHeader : PBitmapInfoHeader
property Palette : HPalette
property PixelStart : pointer| Events |
event OnClick :
event OnDblClick :
event OnDragDrop :
event OnDragOver :
event OnEndDrag :
event OnMouseDown :
event OnMouseMove :
event OnMouseUp :
event OnStartDrag : | Variables |
FActive : boolean;
FAutoSize : boolean;
FBitmapHeight : integer;
FBitmapWidth : integer;
FCentre : boolean;
FColours : integer;
FData : pointer;
FFileHeader : PBitmapFileHeader;
FFileName : TBMPFilename;
FInfo : PBitmapInfo;
FInfoHeader : PBitmapInfoHeader;
FPalette : HPalette;
FPixelStart : pointer;
FStretch : boolean;| Constructors |
constructor Create (AOwner : TComponent);| Functions |
procedure Close;open the viewer
set active to false
destructor Destroy;
procedure Open;close the viewer
set active to true
procedure Changes;virtual
Process changes to the TGraphicControl depending on size of the image compared to the form.
procedure CloseViewer;close the viewer by unmapping the file, setting the view to nil and discarding the palette
procedure GetBitmapPalette;This procedure takes the palette out of the bitmap. It references two values to do this (FColours - the colour count, and FInfo a pointer to TBitmapInfo record). This is a fairly standard way of getting a palette. If successful, FPalette contains a handle to a copy of the palette.
procedure OpenViewer;Open the file for viewing, here is the memory mapped file stuff. It is a simple use of memory mapped files as I only need to open the file with read permissions. The following steps are taken. 1. Get a read only file handle to the bitmap file 2. Get a file mapping using that handle 3. Get a view of the file from that handle 4. Set up some useful pointers to often used bits of the view 5. Get the palette (if present) from the view
procedure Paint;The viewer PAINT method. ----- The actions carried out here are: 1. If in design mode and not active put up a simple rectangle 2. Select and realize the bitmap palette 3. Calculate the bitmap image location taking into account the stretch and centre properties 4. Squirt the bitmap onto the canvas 5. Select the orginal palette
procedure SetActive (Value : boolean);pointer to the start of the pixel data
Property Methods:
procedure SetAutoSize (Value : boolean);
procedure SetCentre (Value : boolean);
procedure SetDummyInt (Value : integer);This dummy set integer procedure is used with the BitmapHeight and BitmapWidth properties to make them appear in the object inspector WITHOUT allowing them to be edited - ie readonly.
procedure SetFilename (const Value : TBMPFilename);
procedure SetStretch (Value : boolean);| Properties |
property Active : booleanviewer activate - stream active last!
property Align : TGraphicControl PROPS NOW PUBLISHED
property AutoSize : booleanREAD-WRITE PROPS size control to bitmap
property BitmapHeight : integerbitmap width
property BitmapWidth : integerbitmap height
property Centre : booleanbitmap centred
property Colours : integerREAD-ONLY PROPS number of colours in the bitmap palette
property DragCursor :
property DragMode :
property Enabled :
property Filename : TBMPFilenamefilename of bitmap
property ParentShowHint :
property PopupMenu :
property ShowHint :
property Stretch : booleanstretch bitmap
property Visible :
property BitmapFileHeader : PBitmapFileHeaderpointer to the file header info
property BitmapInfo : PBitmapInfopointer to the bitmap info
property BitmapInfoHeader : PBitmapInfoHeaderpointer to the bitmap info header
property Palette : HPalettepalette handle
property PixelStart : pointerpointer to the bitmap pixel data array
| Events |
event OnClick :
event OnDblClick :
event OnDragDrop :
event OnDragOver :
event OnEndDrag :
event OnMouseDown :
event OnMouseMove :
event OnMouseUp :
event OnStartDrag : | Variables |
FActive : boolean;automatically size the control to display the bitmap
FAutoSize : boolean;stretch the bitmap to fill the control
FBitmapHeight : integer;copy of bitmap width info for convience
FBitmapWidth : integer;pointer to start of data in memory mapped file
FCentre : boolean;number of colours in palette
FColours : integer;copy of bitmap height info for convience
FData : pointer;handle to bitmap palette
FFileHeader : PBitmapFileHeader;true opens the viewer, false it's closed
FFileName : TBMPFilename;
FInfo : PBitmapInfo;pointer to TBitmapInfoHeader record
FInfoHeader : PBitmapInfoHeader;pointer to TBitmapFileHeader record
FPalette : HPalette;bitmap filename, own type so it can have own prop editor
FPixelStart : pointer;pointer to the TBitmapInfo record
FStretch : boolean;centre the bitmap in the control