Re: Text Becomes Clipping
Re: Text Becomes Clipping
- Subject: Re: Text Becomes Clipping
- From: Todd Yandell <email@hidden>
- Date: Sat, 29 Jan 2005 23:34:57 -0600
Hi,
You might try something like the following example. It's untested, but it should give you a general idea of how this works. There might be other ways I'm not familiar with as well. I'm sure it could be optimized some, too.
<x-tad-bigger>- (</x-tad-bigger><x-tad-bigger>void</x-tad-bigger><x-tad-bigger>)drawRect:(NSRect)rect
{
NSImage *textImage;
NSImage *fillImage;
textImage = [[NSImage alloc] initWithSize:[</x-tad-bigger><x-tad-bigger>self</x-tad-bigger><x-tad-bigger> frame].size];
fillImage = [[NSImage alloc] initWithSize:[</x-tad-bigger><x-tad-bigger>self</x-tad-bigger><x-tad-bigger> frame].size];
[fillImage lockFocus];
[</x-tad-bigger><x-tad-bigger>self</x-tad-bigger><x-tad-bigger> drawFill];
[fillImage unlockFocus];
[textImage lockFocus];
[</x-tad-bigger><x-tad-bigger>self</x-tad-bigger><x-tad-bigger> drawText];
[fillImage drawAtPoint:NSZeroPoint fromRect:[</x-tad-bigger><x-tad-bigger>self</x-tad-bigger><x-tad-bigger> frame]
operation:NSCompositeSourceIn fraction:</x-tad-bigger><x-tad-bigger>1.0</x-tad-bigger><x-tad-bigger>];
[textImage unlockFocus];
[textImage drawAtPoint:NSZeroPoint fromRect:[</x-tad-bigger><x-tad-bigger>self</x-tad-bigger><x-tad-bigger> frame]
operation:NSCompositeSourceAtop fraction:</x-tad-bigger><x-tad-bigger>1.0</x-tad-bigger><x-tad-bigger>];
[textImage release];
[fillImage release];
}
- (</x-tad-bigger><x-tad-bigger>void</x-tad-bigger><x-tad-bigger>)drawText
{
</x-tad-bigger><x-tad-bigger>// Text Drawing Code Here</x-tad-bigger><x-tad-bigger>
}
- (</x-tad-bigger><x-tad-bigger>void</x-tad-bigger><x-tad-bigger>)drawFill
{
</x-tad-bigger><x-tad-bigger>// Fill Drawing Code Here</x-tad-bigger><x-tad-bigger>
}
</x-tad-bigger> _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden