diff options
author | avenjamin <avenjamin@gmail.com> | 2009-12-20 01:19:52 +0000 |
---|---|---|
committer | avenjamin <avenjamin@gmail.com> | 2009-12-20 01:19:52 +0000 |
commit | ea1b48967ce34718d2645c4a30fab6b67e66f9fa (patch) | |
tree | a51ebe2f74a0c8e6c89f085df4240336c98aedf7 /Frameworks/BWToolkitFramework.framework/NSColor+BWAdditions.m | |
parent | c25a2f4561a4cde2d2d9a431cd941704d79bb428 (diff) | |
download | sequelpro-ea1b48967ce34718d2645c4a30fab6b67e66f9fa.tar.gz sequelpro-ea1b48967ce34718d2645c4a30fab6b67e66f9fa.tar.bz2 sequelpro-ea1b48967ce34718d2645c4a30fab6b67e66f9fa.zip |
- Updating Growl to 1.2
- Updating BWToolkit to 1.2.2
- Changed BWToolkit from building it ourselves to just include the latest release of the framework
- Changed build settings to build 32 and 64 universal binaries
- Changed compiler to Clang
Diffstat (limited to 'Frameworks/BWToolkitFramework.framework/NSColor+BWAdditions.m')
-rw-r--r-- | Frameworks/BWToolkitFramework.framework/NSColor+BWAdditions.m | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/Frameworks/BWToolkitFramework.framework/NSColor+BWAdditions.m b/Frameworks/BWToolkitFramework.framework/NSColor+BWAdditions.m deleted file mode 100644 index 4482bd16..00000000 --- a/Frameworks/BWToolkitFramework.framework/NSColor+BWAdditions.m +++ /dev/null @@ -1,79 +0,0 @@ -// -// NSColor+PixelWideLines.m -// BWToolkit -// -// Created by Brandon Walkin (www.brandonwalkin.com) -// All code is provided under the New BSD license. -// - -#import "NSColor+BWAdditions.h" - -@implementation NSColor (BWAdditions) - -// Use this method to draw 1 px wide lines independent of scale factor. Handy for resolution independent drawing. Still needs some work - there are issues with drawing at the edges of views. -- (void)drawPixelThickLineAtPosition:(int)posInPixels withInset:(int)insetInPixels inRect:(NSRect)aRect inView:(NSView *)view horizontal:(BOOL)isHorizontal flip:(BOOL)shouldFlip -{ - // Convert the given rectangle from points to pixels - aRect = [view convertRectToBase:aRect]; - - // Round up the rect's values to integers - aRect = NSIntegralRect(aRect); - - // Add or subtract 0.5 so the lines are drawn within pixel bounds - if (isHorizontal) - { - if ([view isFlipped]) - aRect.origin.y -= 0.5; - else - aRect.origin.y += 0.5; - } - else - { - aRect.origin.x += 0.5; - } - - NSSize sizeInPixels = aRect.size; - - // Convert the rect back to points for drawing - aRect = [view convertRectFromBase:aRect]; - - // Flip the position so it's at the other side of the rect - if (shouldFlip) - { - if (isHorizontal) - posInPixels = sizeInPixels.height - posInPixels - 1; - else - posInPixels = sizeInPixels.width - posInPixels - 1; - } - - float posInPoints = posInPixels / [[NSScreen mainScreen] userSpaceScaleFactor]; - float insetInPoints = insetInPixels / [[NSScreen mainScreen] userSpaceScaleFactor]; - - // Calculate line start and end points - float startX, startY, endX, endY; - - if (isHorizontal) - { - startX = aRect.origin.x + insetInPoints; - startY = aRect.origin.y + posInPoints; - endX = aRect.origin.x + aRect.size.width - insetInPoints; - endY = aRect.origin.y + posInPoints; - } - else - { - startX = aRect.origin.x + posInPoints; - startY = aRect.origin.y + insetInPoints; - endX = aRect.origin.x + posInPoints; - endY = aRect.origin.y + aRect.size.height - insetInPoints; - } - - // Draw line - NSBezierPath *path = [NSBezierPath bezierPath]; - [path setLineWidth:0.0f]; - [path moveToPoint:NSMakePoint(startX,startY)]; - [path lineToPoint:NSMakePoint(endX,endY)]; - [self set]; - [path stroke]; -} - -@end |