site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=EiXmGzzASmYZNX2Wf/Whqr8ZMHsyTiF3DLZQ3te6A2w=; b=HkoUEixAmgr+Ima6nYqKiDMTYF9osniXL3ohYrYcu6c8AtMSIYg+W+491QTrDrH7Cb FB0raR9InSXLMx8zd0SM1k9AN7c1v7zSrk43Eb0JQmGl5jqtFplpW97RLEjdV/1mRqR6 F+iIvxUDweX7BZzustjjYu0SAyNrvTEo4UtA8= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=LAx++0Nt9QxbYXs1DYt4xbS1gZePaU/2YwEn/OibnQ2yCtx+Nd12Pa3CEs3g+Ke5r6 8nIqLAfwXloLLH/mTwIe5GmDLtaDehMxa4AB+qUvtFHds+yvAc/9TQ58Sh29X26RTnF0 a8DLlSOFKY1Eg00I2Ryx5FyvT7tCVOsU4QCS4= On 1/10/2008, at 3:23 AM, Alastair Houghton wrote: On 30 Sep 2008, at 12:59, Michael Robinson wrote: Thanks for your incredibly swift replies! The code that outputs the divs is: } return (NSString*)cornerElements; With the code that generates the margin for the rounded corners: case 1: if(){ retVal = lround(size*(1-cos(asin((double)i/(double)size)))); if(retVal > 0 ) return retVal; } return 0; break; Thank you for your help, Mike Kind regards, Alastair. -- http://alastairs-place.net _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.apple... changing "float retVal" to "double retVal", using "return lround(retVal);" and casting ints as doubles in the formula gave me some real values, which is wonderful! I could have saved myself two hours by asking the list when I first ran into this problem! I've got it spitting out some (jagged but acceptable) corners now, which is wonderful. In case any of you were interested, I'm doing this to create an HTML "object" that can be placed over any background, be given rounded corners and have the background show through. It was being accomplished with Javascript, but I figured it'd be better if this was done one time, when the HTML is generated, instead of at client side. If you're rendering this in advance using Cocoa, why not use the - appendBezierPathWithArcFromPoint:toPoint:radius: method on NSBezierPath to construct a rounded path? int i; NSMutableString *cornerElements = [NSMutableString new]; for(i = cornerSize; i > 0; i--){ [cornerElements appendString:[NSString stringWithFormat:@"<div style= \"font-size:0em;margin-left:%ipx;margin-right:%ipx;height: 1px;overflow:hidden;background-color:%@;\"> </div>",[self getCornerStripWidth:i:[borderDDTL selectedTag]:sizeTL:cornerSize], [self getCornerStripWidth:i:[borderDDTR selectedTag]:sizeTR:cornerSize],[self hexColor:[portalBGColour color]]]]; I had a look at using NSBezierPath, but as I already had code that "works", I didn't know whether it would be worth changing methods - what would the advantage of using NSBezierPath be? This email sent to site_archiver@lists.apple.com