Quartz call to generate shadows?
-
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.
-jcr
"I fear all we have done is to awaken a sleeping giant and fill him with
a terrible resolve." -Admiral Isoroku Yamamoto, Dec 7, 1941. -
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 -
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
> <cocoa-dev...>
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev -
On Monday, October 8, 2001, at 09: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.
Ho hum, I wouldn't be surprised if it didn't. Are there going to be any
public calls for doing this in a future release?
-- Finlay -
Beats me. I'd start by sending a message to John Geleynse. I'm sure a
case could be made that it's important to maintain a certain look and
feel. In the mean time, I would avoid this particular call.
Scott.
On Monday, October 8, 2001, at 01:04 PM, Finlay Dobbie wrote:> On Monday, October 8, 2001, at 09: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.
>
> Ho hum, I wouldn't be surprised if it didn't. Are there going to be any
> public calls for doing this in a future release?
>
> -- Finlay
> _______________________________________________
> cocoa-dev mailing list
> <cocoa-dev...>
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev -
Scott,
Since Quartz was first demonstrated, shadows were one of the implied
featured benefits. The sample application that allowed you to
manipulate PDF's using Quartz, allowed you to scale, rotate, change the
transparency and add a shadow. When the API's finally arrived, shadows
were the only thing missing.
Beyond just keeping the look and feel consistent, It's also important to
keep the performance and stability constant. How many of us looking to
add shadows to our views, have the time, or needed resources to make
sure it takes advantage of AltiVec or GPU if available? What we need is
a standard way to add shadows to objects. Either draw to a transparent
view and then composite with shadow to another view, or the ability to
attach a shadow to a view, so that when it was drawn, the shadow was
drawn automatically for us.
Are there any other recommended ways to add a shadow to a view? Public
examples? Source code? Books?
Cheers,
Brant
On Monday, October 8, 2001, at 05:20 , <cocoa-dev-request...>
wrote:> Beats me. I'd start by sending a message to John Geleynse. I'm sure a
> case could be made that it's important to maintain a certain look and
> feel. In the mean time, I would avoid this particular call.
>
> Scott.
>
> On Monday, October 8, 2001, at 01:04 PM, Finlay Dobbie wrote:
>
>> On Monday, October 8, 2001, at 09: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.
>>
>> Ho hum, I wouldn't be surprised if it didn't. Are there going to be any
>> public calls for doing this in a future release? -
You're preaching to the converted. Talk to John Geleynse.
Scott.
On Monday, October 8, 2001, at 05:57 PM, Brant Vasilieff wrote:> Scott,
>
> Since Quartz was first demonstrated, shadows were one of the implied
> featured benefits. The sample application that allowed you to
> manipulate PDF's using Quartz, allowed you to scale, rotate, change the
> transparency and add a shadow. When the API's finally arrived, shadows
> were the only thing missing.
>
> Beyond just keeping the look and feel consistent, It's also important
> to keep the performance and stability constant. How many of us looking
> to add shadows to our views, have the time, or needed resources to make
> sure it takes advantage of AltiVec or GPU if available? What we need
> is a standard way to add shadows to objects. Either draw to a
> transparent view and then composite with shadow to another view, or the
> ability to attach a shadow to a view, so that when it was drawn, the
> shadow was drawn automatically for us.
>
> Are there any other recommended ways to add a shadow to a view? Public
> examples? Source code? Books?
>
> Cheers,
> Brant
>
>
> On Monday, October 8, 2001, at 05:20 , cocoa-dev-
> <request...> wrote:
>
>> Beats me. I'd start by sending a message to John Geleynse. I'm sure a
>> case could be made that it's important to maintain a certain look and
>> feel. In the mean time, I would avoid this particular call.
>>
>> Scott.
>>
>> On Monday, October 8, 2001, at 01:04 PM, Finlay Dobbie wrote:
>>
>>> On Monday, October 8, 2001, at 09: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.
>>>
>>> Ho hum, I wouldn't be surprised if it didn't. Are there going to be
>>> any
>>> public calls for doing this in a future release?
> _______________________________________________
> cocoa-dev mailing list
> <cocoa-dev...>
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev


