Scaling method

Discussion in 'iPhone/iPad Programming' started by diehard89, Aug 26, 2008.

  1. macrumors newbie

    Joined:
    Mar 19, 2008
    Location:
    Singapore
    #1
    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.
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    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?
     
  3. thread starter macrumors newbie

    Joined:
    Mar 19, 2008
    Location:
    Singapore
    #3
    ya,some kind of transformation, I will see if i can find it in the documentation.
     
  4. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    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?
     
  5. thread starter macrumors newbie

    Joined:
    Mar 19, 2008
    Location:
    Singapore
    #5
    been looking in opengl ES but did not find much info on how to do it.
     
  6. thread starter macrumors newbie

    Joined:
    Mar 19, 2008
    Location:
    Singapore
    #6
    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.
     

Share This Page