PDA

View Full Version : Scaling method




diehard89
Aug 26, 2008, 11:29 AM
Is there any method to scale just the bottom half of an image, such as functions,etc...

For example, a square with width 10 and height 10.
After scaling, the top width of the square remains 10,but the bottom width is 5.(Height remain the same)

Thanks in advance.



robbieduncan
Aug 26, 2008, 11:43 AM
You don't really mean scaling do you? You mean to transform the image so it looks like it has perspective (so that the image is projected onto a trapezoid).

I think you can perform this transform using CoreGraphics calls although I am unable to provide details as I'm not on a Mac right now. Perhaps if you read the documentation you can work it out for yourself?

diehard89
Aug 26, 2008, 11:53 AM
ya,some kind of transformation, I will see if i can find it in the documentation.

robbieduncan
Aug 26, 2008, 12:33 PM
Hmm, looking at the documentation CoreGraphics only seems to have affine transformations. You need a non-affine transform. Perhaps you need to be looking at OpenGL?

diehard89
Aug 26, 2008, 01:35 PM
been looking in opengl ES but did not find much info on how to do it.

diehard89
Aug 28, 2008, 10:02 AM
In openGL, i bind the textures onto a quad made of GL_TRIANGLE_STRIP

but if i move in the bottom vertex of the Quad that made up of Triangle strip,
the texture that bind onto it will be distorted and not properly render.