Re: Making opaque images transparent
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.