NSButtonCell subclass (partially transparent images)
NSButtonCell subclass (partially transparent images)
- Subject: NSButtonCell subclass (partially transparent images)
- From: Darrin Filer <email@hidden>
- Date: Fri, 8 Feb 2002 16:24:59 -0500
I'm trying to override
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView
*)controlView
in order to make it possible to properly render buttons whose images
have transparent areas.
The overridden methods are pasted below. If they are commented out,
NSButtonCell's default implementation succeeds in drawing the button's
image but without the transparent regions being transparent. With them
uncommented, no drawing appears at all.
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
[self drawInteriorWithFrame:cellFrame inView:controlView];
}
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView
*)controlView {
[controlView lockFocus];
[[self image] compositeToPoint:cellFrame.origin
operation:NSCompositeCopy];
[controlView unlockFocus];
[controlView setNeedsDisplay:YES];
}
What gives? Once I can draw into the control view, I'll add in code to
draw the appropriate image given button state...
darrin filer
_______________________________________________
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.