• 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: Retrieving the current -[NSShadow set]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retrieving the current -[NSShadow set]


  • Subject: Re: Retrieving the current -[NSShadow set]
  • From: Keith Duncan <email@hidden>
  • Date: Fri, 25 Jul 2008 15:16:15 +0100

Here's the code:

// Created by Sean Patrick O'Brien on 4/1/08.
// Copyright 2008 MolokoCacao. All rights reserved.
- (void)fillWithInnerShadow:(NSShadow *)shadow {
[NSGraphicsContext saveGraphicsState];

NSShadow *shadowCopy = [shadow copy];

NSSize offset = shadowCopy.shadowOffset;
CGFloat radius = shadowCopy.shadowBlurRadius;

NSRect bounds = NSInsetRect(self.bounds, -(ABS(offset.width) + radius), -(ABS(offset.height) + radius));

offset.height += bounds.size.height;
shadowCopy.shadowOffset = offset;

NSAffineTransform *transform = [NSAffineTransform transform];
[transform translateXBy:0 yBy:([[NSGraphicsContext currentContext] isFlipped] ? 1 : -1) * bounds.size.height];

NSBezierPath *drawingPath = [NSBezierPath bezierPathWithRect:bounds];
[drawingPath setWindingRule:NSEvenOddWindingRule];

[drawingPath appendBezierPath:self];
[drawingPath transformUsingAffineTransform:transform];

[self addClip];
[shadowCopy set];

[[NSColor blackColor] set];
[drawingPath fill];

[shadowCopy release];

[NSGraphicsContext restoreGraphicsState];
}


Keith Duncan
email@hidden, 33software.com

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Retrieving the current -[NSShadow set]
      • From: "Michael Ash" <email@hidden>
References: 
 >Retrieving the current -[NSShadow set] (From: Keith Duncan <email@hidden>)
 >Re: Retrieving the current -[NSShadow set] (From: Graham Cox <email@hidden>)
 >Re: Retrieving the current -[NSShadow set] (From: Keith Duncan <email@hidden>)
 >Re: Retrieving the current -[NSShadow set] (From: "Michael Ash" <email@hidden>)

  • Prev by Date: Re: Retrieving the current -[NSShadow set]
  • Next by Date: Re: Folder has limited permissions.
  • Previous by thread: Re: Retrieving the current -[NSShadow set]
  • Next by thread: Re: Retrieving the current -[NSShadow set]
  • Index(es):
    • Date
    • Thread