Solved

Image.beginupdate ?

Posted on 2001-08-25
6
848 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 34

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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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 34

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

792 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