Create rounded corner image in iphone

Discussion in 'iPhone/iPad Programming' started by arnieterm, Apr 14, 2009.

  1. macrumors regular

    Joined:
    Aug 28, 2008
    #1
    In my iphone app, after selecting an image from iphone photo library, I am be able to resize the returned image to 60X60 but I need to make that image rounded cornered. How can we do it?
    As I have to save the rounded cornered and resized image only.
    Thanks
    Arnieterm
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Create a rounded rect as a path.
    Set this as the clipping path.
    Draw the image into a new image.
    Save.
     
  3. thread starter macrumors regular

    Joined:
    Aug 28, 2008
    #3
    Can you suggest a sample code for this as I am not familiar with iphone much
    Thanks
    Arnieterm
     
  4. macrumors 68030

    johnnyjibbs

    Joined:
    Sep 18, 2003
    Location:
    London, UK
    #4
    Try reading the 2D Graphics and Animation Guide (or something like that) on the Apple iPhone developer website - it shows you how to use the simple Core Graphics commands to draw lines and arcs (for rounded rectangles).

    If I get a chance, next time I'm at my Mac I'll post some example code of how to draw a rounded rectangle path, then you just need to fill with the image you want.
     
  5. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    Probably the QuartzDemo will show you more than you need to know.

    The documentation on building paths and then clipping to a path would cover steps 1) and 2) from my suggestion.

    The image documentation should cover everything else.

    As per usual: read the documentation: it's there to help you understand what's going on.
     
  6. macrumors newbie

    Joined:
    Jun 26, 2009
    #6
    Resize image

    Hi arnieterm,

    Could you please tell me how did you resize image to 60 x 60? I could not achieve that...

    Thanks in advance..

    Yoga.
     

Share This Page