BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Simple Slide Show

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Ed Dressel
Guest





PostPosted: Wed Apr 07, 2004 11:50 pm    Post subject: Simple Slide Show Reply with quote



I've tried to create a simple slide show for showing *.jpg files found in a
selected directory, but what seems should be easy is in fact not: inbetween
images (I have two images (TImage) for buffering the up coming slide and
load the image in a separate thread). Switching between the two images can
sometimes take a moment, othertimes its quick.

My code is quite clean, using a timer it just toggles the visiblity of two
images (calling SendToBack removes some flicker, but I still get dead spots
inbetween showing the images):

if not Image1.Visible then
begin
Image1.SendToBack;
Image1.Visible := True;
Image2.Visible := False;
end
else
begin
Image2.SendToBack;
Image2.Visible := True;
Image1.Visible := False;
end;

I also tried LockWindowHandle before calling the code above and that
guarentees that the flicker will occur.

Any easy way of removing the flicker?

Thanks
Ed Dressel


Back to top
Nils Haeck
Guest





PostPosted: Thu Apr 08, 2004 12:11 am    Post subject: Re: Simple Slide Show Reply with quote



What about using just one TImage?

You can easily load a JPEG in a TBitmap, using something like

procedure LoadJpegInBitmap(Name: string; Bitmap: TBitmap);
begin
AJpeg := TJpegImage.Create;
try
AJpeg.LoadFromFile(Name);
Bitmap.Assign(AJpeg);
finally
AJpeg.Free;
end;
end;

Next, when you have the bitmap, you can simply assign it to the image:

Image1.Picture.Bitmap.Assign(MyBitmap);

This should reduce flicker. You can reuse MyBitmap or create it before each
load as you wish.

An additional way to reduce flicker is by setting Image1.DoubleBuffered :=
True;

Kind regards,

Nils Haeck
www.simdesign.nl


"Ed Dressel" <none> wrote

Quote:
I've tried to create a simple slide show for showing *.jpg files found in
a
selected directory, but what seems should be easy is in fact not:
inbetween
images (I have two images (TImage) for buffering the up coming slide and
load the image in a separate thread). Switching between the two images can
sometimes take a moment, othertimes its quick.

My code is quite clean, using a timer it just toggles the visiblity of two
images (calling SendToBack removes some flicker, but I still get dead
spots
inbetween showing the images):

if not Image1.Visible then
begin
Image1.SendToBack;
Image1.Visible := True;
Image2.Visible := False;
end
else
begin
Image2.SendToBack;
Image2.Visible := True;
Image1.Visible := False;
end;

I also tried LockWindowHandle before calling the code above and that
guarentees that the flicker will occur.

Any easy way of removing the flicker?

Thanks
Ed Dressel





Back to top
Uwe
Guest





PostPosted: Thu Apr 08, 2004 12:58 am    Post subject: Re: Simple Slide Show Reply with quote



Hi Ed

Did you try Kambiz' TPicShow? Great slide show component, and free with
source! Maybe it gives you some ideas.

URL: http://www.delphiarea.com/products/picshow/



Cheers
Uwe

The Delphi Pool
http://www.lmc-mediaagentur.de/dpool.htm


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.