LordJashin Posted November 6, 2012 Share Posted November 6, 2012 http://www.davdata.nl/math/drawing1.html I think i just might make some functions for this. Does the TSCARBitmap class use this? Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 6, 2012 Share Posted November 6, 2012 It does not, but please post this stuff in programming, this is not general discussion. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 6, 2012 Author Share Posted November 6, 2012 (edited) Sorry. So what does SCAR's TSCARBitmap class use? And is it faster? Edited November 6, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 6, 2012 Share Posted November 6, 2012 Sorry. So what does SCAR's TSCARBitmap class use? And is it faster? I don't see how this is similar... Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 6, 2012 Author Share Posted November 6, 2012 For drawing, and bitmap drawing. Like on that page, it described canvas/bitmap drawing with pixels property, line to, and scan line method. Then it showed a new one that was faster than all 3...here: Still uses scan line, but only once: When pointer Pbase points to the memory location of pixel [0,0], Pbase + 4 points to [1,0] and Pbase - 16 points to [0,1] Using ScanLine only once to obtain Pbase, we can access pixels in the following way [scar] //assume bitmap width of 100 pixels, 32 bit format type PDW = ^DWORD; var Pbase,Pline,p : PDW; begin Pbase := bm.scanline[0]; Pline := PDW(DWORD(Pbase) - y * 400);//Pline points to [0,y] as scanline did before p := PDW(DWORD(Pline) + (x shl 2));//p points to element x on selected row p^ := $ff00ff;//set pixel [x,y] to color purple ......... ........ end; [/scar] XDot method (what the guy called it), is the method shown above... here are the time results Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 6, 2012 Share Posted November 6, 2012 I don't see how this has anything to dow ith TSCARBitmap... Drawing is done mainly through the TCanvas property as it has always been... Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 6, 2012 Author Share Posted November 6, 2012 Like, TSCARBitmap.DrawTo, and TSCARBitmap.Pixels. I think these would be faster if the xdot method was used? Definitely the canvas stuff would be faster probably. Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 6, 2012 Share Posted November 6, 2012 Like, TSCARBitmap.DrawTo, and TSCARBitmap.Pixels. I think these would be faster if the xdot method was used? Definitely the canvas stuff would be faster probably. Neither DrawTo or Pixels would be faster and I'm pretty sure xdot is something he made up... I've been doing this for longer than I can remember, I already know all of the stuff in that article... I've spent years on learning optimization techniques, so most of my code is either as fast as it could be as as fast as it should be within the requirements of the application. My point is, have some faith that I know what I'm doing? Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 6, 2012 Author Share Posted November 6, 2012 So would SCAR's TCanvas be faster than this xdot method? Is SCAR TCanvas different from the traditional one from Delphi? Going to integrate some drawing into the tpa god application... Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 6, 2012 Share Posted November 6, 2012 So would SCAR's TCanvas be faster than this xdot method? Is SCAR TCanvas different from the traditional one from Delphi? Hmm, TCanvas is just TCanvas, if it was something else it would probably be named TSCARCanvas. I do plan on adding more drawing methods directly into TSCARBitmap in the future though, which will be a lot faster than the ones in TCanvas. But at the moment this isn't very high up on my priorities list as the speed of drawing with TCanvas in SCAR should be fast enough for most, if not all applications. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted November 6, 2012 Author Share Posted November 6, 2012 Okay sounds good. I think I'll use this XDot method inside the TPAGod app. I am remaking it atm. Going to model it a lot after that delphi drawing page. Might even use some of the functions he made for his bitmap class (Xbitmap). However, i renamed the TpaGod thing to SCAR Tool. Just sounds better that way. And with its select window thingy, it resembles SCAR in that way? Well w/e... Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 6, 2012 Share Posted November 6, 2012 In any case, working with scanlines will always be faster than working with tcanvas. Just harder. Quote Link to comment Share on other sites More sharing options...