Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8092387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:16:22+00:00 2026-06-05T20:16:22+00:00

I am rounding the corners of a rectangle by following Define a coloredBoxRect and

  • 0

I am rounding the corners of a rectangle by following

Define a coloredBoxRect and calculate min, max of x and y

CGFloat coloredBoxMargin    =   8;
CGFloat coloredBoxHeight    =   40.0;

coloredBoxRect  =   CGRectMake(coloredBoxMargin,  coloredBoxMargin, self.bounds.size.width-coloredBoxMargin*2, coloredBoxHeight);
CGFloat minx    =   CGRectGetMinX(coloredBoxRect);
CGFloat miny    =   CGRectGetMinY(coloredBoxRect); 
CGFloat midx    =   CGRectGetMidX(coloredBoxRect);     
CGFloat midy    =   CGRectGetMidY(coloredBoxRect); 
CGFloat maxx    =   CGRectGetMaxX(coloredBoxRect); 
CGFloat maxy    =   CGRectGetMaxY(coloredBoxRect);

Then doing

CGMutablePathRef path = CGPathCreateMutable();
//Path stars here
CGPathMoveToPoint  (path, NULL, midx, miny);
// Add an arc for the upper right corner 
1.CGPathAddArcToPoint(path, NULL, maxx, miny,  maxx, maxy, radius);
//Add an arc for the lower right corner
2.CGPathAddArcToPoint(path, NULL, maxx, maxy,  minx, maxy, radius);
// Add an arc for the lower left corner 
3.CGPathAddArcToPoint(path, NULL, minx, maxy,  minx, miny, radius);
// Add an arc for the upper left corner 
4.CGPathAddArcToPoint(path, NULL, minx, miny,  maxx, miny, radius);
CGPathCloseSubpath(path);
CGContextAddPath(context, path);

One of signatures CGPathAddArcToPoint are x and y coordinates of the first and second line tangent. For example to add arc for upper right corner ) maxx+miny+maxx+maxy. And these parameters are confusing me now.

I tried to draw a picture and noticed that (maxx,miny) is not the coordinate of the tangent line. This pair is just a coordinate of top right corner of rectangle………

Does someone advice me on this issue. All comments are welcomed here.
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:16:23+00:00Added an answer on June 5, 2026 at 8:16 pm

    Simpler by an order of magnitude is to use [UIBezierPath bezierPathWithRoundedRect:cornerRadius:]. You can then get the CGPath from it afterwards.

    See documentation. This probably does the same thing behind the scenes, but why bother doing it yourself?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've seen the following (bizarre) Javascript rounding function in some legacy code. After googling
Need a simple a way of rounding off an Image. I need the corners
I'm using the following code for rounding to 2dp: sprintf(temp,%.2f,coef[i]); //coef[i] returns a double
I have the following javascript function for rounding: function round(val, numberdigits){ return Math.round(val*Math.pow(10, numberdigits))/Math.pow(10,
I am looking into rounding floating point numbers in Python and the following behavior
I'm having trouble rounding the corners of an img using CSS3: This is the
Hi Im having troubles rounding corners on my navigation bar, when I write -
White background is rounding my iframe, as i am echoing this iframe from the
Ive been looking for a proper rounding mechanism but nothing I find seems to
I'm running SQL that needs rounding up the value to the nearest whole number.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.