Function Clone:PBitmap;
Creates an exact copy of the bitmap.
Function GetData:pointer;
Returns a pointer to the image for use with PutImage.
PutImage(0, 0, Bitmap.GetData^);
Function GetPalette:PPalette;
Returns a pointer to the palette of the image, the palette is an array of 256 longints. The result is nil if the bitmap contains no palette.
Bits | Contents |
0 - 7: | Value for Blue color component |
8 - 15: | Value for Green color component |
16 - 24: | Value for Red color component |
25 - 31: | un-used |
The layout of a palet entry.
if Bitmap.HasPalette then setRGBPalette(Bitmap.GetPalette);
Function GetSize:longint;
Returns the amount of memory allocated for the image. The amount of memory required for an image is calculated as follows: 4 + width * height * BytesPerPixel.
Function HasPalette:boolean;
Returns true if the bitmap contains a palette.
GetPalette
Function LoadFromFile(Filename: string):boolean;
LoadFromFile loads an image file, and returns true if succesfull.
uses graph, bitmaps, bmp; var Bitmap:TBitmap; GraphDriver, GraphMode: integer; begin GraphDriver := Detect; InitGraph(GraphDriver, GraphMode, ''); Bitmap.Create; if Bitmap.LoadFromFile('bitmap.bmp') then begin PutImage((GetMaxX + 1 - Bitmap.getWidth) shr 1, (GetMaxY + 1 - Bitmap.getHeight) shr 1, Bitmap.getData^); end ; Bitmap.Destroy; CloseGraph; end .
Procedure SetWidth(value: word);
Sets the width of the image to value.
Procedure SetHeight(value: word);
Sets the height of the image to value.
procedure ScaleTo(AWidth, AHeight: word);
Scales the image.
Bitmap.ScaleTo(Bitmap.GetWidth*2, Bitmap.GetHeight*2);
Procedure SetBytesPerPixel(value: word);
Sets the number of bytes required per pixel. This value should match the number of bytes per pixel of the current video mode. Possible values are: 1 for 8 bit modes, 2 for 15/16 bit modes and 4 for 24/32 bit modes.
Bitmap.setBytesPerPixel(2);
Gertjan Schouten