Re: Drawing shadows?
Re: Drawing shadows?
- Subject: Re: Drawing shadows?
- From: Gideon King <email@hidden>
- Date: Tue, 29 Jan 2002 21:19:33 +0800
There is a *private unsupported* api which will let you turn the shadow
drawing on and off at will:
void *r27, *r29;
// To turn it on...
extern void *CGSReadObjectFromCString(char*);
extern char *CGSUniqueCString(char*);
extern void *CGSSetGStateAttribute(void*,char*,void*);
[NSGraphicsContext saveGraphicsState];
r27 = CGSReadObjectFromCString( "{ Style = Shadow; Height = 10;
Radius = 9; Azimuth = 90; Ka = 0.6; }");
r29 = [[NSGraphicsContext currentContext] graphicsPort];
CGSSetGStateAttribute( r29, CGSUniqueCString( "Style"), r27);
// Then do your drawing in here
// To turn it off
extern void *CGSReleaseGenericObj(void*);
[NSGraphicsContext restoreGraphicsState];
CGSReleaseGenericObj( r27);
I have submitted a request on the bug tracker for this to be turned into
a public API, but have not had any response. I use this extensively in
my app, but am very hesitant about releasing it publicly until this
issue is resolved, as it may disappear at any time.
A number of people have asked for this functionality, so maybe if you
submit a request to Apple they may listen if they realize it is a
generally useful thing...
Gideon
On Tuesday, January 29, 2002, at 10:12 AM, Clyde McQueen wrote:
Is there a magic Cocoa API to draw the nifty shadows around objects? Or
should I start measuring gray values?
Btw, NSImageView setImageFrameStyle:NSImageFramePhoto doesn't quite do
the trick. The default NSImageFrameGrayBezel "sunken look" is the right
idea, except that I want to put the shadow around an arbitrary object.
/Clyde
_______________________________________________
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.