Re: complex problem 2
Re: complex problem 2
- Subject: Re: complex problem 2
- From: email@hidden
- Date: Mon, 25 Feb 2002 21:58:00 -0800
I apparently did not do a very good job in explaining what the problem
is. I have an NSView one NSButton in it and an NSTextField. I want all
of those to be semi-transparent, until the user moves their mouse over;
there are no custom graphics, really.
Ah; yes, doing open-heart surgery on AppKit classes is a very
different problem from making one's own classes do what one wishes. :->
I think this would probably be difficult, as the internals that draw
these controls are not really public. However, I do have a hack to
offer. :-> If the background behind the controls is reproducible (i.e
white, pinstripes, etc.), you could draw that background *after* the
controls in question have finished drawing, using however much alpha you
desire. If you do this properly, the result should be indistinguishable
from the controls themselves drawing with transparency (A mixed with B
in x-y proportion is the same as B mixed with A in y-x proportion). The
areas where you're drawing the background over itself should remain
unchanged (A mixed with A in protions that sum to 100% results in A).
You would do this in the drawRect: of a subclass of the relevant class,
after calling -super to do all display, like so:
- (void)drawRect:(NSRect)rect
{
[super drawRect:rect];
[self drawBackgroundOverRect:rect withAlpha:0.5];
}
or some such. This assumes that AppKit legitimately routes all drawing
through drawRect: for these classes (I imagine it does, but I don't
know).
Best of luck...
Ben Haller
Stick Software
_______________________________________________
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.