Re: Background application is visible when I try to display a transparent backgrounded image into my app
Re: Background application is visible when I try to display a transparent backgrounded image into my app
- Subject: Re: Background application is visible when I try to display a transparent backgrounded image into my app
- From: Ken Ferry <email@hidden>
- Date: Thu, 24 Sep 2009 14:02:48 -0700
On Wed, Sep 23, 2009 at 11:21 PM, Symadept <email@hidden> wrote:
> Hi,
> I am trying to display an Image whose background is transparent as a
> buttoncell. Then the application background of my app or the desktop is
> visible and when I clicked on it, it focuses to the visible app.
>
> Why it is so happening.
>
> Code goes like this.
>
> Subclassed the NSButtonCell and tried to associate my Buttoncell from IB.
>
> mImage = [NSImage imageNamed:@"TransparentImage"];
>
>
> - (void)drawWithFrame:(NSRect)bounds inView:(NSView *)controlView
>
> {
>
> NSRect imageRect = bounds;//[self imageRectForBounds:bounds];
>
> if (mImage != nil) {
>
> [mImage setFlipped:[controlView isFlipped]];
>
This is not your immediate problem, but -setFlipped: is deprecated, and it's
deprecated because people try to use it like this, which is incorrect.
Please see the AppKit release notes, or, say, <
http://www.noodlesoft.com/blog/2009/02/02/understanding-flipped-coordinate-systems/
>.
> [mImage drawInRect:imageRect fromRect:NSZeroRect operation:
> * NSCompositeSourceIn* fraction:1.0];
>
NSCompositeSourceIn is an unusual compositing operation that you only want
in very specific circumstances. You almost certainly want
NSCompositeSourceOver. This is probably the problem.
>
> }
>
> }
>
>
> What am I missing here.
>
>
> Kindly help me in this regards.
>
>
> Best regards
>
> Mustafa Shaik
> _______________________________________________
>
> 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
>
_______________________________________________
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