faster graphics in C++ Builder ???

Started by
1 comment, last by Miso 22 years, 5 months ago
Hi, is there a faster way of plotting pixels on a Image Canvas then using Pixels[x][y]?? I need to plot a pixel and then display it right away, so that the user can see the progress. For this purpose I created a function that calls Application->ProcessMessages until a certain time in mseconds has elapsed. This way every change on the canvas can be seen on the screen. But it is VERY slow. If I don''t include this function, only when the whole picture is completed the Canvas in repainted, which I don''t want. Like this: void MyWait(ms : word) { TDateTime t; t = Time(); while (Time() <= t + EncodeTime(0,0,0,ms)) Application->ProcessMessages(); } void PutPixel(int x, int y, TColor color) { Form1->Image1->Canvas->Pixels[x][y] = color; myWait(1); } PutPixel is called from a line and an arc drawing function. This method is slow. Is there another way? Thanks.
Advertisement
Apparently the native Windows API call to set a pixel is orders of magnitude faster than using the pixels property.

"A society without religion is like a crazed psychopath without a loaded .45"
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Use the ScanLines property. But you must realize that the data returned by this array is in the pixel format of the image. take a look at Manipulating Pixels With Delphi''s ScanLine Property for more information and sample code (in Delphi but easily convertable).

Steve ''Sly'' Williams  Monkey Wrangler  Krome Studios
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers

This topic is closed to new replies.

Advertisement