Skip navigation.
 
mlNSBezierPath geometry question...
FROM : Keith Blount
DATE : Sun Apr 10 23:40:10 2005

Hello,

I am trying to use NSBezierPath to create a shape that
highlights text in a text view. Basically, I want to
create a shape that has rounded corners (like the
traditional Apple rounded rectangles you get in Mail
etc), but this may highlight text that spills over
several lines - so the shape is irregular.

This shape is actually defined by several rectangles
that are got using:

NSRectArray rectArray = [layoutManager
rectArrayForCharacterRange:charRange
withinSelectedCharacterRange:NSMakeRange(NSNotFound,0)
inTextContainer:textContainer rectCount:&rectCount];

So what I actually need to do is take the rectangles
returned by this method, create one compound shape
from them, and then round the corners of this shape
into one NSBezierPath.

I have tried several approaches with differing degrees
of succes, such as getting all of the right points
then all of the left points and using
appendBezierPathWithArcFromPoint..., for instance, but
everything I have tried has had some odd effects.

Does anybody know how to take several rects and turn
them into one shape with rounded corners?

Many thanks for any advice,
Keith


       
__________________________________
Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail

Related mailsAuthorDate
mlNSBezierPath geometry question... Keith Blount Apr 10, 23:40
mlRe: NSBezierPath geometry question... Serge Meynard Apr 11, 00:37
mlRe: NSBezierPath geometry question... Robert Clair Apr 11, 13:01
mlRe: NSBezierPath geometry question... Keith Blount Apr 11, 13:17
mlRe: NSBezierPath geometry question... Serge Meynard Apr 11, 16:02
mlRe: NSBezierPath geometry question... Nicko van Someren Apr 11, 17:48
mlRe: NSBezierPath geometry question... Serge Meynard Apr 11, 18:41
mlRe: NSBezierPath geometry question... David Phillip Oste… Apr 11, 18:46
mlRe: NSBezierPath geometry question... Nicko van Someren Apr 11, 19:48
mlRe: NSBezierPath geometry question... Heinrich Giesen Apr 11, 20:49
mlRe: NSBezierPath geometry question... Robert Clair Apr 11, 21:02
mlRe: NSBezierPath geometry question... Keith Blount Apr 11, 21:19
mlRe: NSBezierPath geometry question... Scott Thompson Apr 11, 23:25
mlRe: NSBezierPath geometry question... Robert Clair Apr 11, 23:54
mlRe: NSBezierPath geometry question... Keith Blount Apr 12, 00:24
mlRe: NSBezierPath geometry question... Nicko van Someren Apr 12, 10:04
mlRe: NSBezierPath geometry question... Keith Blount Apr 12, 18:08
mlRe: NSBezierPath geometry question... Jonathon Mah Apr 13, 17:11