Board index » cppbuilder » TImage flicker

TImage flicker


2006-10-21 12:10:55 AM
cppbuilder67
Hi,
I have:
void __fastcall TPreplot::ImageMouseMove(TObject *Sender, TShiftState
Shift, int X, int Y)
{
if(Panning)
{
Image->Align = alNone;
Image->Top += Y - OrigY;
Image->Left += X - OrigX;
return;
}
}
when the image pans it flickers. How can I stop the flickering?
Cheers,
Paul
 
 

Re:TImage flicker

Quote
when the image pans it flickers. How can I stop the flickering?
__fastcall TPreplot::TPreplot(TComponent* Owner)
: TForm(Owner)
{
// ...
DoubleBuffered = true;
// ...
}
--
Best Regards,
Vladimir Stefanovic
 

Re:TImage flicker

this has no effect
Vladimir Stefanovic wrote:
Quote
>when the image pans it flickers. How can I stop the flickering?

__fastcall TPreplot::TPreplot(TComponent* Owner)
: TForm(Owner)
{
// ...
DoubleBuffered = true;
// ...
}



 

{smallsort}

Re:TImage flicker

Try Image->Canvas->Brush->Style=bsClear
"Paul Dowd" < XXXX@XXXXX.COM >ha scritto nel messaggio
Quote
this has no effect

Vladimir Stefanovic wrote:
>>when the image pans it flickers. How can I stop the flickering?
>
>__fastcall TPreplot::TPreplot(TComponent* Owner)
>: TForm(Owner)
>{
>// ...
>DoubleBuffered = true;
>// ...
>}
>
>
 

Re:TImage flicker

Paul Dowd < XXXX@XXXXX.COM >wrote:
Quote

[...] when the image pans it flickers.
What do you mean by 'pans'?
Quote
How can I stop the flickering?
Stop setting it's Left and Top with every move of the mouse.
That causes the TImage to repaint twice with event and if you
have the Stretched property set to true it's even slower.
Since Window's can handle moving a large area without flicker,
it has to be your technique. Please explain exactly what you're
trying to accomplish. I'd bet that you can acomplish it with a
TBitmap or two instead of using a TImage.
~ JD
 

Re:TImage flicker

in place of setting Left and top with 2 different lines (=>2 different
calls) you can use Image->SetBounds ... I think
"JD" < XXXX@XXXXX.COM >ha scritto nel messaggio
Quote

Paul Dowd < XXXX@XXXXX.COM >wrote:
>
>[...] when the image pans it flickers.

What do you mean by 'pans'?

>How can I stop the flickering?

Stop setting it's Left and Top with every move of the mouse.
That causes the TImage to repaint twice with event and if you
have the Stretched property set to true it's even slower.

Since Window's can handle moving a large area without flicker,
it has to be your technique. Please explain exactly what you're
trying to accomplish. I'd bet that you can acomplish it with a
TBitmap or two instead of using a TImage.

~ JD

 

Re:TImage flicker

Hi all,
After trying your various suggestions I have come to the conclusion that
the problem is just the refresh rate of the monitor.
Many thanks
Paul
Paul Dowd wrote:
Quote
Hi,

I have:

void __fastcall TPreplot::ImageMouseMove(TObject *Sender, TShiftState
Shift, int X, int Y)
{
if(Panning)
{
Image->Align = alNone;
Image->Top += Y - OrigY;
Image->Left += X - OrigX;
return;
}
}

when the image pans it flickers. How can I stop the flickering?

Cheers,
Paul
 

Re:TImage flicker

Hi,
I actually posted a message saying that perhaps the problem was the
screen refresh rate, this is not the case.
I am trying to produce an image that can be zoomed in on by drawing a
rectangle on it and then panned by dragging using the mouse, similar to,
say, a PDF document. I have achieved all this but the flickering is
still a problem. How could I do this using a TBitmap instead of a TImage?
Paul
Quote
>
>Since Window's can handle moving a large area without flicker,
>it has to be your technique. Please explain exactly what you're
>trying to accomplish. I'd bet that you can acomplish it with a
>TBitmap or two instead of using a TImage.
>
>~ JD
>


 

Re:TImage flicker

Paul Dowd < XXXX@XXXXX.COM >wrote:
Quote

I am trying to produce an image that can be zoomed in on by
drawing a rectangle on it and then panned by dragging using
the mouse,
Then I would suggest that you not draw into the TImage's
Canvas because each time it's content changes, it needs to
redraw.
Quote
How could I do this using a TBitmap instead of a TImage?
You're still going to have problems because it's your design
that requires all of the painting. If you want to get rid of
the flicker, your code must eliminate the need to constantly
repaint the image.
The easiest way for you at this point is to use a second TImage
that is transparent and overlays the other TImage exactly. Set
it's Transparent property to true and fill it's Canvas with
the same color (bottom/left pixel determines the transparent
color). Should take you about 5 minutes to fix it.
~ JD
 

Re:TImage flicker

No,
The problem likely is the internal invalidate.
To get rid of it you should intercept the OnPaint event and draw the image
using Canvas->Draw(x,y,Bitmap) without using Invalidate.
"Paul Dowd" < XXXX@XXXXX.COM >ha scritto nel messaggio
Quote
Hi all,

After trying your various suggestions I have come to the conclusion that
the problem is just the refresh rate of the monitor.

Many thanks
Paul

Paul Dowd wrote:
>Hi,
>
>I have:
>
>void __fastcall TPreplot::ImageMouseMove(TObject *Sender, TShiftState
>Shift, int X, int Y)
>{
>if(Panning)
>{
>Image->Align = alNone;
>Image->Top += Y - OrigY;
>Image->Left += X - OrigX;
>return;
>}
>}
>
>when the image pans it flickers. How can I stop the flickering?
>
>Cheers,
>Paul
 

Re:TImage flicker

Paul Dowd wrote:
Quote
if(Panning)
{
Image->Align = alNone;
Image->Top += Y - OrigY;
Image->Left += X - OrigX;
return;
}
}
This may be a little long winded, but hopefully it will help.
web.archive.org/web/20040213233900/www.bcbdev.com/faqs/faq34.htm
H^2
 

Re:TImage flicker

Harold,
This article is great - problem solved! Many thanks,
Paul
Harold Howe [TeamB] wrote:
Quote
Paul Dowd wrote:

>if(Panning)
>{
>Image->Align = alNone;
>Image->Top += Y - OrigY;
>Image->Left += X - OrigX;
>return;
>}
>}

This may be a little long winded, but hopefully it will help.

web.archive.org/web/20040213233900/www.bcbdev.com/faqs/faq34.htm

H^2