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
 Image loading with TImageEn AsynchMode

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
harry113 Posted - Sep 16 2015 : 10:56:40
Hi,

Can I use TImageEn AsychMode to load 2 or more different images different TIEBitmaps in parallel?

Something like this example from the help file but for loading?

// multithread saving
Var
Bmp: TIEBitmap;
Io: TImageEnIO;
Begin
Bmp := TIEBitmap.Create;
Io := TImageEnIO.CreateFromBitmap(bmp);

Io.LoadFromFile('C:\input.bmp');
Io.AsyncMode := True; // this makes a thread foreach input/output task
Io.SaveToFile('D:\i1.jpg'); // thread-1
Io.SaveToFile('D:\i2.jpg'); // thread-2
Io.SaveToFile('D:\i3.jpg'); // thread-3

// waits all threads finish
Io.WaitThreads();
...
End;




3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Sep 17 2015 : 21:23:11
Hi Harry

That code should work fine. I just tested it to be sure. If you are seeing a crash please post a full example.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
harry113 Posted - Sep 17 2015 : 03:34:42
Hi,

I tried to do it that way,
...

bm1:= TIEBitmap.create;
bm2:= TIEBitmap.create;

IO1:= TImageEnIO.Create(nil);
IO2:= TImageEnIO.Create(nil);


IO1.AsyncMode:= True;
IO2.AsyncMode:= True;

IO1.AttachedIEBitmap:= bm1;
IO2.AttachedIEBitmap:= bm2;

IO1.LoadFromFile('File1.jpg');
IO2.LoadFromFile('File2.jpg');

IO1.WaitThreads;
IO2.WaitThreads;

FreeAndNil(IO1);
FreeAndNil(IO2);

...

Ofcourse after loading I need bm1 und bm2 for further work.

In my example I used this schema to load up to 8 files in parallel with mixed results - WaitThreads crashed, empty bm1, access violations etc...

Is there some sample Code for loading files in parallel in Asynch Mode?

Best Regards,

Harry

xequte Posted - Sep 17 2015 : 01:16:23
Hi

A TIEBitmap can only store one image, so if you load two images simultaneosly, the second image would replace the first one. Why not just create two TImageEnIO's?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com