Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Oct 17, 2019 5:31 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to rotate a image ?
PostPosted: Thu Jan 19, 2012 9:50 am 
Offline

Joined: Mon Jan 16, 2012 8:08 am
Posts: 161
Location: India
Hi All,
I am trying to rotate an image in anticlockwise direction but when i am clicking for first time on the button it works fine but again when i am clicking on the button its not working and here is my code

( this code is inside the action event button )
dim x,y as integer
dim imgresult as Picture
dim x1, y1 as integer
dim rbs, destrbs as RGBSurface
dim s as RoundRectShape

Try

x1 = selectedpic.Height
y1 = selectedpic.Width
rbs = selectedpic.RGBSurface

imgresult = NewPicture(selectedpic.height,selectedpic.width,32)
destrbs = imgresult.RGBSurface

if MinXCoordinate=0 And MinYCoordinate=0 Then

for y = 0 to y1-1
for x = 0 to x1-1

destrbs.Pixel(x,y) =rbs.Pixel((y1-1)-y,x)
next x[/code]
next y

MinXCoordinate = x1
MinYCoordinate = y1

elseif MinXCoordinate > 0 And MinYCoordinate >0 then

MinXCoordinate = x1 + MinXCoordinate
MinYCoordinate = y1 + MinYCoordinate

for y = 0 to y1-1
for x = 0 to x1-1

destrbs.Pixel(x,y) =rbs.Pixel((y1-1)-y,x)
next x
next y

end if

Backdrop=imgresult

Catch

End try

MinXCoordinate , MinYCoordinate are my two property of button.Plz tell me

Thanks
Bimal


Top
 Profile  
Reply with quote  
 Post subject: Re: How to rotate a image ?
PostPosted: Fri Jan 20, 2012 4:38 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
what do you mean with not working?

And why don'T you at least log an exception instead of ignoring them?

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: How to rotate a image ?
PostPosted: Fri Jan 20, 2012 4:48 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
imgresult is a local variable. You start fresh with the original picture each time, so the result is going to be the same each time you press the button. You would have to replace selectedpic with imgresult if you wanted to rotate another 90 degrees each time you press the button.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group