aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/BWToolkitFramework.framework/NSImage+BWAdditions.m
diff options
context:
space:
mode:
authoravenjamin <avenjamin@gmail.com>2009-12-20 01:19:52 +0000
committeravenjamin <avenjamin@gmail.com>2009-12-20 01:19:52 +0000
commitea1b48967ce34718d2645c4a30fab6b67e66f9fa (patch)
treea51ebe2f74a0c8e6c89f085df4240336c98aedf7 /Frameworks/BWToolkitFramework.framework/NSImage+BWAdditions.m
parentc25a2f4561a4cde2d2d9a431cd941704d79bb428 (diff)
downloadsequelpro-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/NSImage+BWAdditions.m')
-rw-r--r--Frameworks/BWToolkitFramework.framework/NSImage+BWAdditions.m83
1 files changed, 0 insertions, 83 deletions
diff --git a/Frameworks/BWToolkitFramework.framework/NSImage+BWAdditions.m b/Frameworks/BWToolkitFramework.framework/NSImage+BWAdditions.m
deleted file mode 100644
index eef2b972..00000000
--- a/Frameworks/BWToolkitFramework.framework/NSImage+BWAdditions.m
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// NSImage+BWAdditions.m
-// BWToolkit
-//
-// Created by Brandon Walkin (www.brandonwalkin.com)
-// All code is provided under the New BSD license.
-//
-
-#import "NSImage+BWAdditions.h"
-
-@implementation NSImage (BWAdditions)
-
-// Draw a solid color over an image - taking into account alpha. Useful for coloring template images.
-
-- (NSImage *)tintedImageWithColor:(NSColor *)tint
-{
- NSSize size = [self size];
- NSRect imageBounds = NSMakeRect(0, 0, size.width, size.height);
-
- NSImage *copiedImage = [self copy];
-
- [copiedImage lockFocus];
-
- [tint set];
- NSRectFillUsingOperation(imageBounds, NSCompositeSourceAtop);
-
- [copiedImage unlockFocus];
-
- return [copiedImage autorelease];
-}
-
-// Rotate an image 90 degrees clockwise or counterclockwise
-// Code from http://swik.net/User:marc/Chipmunk+Ninja+Technical+Articles/Rotating+an+NSImage+object+in+Cocoa/zgha
-
-- (NSImage *)rotateImage90DegreesClockwise:(BOOL)clockwise
-{
- NSImage *existingImage = self;
- NSSize existingSize;
-
- /**
- * Get the size of the original image in its raw bitmap format.
- * The bestRepresentationForDevice: nil tells the NSImage to just
- * give us the raw image instead of it's wacky DPI-translated version.
- */
- existingSize.width = [[existingImage bestRepresentationForDevice:nil] pixelsWide];
- existingSize.height = [[existingImage bestRepresentationForDevice:nil] pixelsHigh];
-
- NSSize newSize = NSMakeSize(existingSize.height, existingSize.width);
- NSImage *rotatedImage = [[[NSImage alloc] initWithSize:newSize] autorelease];
-
- [rotatedImage lockFocus];
-
- /**
- * Apply the following transformations:
- *
- * - bring the rotation point to the centre of the image instead of
- * the default lower, left corner (0,0).
- * - rotate it by 90 degrees, either clock or counter clockwise.
- * - re-translate the rotated image back down to the lower left corner
- * so that it appears in the right place.
- */
- NSAffineTransform *rotateTF = [NSAffineTransform transform];
- NSPoint centerPoint = NSMakePoint(newSize.width / 2, newSize.height / 2);
-
- [rotateTF translateXBy: centerPoint.x yBy: centerPoint.y];
- [rotateTF rotateByDegrees: (clockwise) ? - 90 : 90];
- [rotateTF translateXBy: -centerPoint.y yBy: -centerPoint.x];
- [rotateTF concat];
-
- /**
- * We have to get the image representation to do its drawing directly,
- * because otherwise the stupid NSImage DPI thingie bites us in the butt
- * again.
- */
- NSRect r1 = NSMakeRect(0, 0, newSize.height, newSize.width);
- [[existingImage bestRepresentationForDevice:nil] drawInRect:r1];
-
- [rotatedImage unlockFocus];
-
- return rotatedImage;
-}
-
-@end