• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Quartz call to generate shadows?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quartz call to generate shadows?


  • Subject: Re: Quartz call to generate shadows?
  • From: email@hidden
  • Date: Fri, 22 Feb 2002 02:12:36 -0800

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.
_______________________________________________
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.

  • Follow-Ups:
    • Re: Quartz call to generate shadows?
      • From: David Remahl <email@hidden>
References: 
 >Re: Quartz call to generate shadows? (From: email@hidden)

  • Prev by Date: Re: [Cocoa]Volume Control keys
  • Next by Date: Re: Cocoa newbie - document-based Cocoa app with OpenGL
  • Previous by thread: Changing Fonts From a Toolbar
  • Next by thread: Re: Quartz call to generate shadows?
  • Index(es):
    • Date
    • Thread