Solved

Image.beginupdate ?

Posted on 2001-08-25
6
827 Views
Last Modified: 2010-04-06
I'm doing lot of drawing on the canvas in a image, this has the bad effect that some other images on the form flickers from time to time.
Is there a way to make it more flicker free.
I thought of LockWindowUpdate but as remember this seems to make all windows flicker.
0
Comment
Question by:bnz
6 Comments
 
LVL 33

Expert Comment

by:Slick812
ID: 6425849
I'm not sure how many times you are drawing on the image canvas, but since you said 'alot', you may want to try what's called page filpping. Whenever you draw directly on a visible canvas rapidly and a draw does NOT sync with the monitor's refresh rate you get some flicker. Try to not draw something on a part of a visible canvas. Only replace the ENTIRE image with a memory bitmap that you have drawn on. Flip a whole page to the image instead of a piece of a page. This may seem like a backwards way (more work instead of less) to do it, but it tends to sync together with the refresh rate better. Oh, a TImage has some update routines that may kick in. You may want to try a PaintBox or Do all the rapid drawing in a Rect on the Form's Canvas. If your drawing is not rapid, you could try DoubleBuffer := True;
0
 
LVL 3

Expert Comment

by:Slavak
ID: 6426002
I has the same problems with standard delphi components. Best solution I found it do NOT use it, if you want nice graphic application.
I use components from http://www.stuckindoors.com/dib/.
It solved most of my problems. The biggest disadvantage (for me) is that it cannot run in 256 colors mode.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6426668
maybe it helps to place the timage on a tpanel
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:bnz
ID: 6426715
Slick812: I tried to create an invisible image and then paint on the real image using this code     VisibleImage.Canvas.Draw(0,0, TempImage);

It helps a bit but not much, am I doing the right thing?

Slavak: thanks for you tip, the component does not work with Delphi 6 yet, so I will way for that to come.
0
 
LVL 33

Accepted Solution

by:
Slick812 earned 100 total points
ID: 6427478
yea bnz, thats the idea, , , you did not say if you are rapidly drawing on the canvas (more that 5 changes a second or so), Like I said I think the TImage has some canvas updates that kick in when you draw on it, , I do not use a TImage EVER, to do rapid drawing on it's canvas. I use a PaintBox (you can use the canvas of a TPanel too), what you will have to add is the Bitmap drawn on it in it's OnPaint event. So it will not disapear when it is refreshed. I think the TImage was made mostly for static (NON-changing) images. I beleive it handles its canvas a little differently than other controls. I have done some very rapid page flipping on a TPaintBox without the flicker (if it's size gets Large then it will slow down for the time it takes to draw the images)
0
 

Author Comment

by:bnz
ID: 6428016
Ahh now I get it. You are right, I used a paintbox and 99% flicker free :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now