Re: Fill box with repeating text
Re: Fill box with repeating text
- Subject: Re: Fill box with repeating text
- From: Dave Keck <email@hidden>
- Date: Fri, 24 Apr 2009 13:44:26 -1000
There are several ways to accomplish this.
(I'll note that you can get the size of an attributed string using its
-size method.)
Option 1: Create an NSImage with the size returned from the attributed
string. Draw the attributed string into the image. Create an NSColor
pattern from the image, using colorWithPatternImage:. Fill the rect
using [color set] and NSRectFill()/NSRectFillUsingOperation().
Option 2: you could alternatively go the slightly lower-level Core
Graphics route, and use CGContextDrawTiledImage(), which will draw a
tiled CGImage. I'm using this method in my personal code. I can't
remember why at the moment, but I may have run into limitations with
option 1. (Of course, I'd definitely try option 1 first as it'll be
easier.)
David
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden