• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fill box with repeating text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Fill box with repeating text
      • From: Trygve Inda <email@hidden>
References: 
 >Fill box with repeating text (From: Trygve Inda <email@hidden>)

  • Prev by Date: Fill box with repeating text
  • Next by Date: Re: KVO leaks memory
  • Previous by thread: Fill box with repeating text
  • Next by thread: Re: Fill box with repeating text
  • Index(es):
    • Date
    • Thread