Re: Quartz call to generate shadows?
Re: Quartz call to generate shadows?
- Subject: Re: Quartz call to generate shadows?
- From: David Remahl <email@hidden>
- Date: Fri, 22 Feb 2002 11:50:30 +0100
OK, so now that it works, how do we make it work safely? What would happen
if these functions are removed from CGS in future versions of the OS? Should
one check for the existence of them at runtime, and disable shadow drawing
if they aren't present?
/ David
>
This API seems to work fine on 10.1.3... it took me a while to figure
>
out what Height, Radius, Azimuth and Ka did... so I wrote a test app to
>
try out different values... it's just a bunch of sliders and a
>
rectangle...
>
>
Height is the virtual height of your drawing above the shadow plane.
>
Azimuth is the angle that the light hits your drawing.
>
Radius... might be the radius of the light source... 0 would be a point
>
lightsource which has sharp edges, bigger radii gets you fuzzier edges /
>
but slower rendering.
>
Ka is the level of ambient light. 0 makes real dark shadows, 1 makes
>
invisible ones.
>
>
If anyone wants to play with this, I put the app up on my site...
>
http://www.whidbeysoft.com/downloads/TestShadow.tar.gz
>
>
>
On Thursday, February 21, 2002, at 01:19 PM, email@hidden wrote:
>
>
> I found this thread in the archives from October of last year... Scott
>
> implied that John Geleynse from Apple would have some input on how to
>
> draw shadows properly in the future... Has anything constructive
>
> happened on this front in the last four months?
>
>
>
> I have written a clone of NSProgressIndicator that is a subclass of
>
> NSControl and uses an NSCell subclass for drawing, so it is easier to
>
> integrate into NSTableView... it is identical, except for the shadow...
>
> so I'd love it if there was a blessed way to draw these...
>
>
>
>
>
> On Monday, October 8, 2001, at 11:02 PM, Scott Herz wrote:
>
>
>
>> I'm not on the CG team, but be prepared for this not to work in an
>
>> upcoming version of 10.
>
>>
>
>> Scott.
>
>>
>
>>> On Sunday, October 7, 2001, at 03:39 AM, Finlay Dobbie wrote:
>
>>>
>
>>> 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
_______________________________________________
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.