ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 iexHelperFunctions in Delphi 7
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

hughnohilly

1 Posts

Posted - Jul 30 2015 :  03:44:27  Show Profile  Reply
I am trying to use IELoadFromStreamFast in Delphi 7, but Helper Functions can't be used!!

The function itself calls lots of other Helper functions, so I wondering if anyone had already managed to get it working in Delphi 7? If so, how?

Thanks in advance

xequte

38616 Posts

Posted - Jul 31 2015 :  05:27:41  Show Profile  Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: