Re: Drawing shadow
Re: Drawing shadow
- Subject: Re: Drawing shadow
- From: Youngjin Kim <email@hidden>
- Date: Sun, 17 Jun 2001 00:47:50 +0900
I'm following up my own thread. At first, I tried with trasparent tiff
image, but it wasn't flexible enough to use.
// draw shadow
if(hilited)
{
[path setLineJoinStyle:NSRoundLineCapStyle];
[[NSColor colorWithCalibratedRed:0.0 green:0.0 blue:0.0
alpha:0.1] set];
for (i=0;i<10;i+=2)
{
[path setLineWidth:i*2];
[path stroke];
}
}
// draw your object over it
...
The idea is simple. Set the line join style to round so that shadow of
angled corners to be rendered smoothly then storke it in varied widths,
translucent black color. To get more realistic look, the path for
shadow should be placed little lower from original position.
This worked for me.
Youngjin