• 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: Text Becomes Clipping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Text Becomes Clipping (From: Simon Boissonnault <email@hidden>)

  • Prev by Date: RE: Default Nib on Document based apps
  • Next by Date: Re: Do IMPs move once they're loaded?
  • Previous by thread: Text Becomes Clipping
  • Next by thread: Default Nib on Document based apps
  • Index(es):
    • Date
    • Thread