Hi
Converting a helper function to a global function is an easy process. Just add a parameter for the object type, e.g.
BEFORE
function TBitmapHelper.IELoadFromStreamFast(Stream: TStream;
FileType: Integer;
iMaxX, iMaxY: integer;
bAutoAdjustOrientation: Boolean = False
): Boolean;
var
AImageEnIO: TImageEnIO;
begin
try
AImageEnIO := TImageEnIO.CreateFromBitmap(Self);
// Loaded image may have transparency (e.g. WMF files), so match background color to existing background of images (i.e. honour IEInitialize)
if (Width > 0) and (Height > 0) then
AImageEnIO.Background := Canvas.Pixels[0, 0];
Result := AImageEnIO.LoadFromStreamFast(Stream, FileType, iMaxX, iMaxY, bAutoAdjustOrientation);
AImageEnIO.Free;
except
result := False;
end;
end;
AFTER
function IELoadFromStreamFast(aBitmap: TBitmap;
Stream: TStream;
FileType: Integer;
iMaxX, iMaxY: integer;
bAutoAdjustOrientation: Boolean = False
): Boolean;
var
AImageEnIO: TImageEnIO;
begin
try
AImageEnIO := TImageEnIO.CreateFromBitmap(aBitmap);
// Loaded image may have transparency (e.g. WMF files), so match background color to existing background of images (i.e. honour IEInitialize)
if (aBitmap.Width > 0) and (aBitmap.Height > 0) then
AImageEnIO.Background := aBitmap.Canvas.Pixels[0, 0];
Result := AImageEnIO.LoadFromStreamFast(Stream, FileType, iMaxX, iMaxY, bAutoAdjustOrientation);
AImageEnIO.Free;
except
result := False;
end;
end;
Nigel
Xequte Software
www.xequte.com
nigel@xequte.com