Background application is visible when I try to display a transparent backgrounded image into my app

2009-09-24 Thread Symadept
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]];

[mImage drawInRect:imageRect fromRect:NSZeroRect operation:
NSCompositeSourceIn fraction:1.0];

}

}


What am I missing here.


Kindly help me in this regards.


Best regards

Mustafa Shaik
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Background application is visible when I try to display a transparent backgrounded image into my app

2009-09-24 Thread Ken Ferry
On Wed, Sep 23, 2009 at 11:21 PM, Symadept symad...@gmail.com 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 (Cocoa-dev@lists.apple.com)

 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:
 http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com

 This email sent to kenfe...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com