It really depends on what you want to do
drawing on a canvas sends the output to the screen this is slow
if you only need to draw one line in response to a user dragging the
mouse etc.. the use the canvas associated with TImage
but if you want to draw lots of lines and then put them on the screen
with minimum or no flicker then draw them to another Canvas and then
copy it to the image canvas or create your own bitmap and draw it there
and then blit that directly to the screen
you said you want fast!
fast is working directly with memory
slow is Canvas or any of the putpixel functions
> Thanks for the answer, but i still don't understand, why if
> i draw a line in a memory Bitmap and than copy it to a TImage
> on the form it would be faster then drawing it directly to the
> TImage on the first time? let's say i have TImage on the form
> with the size 100x100 pixels, and i have same size Bitmap on the
> memory. if i draw a line (0,0)-(0,70) directly to the TImage it
> will only have to draw 70 pixels and that's it. if i first copy
> it to a memory Bitmap it will draw the same 70 pixels to the
> memory, but when i copy the Bitmap to the TImage canvas it will
> have to copy and draw 100x100 pixels on the TImage!! it looks
> like it should take MUCH more time! so why is the first
> solution of drawing directly to the TImage on the first time is
> slower solution?
> What if i use 'ScanLine' to draw a line on the TImage locate on
> the form? even than it will be faster to use a memory TBitmap?
> Thanks for any help,
>>If you see my post (following yours) you will see a good reason NOT to
>>draw directly to the forms canvas.
>>I don't do this much myself but I would suggest drawing to a hidden
>>canvas as the easiest way and then copying to the visible canvas (on
>>that way your updates will be reasonably fast without adding to the
>>complexity of the project
>>it would be fastest to draw directly to a bitmap and then blit that to
>>the screen but that will add greatly to the programming required
>>> Hi, i need to draw lot of random color lines on the form as
>>> fast as possible. what is the fastest way to do this?
>>> 1. Drawing directly on the Form's canvas?
>>> 2. Drawing on TImage locate on the form?
>>> 3. Drawing on TPicture locate on the form?
>>> What will it be faster: using "MoveTo" and "LineTo" commands?
>>> or using "ScanLine" for drawing the lines pixel by pixel in a
>>> Should i draw directly to the component on the screen? (the
>>> form, the TImage...) or must i draw first on a memory Bitmap and
>>> then copy to the screen with BitBlt? why is it faster than
>>> drawing directly to the screen?
>>> Sorry for so many question, but i hope that you can help me :-)
>>> Thanks everyone!