Class TBigBitmapViewer (unit BitView) |
Inherits from
TGraphicControl
filename will have its owner property editor Is this use for "type" documented anywhere?
constructor Create (AOwner : TComponent);
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.
procedure OpenViewer;
Open the file for viewing, here is the memory mapped file stuff.
procedure Paint;
The viewer PAINT method.
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);
property Active : boolean
viewer activate - stream active last!
property Align :
TGraphicControl PROPS NOW PUBLISHED
property AutoSize : boolean
READ-WRITE PROPS size control to bitmap
property BitmapHeight : integer
bitmap width
property BitmapWidth : integer
bitmap height
property Centre : boolean
bitmap centred
property Colours : integer
READ-ONLY PROPS number of colours in the bitmap palette
property DragCursor :
property DragMode :
property Enabled :
property Filename : TBMPFilename
filename of bitmap
property ParentShowHint :
property PopupMenu :
property ShowHint :
property Stretch : boolean
stretch bitmap
property Visible :
property BitmapFileHeader : PBitmapFileHeader
pointer to the file header info
property BitmapInfo : PBitmapInfo
pointer to the bitmap info
property BitmapInfoHeader : PBitmapInfoHeader
pointer to the bitmap info header
property Palette : HPalette
palette handle
property PixelStart : pointer
pointer to the bitmap pixel data array
event OnClick :
event OnDblClick :
event OnDragDrop :
event OnDragOver :
event OnEndDrag :
event OnMouseDown :
event OnMouseMove :
event OnMouseUp :
event OnStartDrag :
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
constructor Create (AOwner : TComponent);
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);
property Active : boolean
viewer activate - stream active last!
property Align :
TGraphicControl PROPS NOW PUBLISHED
property AutoSize : boolean
READ-WRITE PROPS size control to bitmap
property BitmapHeight : integer
bitmap width
property BitmapWidth : integer
bitmap height
property Centre : boolean
bitmap centred
property Colours : integer
READ-ONLY PROPS number of colours in the bitmap palette
property DragCursor :
property DragMode :
property Enabled :
property Filename : TBMPFilename
filename of bitmap
property ParentShowHint :
property PopupMenu :
property ShowHint :
property Stretch : boolean
stretch bitmap
property Visible :
property BitmapFileHeader : PBitmapFileHeader
pointer to the file header info
property BitmapInfo : PBitmapInfo
pointer to the bitmap info
property BitmapInfoHeader : PBitmapInfoHeader
pointer to the bitmap info header
property Palette : HPalette
palette handle
property PixelStart : pointer
pointer to the bitmap pixel data array
event OnClick :
event OnDblClick :
event OnDragDrop :
event OnDragOver :
event OnEndDrag :
event OnMouseDown :
event OnMouseMove :
event OnMouseUp :
event OnStartDrag :
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