TPicshow : redrawWindow replaced by function

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

TPicshow : redrawWindow replaced by function

Postby Tisseyre » June 20th, 2011, 3:19 pm

{hi Kambiz
I am looking to speed up image display when i click on a drawGrid...
For example if i write a function witch return a bitmap instead of a procedure as you do with :
"RedrawWindow(WindowHandle, @DisplayRect, 0, RDW_INVALIDATE or RDW_UPDATENOW);"
I create a TPicture and i write : form1.image1.picture.Assign(Picshow1.GetImgProgress(value))
This is interesting, profitable or binding? #-o
}
function TCustomPicShow.GetImgProgress(Value: TMaxi) : TBitmap; //(TMaxi ~~ TProgress)
begin
result := nil;
if Busy and not display.empty then begin
EnterCriticalSection(CS);
try fProgress := Value;
UpdateDisplay;
result:= display;
finally LeaveCriticalSection(CS); end;
end;

//my bitmap is formatted but with a TPicture the result is faster of course
//thank you for your opinion
Tisseyre
Active Member
Active Member
 
Posts: 10
Joined: November 23rd, 2010, 10:36 am

Re: TPicshow : redrawWindow replaced by function

Postby Kambiz » June 21st, 2011, 4:53 pm

TImage is a non-windowed control and uses its parent canvas to draw itself. It's lightweight, but you will encounter some problem regarding flickering and thread synchronization.

In other hand, assigning the new frame to an image may looks simpler and faster, but besides updating the image it does some additional tasks that are redundant in our case.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron