ich habe ähnlich Funktion wie oben um *.jpg, png, emf, ... in eine TBitMap zuladen, als Ergänzung das Laden *.tif ....
unit Unit_TTifImage;
/// ************************************************** ************************
///
/// TTifImage, pretty similar to pngimage, jpgimage ....
///
///
///
/// ************************************************** ************************
interface
uses Windows, { Windows
API Funktionen }
Graphics, { pf1bit, pf... }
types, { Rect }
Classes,
ExtCtrls,
Dialogs;
type TTifImage = Class(TBitMap)
procedure LoadFromFile (const Filename: String); override;
procedure SaveToFile (const Filename: String); override;
end;
implementation
{ TTifImage }
///
/// see eg.
http://www.delphipraxis.net/.....
///
procedure TTifImage.LoadFromFile(const Filename: String);
var aImage : TImage;
begin
try
aImage :=TImage.Create(nil);
aImage.Picture.LoadFromFile(Filename);
self.Width := aImage.Picture.Width;
self.Height := aImage.Picture.Height;
self.Canvas.Draw(0, 0, aImage.Picture.Graphic);
finally
aImage.Free;
end;
end;
///
/// not yet tested ...
///
procedure TTifImage.SaveToFile(const Filename: String);
var aImage : TImage;
begin
try
aImage :=TImage.Create(nil);
aImage.Picture.Bitmap.Assign(self);
aImage.Picture.SaveToFile(Filename);
finally
aImage.Free;
end;
end;
end.