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
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






Cocoa mail archive

