Page 4 of 4
Re: Image Rotation routines for 24/32 bit with optional AA
Posted: Fri Aug 29, 2014 11:59 pm
by luis
Made some little modifications to my copy of the sources so I've updated them here too.
Re: Image Rotation routines for 24/32 bit with optional AA
Posted: Mon Feb 14, 2022 9:20 am
by zikitrake
First of all, thank you for this great contribution!
When I try RotateImageFree with
flgAntiAliasing enabled sometime it get me an Invalid Memory in line 531 (icr = *tRGBAs\R * fXfs1less)
As with this image
https://drive.google.com/file/d/1qBv3P0 ... j_enH/view
Simple code:
Code: Select all
;This code fails
UseJPEGImageDecoder()
UsePNGImageDecoder()
Define imgOrigen = LoadImage(#PB_Any, "d:\himalayas.jpg")
Define imgDestino = RotateImageFree(imgOrigen, 45, #True)
If IsImage(imgDestino)
Debug "rotation OK"
EndIf
I suspect it may be because of the width/height ratio (1344x350), because if I rotate it previously 90ยบ, it works fine.
Code: Select all
;This code works fine
UseJPEGImageDecoder()
UsePNGImageDecoder()
Define imgOrigen = LoadImage(#PB_Any, "d:\himalayas.jpg")
Define imgOrigen90 = RotateImage(imgOrigen, 90)
Define imgDestino = RotateImageFree(imgOrigen90, 45, #True)
If IsImage(imgDestino)
Debug "rotation OK"
EndIf
If you disable
AntiAliasing flags both codes work fine.
Re: Image Rotation routines for 24/32 bit with optional AA
Posted: Wed Apr 20, 2022 10:33 am
by zikitrake

Sorry, I was deleted the image link in my previous post

Re: Image Rotation routines for 24/32 bit with optional AA
Posted: Wed Apr 20, 2022 7:10 pm
by luis
Hi there zikitrake, sorry but I saw your post only today, I come to the forum very infrequently now and I'm not into the "purebasic scene" any longer so to speak

I will look into it this evening, it looks like the a rounding problem and the code sometimes goes out of bounds accessing the buffer memory beyond the x-y boundaries of the rotated image. I'll try to fix it.
Bye !
EDIT: Should work now.
I made a loop from 0 to 360 to rotate your test image one degree at a time and it didn't crash.
https://www.purebasic.fr/english/viewto ... 73#p298873
Re: Image Rotation routines for 24/32 bit with optional AA
Posted: Thu Apr 21, 2022 8:17 am
by zikitrake
luis wrote: Wed Apr 20, 2022 7:10 pm
Hi there zikitrake, sorry but I saw your post only today, I come to the forum very infrequently now and I'm not into the "purebasic scene" any longer so to speak

Sorry to read this. I hope it's for something positive for you!
You are part (personally speaking) of that group of users that give so much value to Purebasic. Best regards!
It works perfectly, as you would expect!
