NSImage/NSImageView opacity
NSImage/NSImageView opacity
- Subject: NSImage/NSImageView opacity
- From: Randall Meadows <email@hidden>
- Date: Thu, 23 Oct 2008 19:20:41 -0600
I'm doing some custom drawing in a custom view, but I need to capture
that in a reflected image. So in that custom view's subclassed -
drawRect:, I'm creating an NSImage, locking focus on that, doing all
my drawing, then unlock focus. I then draw that image as the contents
of the view, and use that image in my reflection view. It's all
working perfectly, except...
The custom drawing doesn't fill up all the contents of the bounds of
the view. Specifically, a black border is left around the outside of
where I'm drawing. You can view a snapshot of what I'm talking about
at <http://www.not-pc.com/ViewBorder.png> (that's the top-right corner
of the custom view); the blue is the background, the gray is the
contents of the view I'm drawing, and the black is what I'd like to
get rid of (the blue background should show through).
I *thought* the trick to doing this was to use clearColor, so I do
this right after I create the NSImage and lock focus on it:
[[NSColor clearColor] set];
[NSBezierPath fillRect:[self bounds]];
(I create the image the same size as the view itself, so using [self
bounds] should be correct, no?)
I *also* fill the view itself with the clearColor in a similar manner
before I blast the image into it, but none of this is working. I've
also mucked about with returning YES and NO from -isOpaque:, but that
didn't make a difference either.
What am I missing to make my image transparent where I don't actually
draw anything?
Thanks!
randy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden