Board index » delphi » Form Canvas vs Image Canvas
Raúl Andrés No Spam del Canto
![]() Delphi Developer |
Sun, 22 Aug 2004 11:26:49 GMT
|
Raúl Andrés No Spam del Canto
![]() Delphi Developer |
Sun, 22 Aug 2004 11:26:49 GMT
Form Canvas vs Image Canvas
Hi, i was just playing with drawing pixcels in a form's canvas, and then in
a Timage canvas, and i noticed that doing it in the form's canvas is WAY MUCH faster than in the tImage. Why could this be? The code was: loop:=true; -- |
Eddie O'Brie
![]() Delphi Developer |
Sun, 22 Aug 2004 16:31:23 GMT
Re:Form Canvas vs Image CanvasI haven't noticed a significant difference in speed between the TImage and the TForm (when writing pixels) But there is a massive difference if you use Scanline rather than Pixel[x,y] Earl F. Glynn replied to an earlier message in this group. All is revealed See http://homepages.borland.com/efg2lab/ImageProcessing/Scanline.htm -- Mailto: eddie AT pcug DOT org DOT au "Ral Andrs No Spam del Canto" <RaulAnd...@NoSpamDelcanto.net> wrote in Quote> Hi, i was just playing with drawing pixcels in a form's canvas, and then |
Finn Tolderlun
![]() Delphi Developer |
Mon, 23 Aug 2004 00:43:40 GMT
Re:Form Canvas vs Image Canvas"Ral Andrs No Spam del Canto" <RaulAnd...@NoSpamDelcanto.net> skrev i en meddelelse news:3c858cf1$1_1@dnews... Quote> Hi, i was just playing with drawing pixcels in a form's canvas, and then the pixels, the form's canvas does not. -- Finn Tolderlund |
John McTaggar
![]() Delphi Developer |
Mon, 23 Aug 2004 10:19:43 GMT
Re:Form Canvas vs Image CanvasQuote> Hi, i was just playing with drawing pixcels in a form's canvas, and then the Application.ProcessMessages is a killer in a loop like yours. You'd be better off either dropping it, or looking into a separate drawing thread of some sort that bitblt's the image to the form.. John McTaggart |
Gordon Whitta
![]() Delphi Developer |
Mon, 23 Aug 2004 18:13:06 GMT
Re:Form Canvas vs Image CanvasIn article <3c858cf1$1_1@dnews>, Ral Andrs No Spam del Canto wrote: Quote> The code was: Picture.Bitmap.Canvas. Unless the bitmap is drawn to the controls canvas you won't see any change, application.process messages is allowing that to happen every time a pixel is drawn. Try leaving it out and calling invalidate out of the loop and see what the difference is. BTW John's right about it not being the way to do it but if you're just experimenting... Gordon |
Raúl André
![]() Delphi Developer |
Mon, 30 Aug 2004 23:46:23 GMT
Re:Form Canvas vs Image CanvasMmm, yes. The tImage storing the pixels vs tForm don't may be the big difference. Any how the .proccessMessages is in both loopd (the image and the form) so i guess it aadds the same pause for both. I found this method (of .processMessages) a quick way to writh a loop that can be user-interrupted. -- Quote> In article <3c858cf1$1_1@dnews>, Ral Andrs No Spam del Canto wrote: |
Gordon Whitta
![]() Delphi Developer |
Tue, 31 Aug 2004 04:23:22 GMT
Re:Form Canvas vs Image CanvasQuoteIn article <3c90c65f$1_2@dnews>, Ral Andrs wrote: it repaints the whole image, that isn't happening when you draw a pixel on the form. What I do with operations that can be interrupted by the user is something User does something which sets boolean var doInterrupt = true for cnt:= ... 'n' being dependent on the number of iterations and expected time of each Not suitable in every situation of course as the boolean evaluation takes Gordon |
Raúl André
![]() Delphi Developer |
Tue, 31 Aug 2004 10:35:08 GMT
Re:Form Canvas vs Image CanvasGood idea!, So in resume, if i get it, you say that instead of procesing the medssageds every time, you process them every 'n' loops.. that makes a lot of sense, since a loop probably takes a fraction of second. I guess it's a llittle faster to make if n=m then begin Because it's faster to compare 2 direct values than the result of an -- Quote> In article <3c90c65f$1_2@dnews>, Ral Andrs wrote: |
Gordon Whitta
![]() Delphi Developer |
Tue, 31 Aug 2004 17:25:32 GMT
Re:Form Canvas vs Image CanvasQuoteIn article <3c915e6c_2@dnews>, Ral Andrs wrote: twice if 'exit' isn't an option or set another boolean and check that before going into each loop. It isn't a method that can be blindly applied IMHO but in the right place it's OK. Quote> I guess it's a llittle faster to make Cheers Gordon |
1. Image->Canvas vs. Bitmap->Canvas Transparency
2. Draw text on printer canvas vs screen canvas
3. Canvas in TPaintBox VS. Canvas in TImage
4. can I copy form canvas to printer canvas ???
5. drew on canvas - image erased by new form
7. Canvas to Canvas with CopyRect
8. How to copy from canvas to tbitmap.canvas
9. TPaintbox.Canvas or MainForm.Canvas faster???
10. Unable to Write to Canvas losing GDI resources, and unable to write to canvas