0

hi, im creating a simple image editor/drawer and im having problems with flicker when the canvas is refreshd on draw.

ive got

frmPMain->DoubleBuffered = true;

on my form, but im still getting bad flicker when i run my draw shape code such as

void Pixie_Draw::DragSquare( int X, int Y, int Width, int Height, TImage* OriginalImage,Graphics::TBitmap* BackBuffer)
{
  Graphics::TBitmap* result = new Graphics::TBitmap();
  result->Assign(BackBuffer);
  result->Canvas->Rectangle(X,Y,Height,Width);

  OriginalImage->Picture->Bitmap->Assign(result);

  delete result;
}

are there any other methods i can use to remove it?
im using Borland C++ 6

thanks

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by luthor112
0

BUMP

anyone got any ideas?! ^.^

after reading a bit more material online, i think it has somthing to do with when repaints called by the assign and the img is cleard and so dosnt have a image for a split second before the new image is aplied and refreshd? am i right there?
if so how can i stop the bugger from doing it! lol

thanks

-1

Dear OnIIcE!

If your problem is that there's no image for a split second, then You could create another TImage and copy tho contects of the old one to this, than assign the new image to the old TImage and destroy the new one.
Or You don't even have to create and destroy the new TImage every time, you can can just set its "Visible" property to true and false. At the start of your program it should be false.

Hope I helped.

Your piece of code about doublebuffering really helped me - I had a flickering canvas, too.

Thank You!

- L.

Votes + Comments
Driveby bump and run
Maybe someone else will have the same question and google it, and find this
Thanks for BUMPing a 2+ year old thread. He's been waiting long enough for your answer.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.