Register
Site Login
Site Search
Forums
Advertisement
Welcome to PocketMatrix. PocketMatrix is dedicated to providing the best online community for mobile device developers and enthusiests. What's new?

how to scale an image


how to scale an image

Postby akabeer1983 » Feb 3, 2009 @ 7:35am

Hi,
i am programming for iPhone, i want to scale an image, based on user's touch (touch one corner of image and drag it).
how can i scale the image.
i tried the following, but it displays nothing:

//member variables declaration part
E2DBLTFX bltfx;

//constructor
bltfx.xscale = 3;
bltfx.yscale = 3;

//OnNextFrame function
display -> BltFx(10, 10, image, &rect, &bltfx);


But there wsa no problem with rendering the image normally:
display -> BltFast(100, 100, image, &rect)
the above statement displays the image properly.
akabeer1983
pm Member
 
Posts: 11
Joined: Jan 27, 2009 @ 8:24am


Postby edge » Feb 3, 2009 @ 8:43am

Hi,

Your scale values are too small, which makes the image invisible. To scale, use the following formula's:

Code: Select all


bltfx.xscale = 3 * 65536; //300%
bltfx.xscale = 65536 / 2; //50%
2 lines; 0 keywds; 4 nums; 8 ops; 0 strs; 2 coms    Syntactic Coloring v0.4 - Dan East  
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby akabeer1983 » Feb 3, 2009 @ 8:43am

i also tried the following, but nothing dislayed;
display -> Blt(0, 0, image, &rect, 0, 65536, EFLIP_HORIZONTAL);
i also tried various other values for rotation, sclaing, but in vain.
akabeer1983
pm Member
 
Posts: 11
Joined: Jan 27, 2009 @ 8:24am


Postby akabeer1983 » Feb 3, 2009 @ 8:46am

Hi,
thanks for reply
it worked with:
bltfx.xscale = 3 * 65536;// (300%)
for both Blt and Btlfx functions.
Thanks
akabeer1983
pm Member
 
Posts: 11
Joined: Jan 27, 2009 @ 8:24am


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

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
You cannot post attachments in this forum