Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Crop an image

Author
Message
Seed
11
Years of Service
User Offline
Joined: 23rd Feb 2013
Location:
Posted: 18th Apr 2013 05:07
How can I crop an image using AppGameKit?.
Using agk::CopyImage() with the percentage system for the screen.
Say if I had a box that was on top of the image that would show the area that I wanted to crop, how would I transfer this into pixels for the CopyImage() function?.

Also is there a way to change the direction of the gravity so it's the centre of a circle?. Instead of using forces.

Using Tier 2 on Mac OS X and windows (mostly mac cos of bugs in windows).

Lastly on windows text isn't present in edit boxes, also buttons appear as white boxes. This is on the latest beta.

Thanks.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 18th Apr 2013 10:09 Edited at: 18th Apr 2013 10:14
i am not really sure what you want do.
a image from screen back buffer you get with GetImage() .
CopyImage use pixels as offset and size.

own gravity
SetPhysicsGravity( x, y ) off =0,0
CreatePhysicsForce
or
SetSpritePhysicsForce < i found this is better

maybe wrong textsize if you use virtual resolution.
Seed
11
Years of Service
User Offline
Joined: 23rd Feb 2013
Location:
Posted: 18th Apr 2013 15:52 Edited at: 18th Apr 2013 16:14
I'm loading an image using agk::ShowChooseImageScreen() and then putting the image in a sprite. But I need the option for the user to be able to crop part of the sprite.

So I want to be able to overlay a square on top of the sprite, and the area that the square covers is the area that the user wants to crop and use, this would be copied using agk::CopyImage() and then the image would replace the old one in the sprite.

Using agk::GetImage() results in a lower resolution image.

The only thing I'm wondering is, when using the percentage screen system how would I convert the percentage size of the square into pixels to crop the image?.

Also thanks for the physics tip.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 18th Apr 2013 16:14
if the sprite goes from 0,0 to 100,100 on screen its easy.
1 is left top edge
2 is right bottom edge from sqare
rule of three
you bring the max value to 1 and then multiply.
theoretical :
startx = imagewidth* (x1# / 100.0)
starty = imageheight* (y1# / 100.0)
endx = imagewidth*(x2# / 100.0)
endy = imageheight*(y2# / 100.0)
width=(endx-startx)+1
height=(endy-starty)+1

Login to post a reply

Server time is: 2024-11-24 12:12:34
Your offset time is: 2024-11-24 12:12:34