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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 iexHelperFunctions in Delphi 7

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
hughnohilly Posted - Jul 30 2015 : 03:44:27
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
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jul 31 2015 : 05:27:41
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