• 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: Rendering an NSControl into a NSImage?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rendering an NSControl into a NSImage?


  • Subject: Re: Rendering an NSControl into a NSImage?
  • From: Daryn <email@hidden>
  • Date: Tue, 1 Apr 2003 01:00:47 -0600

Instead of invoking setFramOrigin on self, try setting bnds.origin = NSZeroPoint. Invoking [self setNeedsDisplay:YES] prior to invoking drawRect: may help if the receiver is doing some kind of optimized drawing. Perhaps someone with more experience can chime in if I'm providing misleading advice.

On Monday, March 31, 2003, at 10:31 AM, Mark Alldritt wrote:

Hello,

Try using the receiver's frame rect instead of its bounds. Be sure to
adjust of the origin of the frame to (0,0) before drawing the rect. Or
perhaps invoking setFrameOrigin: on the image to match the control's
origin may work.

Thanks for the suggestion. I changed my code as follows, but all that
happened is that the image moved around. It is still clipped and misdrawn.

- (NSImage*) proxyImage
{
[self setFrameOrigin:NSZeroPoint];
NSRect bnds = [self frame];
NSImage* result = [[NSImage alloc] initWithSize: bnds.size];

[result lockFocus];
[self drawRect: bnds];
[result unlockFocus];
[result autorelease];

return result;
}

Cheers
-Mark

---------------------------------------------------------------------
Mark Alldritt Late Night Software Ltd.
Phone: 250-380-1725 333 Moss Street
FAX: 250-383-3204 Victoria, B.C.
WEB: http://www.latenightsw.com/ CANADA V8V-4M9
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


Daryn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: NSUnarchiver - Why does this leak?
  • Next by Date: Re: Resizing problem
  • Previous by thread: Re: Newbie: Drag and drop onto application
  • Next by thread: Re: Rendering an NSControl into a NSImage?
  • Index(es):
    • Date
    • Thread