Re: Fill box with repeating text

2009-04-24 Thread Trygve Inda
>> Where does this go as it is drawing the image, not the text? The image is >> drawn with a RectFill call?? > > Ah, sorry. I meant to say: > > NSRectFillUsingOperation(rect, NSCompositeSourceOver); > > Note that point here is that however the image is finally drawn, you > have to make sure you'

Re: Fill box with repeating text

2009-04-24 Thread Dave Keck
> Where does this go as it is drawing the image, not the text? The image is > drawn with a RectFill call?? Ah, sorry. I meant to say: NSRectFillUsingOperation(rect, NSCompositeSourceOver); Note that point here is that however the image is finally drawn, you have to make sure you're drawing it us

Re: Fill box with repeating text

2009-04-24 Thread Trygve Inda
>> Makes the text transparent, but I can't seem to make the background of the >> NSImage transparent. I want to end up with white text on a transparent >> background, but [[NSImage alloc] initWithSize:[theString size]] seems to set >> the background to solid white. > > This is because you're drawi

Re: Fill box with repeating text

2009-04-24 Thread Chris Suter
Hi Trygve, 2009/4/25 Trygve Inda Makes the text transparent, but I can't seem to make the background of the > NSImage transparent. I want to end up with white text on a transparent > background, but [[NSImage alloc] initWithSize:[theString size]] seems to > set > the background to solid white. >

Re: Fill box with repeating text

2009-04-24 Thread Dave Keck
> Makes the text transparent, but I can't seem to make the background of the > NSImage transparent. I want to end up with white text on a transparent > background, but [[NSImage alloc] initWithSize:[theString size]] seems to set > the background to solid white. This is because you're drawing the i

Re: Fill box with repeating text

2009-04-24 Thread Trygve Inda
> 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

Re: Fill box with repeating text

2009-04-24 Thread Dave Keck
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, usin

Fill box with repeating text

2009-04-24 Thread Trygve Inda
I have a rect in a graphics context that I wish to fill with repeating text "Some Text" so that the text repeats enough times to completely fill the rect at the given line spacing, font style etc. How can I determine how much text I need? Is there a better way to build this than just stringByAppen