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

Rendering an NSControl into a NSImage?


  • Subject: Rendering an NSControl into a NSImage?
  • From: Mark Alldritt <email@hidden>
  • Date: Sun, 30 Mar 2003 20:26:01 -0800

Hello,

I'm looking for an example showing how to render a NSControl (e.g. NSButton)
into an NSImage. I'm starting with code that works fine for my custom
views, but which fails for NSControl sub-classes.

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

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

return result;
}

When I'm getting is just the text portion of the button. The rounded ends
of the button are clipped off, and the button title is drawn in the wrong
location (along the bottom of the button).

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.

  • Follow-Ups:
    • Re: Rendering an NSControl into a NSImage?
      • From: Daryn <email@hidden>
  • Prev by Date: Detecting autolaunch
  • Next by Date: Re: NSUnarchiver - Why does this leak?
  • Previous by thread: Detecting autolaunch
  • Next by thread: Re: Rendering an NSControl into a NSImage?
  • Index(es):
    • Date
    • Thread