Re: Quartz call to generate shadows?
Re: Quartz call to generate shadows?
- Subject: Re: Quartz call to generate shadows?
- From: Finlay Dobbie <email@hidden>
- Date: Sun, 7 Oct 2001 11:39:12 +0100
On Sunday, October 7, 2001, at 06:12 am, John C. Randolph wrote:
>
Does anyone know how to get hold of Quartz's code for generating
>
shadows around windows? I'd like to create shadows from bitmaps using
>
the same algorithm.
There is a way of setting shadowing on the current graphics context, but
for some reason it's private. This is how ASM does it:
// private SPI function definitions into the CoreGraphics framework
extern void *CGSReadObjectFromCString(char*);
extern char *CGSUniqueCString(char*);
extern void *CGSSetGStateAttribute(void*,char*,void*);
extern void *CGSReleaseGenericObj(void*);
void *r27, *r29;
[NSGraphicsContext saveGraphicsState];
r27 = CGSReadObjectFromCString("{ Style = Shadow; Height = 2;
Radius = 2; Azimuth = 90; Ka = 0.6; }");
r29 = [[NSGraphicsContext currentContext] graphicsPort];
CGSSetGStateAttribute(r29, CGSUniqueCString("Style"), r27);
<< do drawing >>
[NSGraphicsContext restoreGraphicsState];
CGSReleaseGenericObj(r27);
-- Finlay