# Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
 It is currently Wed Jun 03, 2020 10:38 pm

 All times are UTC - 5 hours

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: How to rotate a image ?Posted: Thu Jan 19, 2012 9:50 am

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

 Post subject: Re: How to rotate a image ?Posted: Fri Jan 20, 2012 4:38 am

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

 Post subject: Re: How to rotate a image ?Posted: Fri Jan 20, 2012 4:48 am

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

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 3 posts ]

 All times are UTC - 5 hours

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

Search for:
 Jump to:  Select a forum ------------------ General    General    Getting Started    Networking    Databases    Visual Basic to REAL Studio Conversion    Games    Plugins    Tips    Web Control SDK Platform Specific    Windows    Macintosh    Linux    Web Other Topics    Announcements    Off-Topic    Third Party Add-ons