Board index » delphi » TImage flickers. Please Help

TImage flickers. Please Help

Hi have problems with the TImage component. I display a scrolling
credit text
infront of a Background image. I am using offscreen images, but it
does not work. DST is the TImage and off the offscreen image, bmp is
the background.
I also tried to set LockWindowUpdate, but this did not fix the
problem.

var
  yh: integer;
  colorvalue: integer;
  x: Integer;
  R: TRect;
begin
  i := 0;
  yh := 18;
  currenty := currenty - 1;

  off.Canvas.Brush.Style := bsClear;
  off.Assign(bmp);

  while Authors[i] <> '' do
  begin
    colorvalue := round((power((currenty + (i * yh) - 85), 2)) / 5);
    if Colorvalue > 196 then Colorvalue := 196;
    x := off.Canvas.TextWidth(Authors[i]);

    off.Canvas.Font.Color := clSilver;
    off.Canvas.Font.Name := 'Terminal';
    off.Canvas.Font.Size := 14;
    off.Canvas.TextOut((off.Width div 2) - (x div 2),
      currenty + 1 + (i * yh), Authors[i]);
    off.Canvas.Font.Color := RGB(colorvalue, colorvalue, colorvalue);
    off.Canvas.TextOut((off.Width div 2) - (x div 2),
      currenty + (i * yh), Authors[i]);
    off.Canvas.Rectangle(0, 0, off.Width, off.Height);

    Inc(i);
  end;
  if (currenty + (i * yh)) < -5 then currenty := off.Height;

  R := Rect(0, 0, Dst.Width, Dst.Height);
  Dst.Canvas.CopyRect(R, off.Canvas, R);
end;

~AzreAl

 

Re:TImage flickers. Please Help


Hi,

I had the same problem. But I have found a website which contains the
solution for that.
Here's the adress: http://www.delphigamedev.com/
Look at Tutorials and Articles. There you can find an example of flickerless
animation with a timage.

Regards,

Kevin.

Quote
"Julian Knauer" <j-...@gmx.de> wrote in message

news:a691e712.0112010642.41148b8d@posting.google.com...
Quote
> Hi have problems with the TImage component. I display a scrolling
> credit text
> infront of a Background image. I am using offscreen images, but it
> does not work. DST is the TImage and off the offscreen image, bmp is
> the background.
> I also tried to set LockWindowUpdate, but this did not fix the
> problem.

> var
>   yh: integer;
>   colorvalue: integer;
>   x: Integer;
>   R: TRect;
> begin
>   i := 0;
>   yh := 18;
>   currenty := currenty - 1;

>   off.Canvas.Brush.Style := bsClear;
>   off.Assign(bmp);

>   while Authors[i] <> '' do
>   begin
>     colorvalue := round((power((currenty + (i * yh) - 85), 2)) / 5);
>     if Colorvalue > 196 then Colorvalue := 196;
>     x := off.Canvas.TextWidth(Authors[i]);

>     off.Canvas.Font.Color := clSilver;
>     off.Canvas.Font.Name := 'Terminal';
>     off.Canvas.Font.Size := 14;
>     off.Canvas.TextOut((off.Width div 2) - (x div 2),
>       currenty + 1 + (i * yh), Authors[i]);
>     off.Canvas.Font.Color := RGB(colorvalue, colorvalue, colorvalue);
>     off.Canvas.TextOut((off.Width div 2) - (x div 2),
>       currenty + (i * yh), Authors[i]);
>     off.Canvas.Rectangle(0, 0, off.Width, off.Height);

>     Inc(i);
>   end;
>   if (currenty + (i * yh)) < -5 then currenty := off.Height;

>   R := Rect(0, 0, Dst.Width, Dst.Height);
>   Dst.Canvas.CopyRect(R, off.Canvas, R);
> end;

> ~AzreAl

Other Threads