• 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: Making opaque images transparent
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making opaque images transparent


  • Subject: Re: Making opaque images transparent
  • From: "John C. Randolph" <email@hidden>
  • Date: Mon, 20 Jan 2003 13:14:47 -0800

On Sunday, January 19, 2003, at 09:50 PM, Keith Renz wrote:

Can anyone tell me how to make an opaque image transparent again? I want to redraw an image, but I need to initially make it completely transparent so it doesn't block highlighting in a table view. I will need to erase the old drawing first, make it transparent and draw it again. A new NSImage is allocated and initialized completely transparent. How can I get back to this state without having to create a new image?

NSImage *myImage;
NSSize size = [myImage size];

[myImage lockFocus];
[[NSColor clearColor] set];
NSRectFill(NSMakeRect(0,0,size.width, size.height);
[myImage unlockFocus];

-jcr

John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
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.

References: 
 >Making opaque images transparent (From: Keith Renz <email@hidden>)

  • Prev by Date: RE: Sending object between threads.
  • Next by Date: Re: Autorelease pool questions
  • Previous by thread: Re: Making opaque images transparent
  • Next by thread: How to exec a subtool as root
  • Index(es):
    • Date
    • Thread