Code: Select all
RotateImage(SourceImage.i, QuarterTurnsCW.i, DestImage.i = #PB_Ignore)
https://raw.githubusercontent.com/kenmo ... eImage.pbi
https://github.com/kenmo-pb/includes/bl ... eImage.pbi
I've used pixel-by-pixel rotation code for a while. But this thread pointed me to the PlgBlt_() Windows API for 90 and 270 rotations, which also led me to StretchBlt_() for faster 180 rotations (at least in my testing).
viewtopic.php?f=12&t=75279
The benefits of this procedure are:
- rotate an image "in-place" (keep the same number), OR to another image, OR to a new #PB_Any image
- uses API functions when possible (only Windows, for now) otherwise falls back to native rotation code
- it has a few smart optimizations, like if you're rotating a square image it won't create an intermediate image since the dimensions stay the same
- Windows/Mac/Linux compatible
- packaged into one portable procedure
- EnableExplicit safe, as always

Cheers