Post Reply 
Rotate text?
02-04-2015, 07:41 AM
Post: #10
RE: Rotate text?
Hello


FOR x:=-25 TO 25 DO
FOR y:=-25 TO 25 DO
PIXON_P(G1,x+a,y+b,GETPIX_P(G1,x*ca-y*sa,x*sa+y*ca));
END; // end y-height pixels
END; // end x-width pixels

They are 2 types of items that you can control here:
- 2 loops
- 4 parameter calculations

you need the loops and you can not transform the using matrices or the like, so nothing to improve there.

You can however do something on the parameter calculations.

you have the x+a and y+b. These could be speed up by using binary numbers rather than floats but the cost of doing the conversion would be higher than the cost of doing the floating point calculations. So there is no point in looking further there.

you then have the GETPIX_P pixel calculations. there is quite a lot there, 4 multiplications and 2 additions (well substractions)... This, you can improve on!
create a local variable where you place your rotation as a complex number (rot) and then do GETPIX_P(G1,(x,y)*rot) and let the system do the * and - internally which will be faster because there is no memory allocations for results and time spent in executing your code.

This is prety much all that I can think of.

cyrille
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Rotate text? - DrD - 01-26-2015, 03:28 PM
RE: Rotate text? - cyrille de brébisson - 01-27-2015, 06:57 AM
RE: Rotate text? - Damien - 01-27-2015, 07:22 AM
RE: Rotate text? - cyrille de brébisson - 01-27-2015, 09:11 AM
RE: Rotate text? - DrD - 01-27-2015, 11:20 AM
RE: Rotate text? - Thomas_Sch - 01-27-2015, 12:05 PM
RE: Rotate text? - DrD - 01-27-2015, 01:27 PM
RE: Rotate text? - Thomas_Sch - 01-27-2015, 08:27 PM
RE: Rotate text? - DrD - 02-03-2015, 03:34 PM
RE: Rotate text? - cyrille de brébisson - 02-04-2015 07:41 AM
RE: Rotate text? - DrD - 02-04-2015, 01:25 PM
RE: Rotate text? - Han - 02-04-2015, 01:18 PM
RE: Rotate text? - DrD - 02-04-2015, 01:50 PM



User(s) browsing this thread: 2 Guest(s)