Image Rotation routines for 24/32 bit with optional AA
Re: Image Rotation routines for 24/32 bit with optional AA
Made some little modifications to my copy of the sources so I've updated them here too.
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review
Re: Image Rotation routines for 24/32 bit with optional AA
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:
I suspect it may be because of the width/height ratio (1344x350), because if I rotate it previously 90º, it works fine.
If you disable AntiAliasing flags both codes work fine.
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
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
PB 6.0x, PureVision User.
Re: Image Rotation routines for 24/32 bit with optional AA
Sorry, I was deleted the image link in my previous post
PB 6.0x, PureVision User.
Re: Image Rotation routines for 24/32 bit with optional AA
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
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
Last edited by luis on Thu Apr 21, 2022 10:48 am, edited 1 time in total.
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review
Re: Image Rotation routines for 24/32 bit with optional AA
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!EDIT: Should work now.
I made a loop from 0 to 360 to rotate your test image one degree at the time and it didn't crash.
https://www.purebasic.fr/english/viewto ... 73#p298873
PB 6.0x, PureVision User.