Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adjust overlays. Add Bushwick

  • Loading branch information...
commit fe23d2e446f0fc72f9d8e729b21af42e8a80df0b 1 parent f68215f
@aleffert authored
View
12 Appstagram.xcodeproj/project.pbxproj
@@ -25,9 +25,10 @@
778B2A251537E6C900F31379 /* NSWindow+AppstagramFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 778B2A241537E6C900F31379 /* NSWindow+AppstagramFilter.m */; };
778B2A281537E8E700F31379 /* AppstagramFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 778B2A271537E8E700F31379 /* AppstagramFilter.m */; };
77956DA2153B7713007C8424 /* menu-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 77956DA1153B7713007C8424 /* menu-icon.png */; };
- 77956DA5153B7852007C8424 /* menu-icon-selected.png in Resources */ = {isa = PBXBuildFile; fileRef = 77956DA4153B7852007C8424 /* menu-icon-selected.png */; };
77AF4DDD153A1864002E01E2 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77AF4DDC153A1864002E01E2 /* QuartzCore.framework */; };
77AF4DDE153A1868002E01E2 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77AF4DDC153A1864002E01E2 /* QuartzCore.framework */; };
+ 77ED2020153E792E00F77082 /* rose-overlay.png in Resources */ = {isa = PBXBuildFile; fileRef = 77ED201F153E792E00F77082 /* rose-overlay.png */; };
+ 77ED2022153FCAB700F77082 /* santa-cruz-overlay.png in Resources */ = {isa = PBXBuildFile; fileRef = 77ED2021153FCAB700F77082 /* santa-cruz-overlay.png */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -73,8 +74,9 @@
778B2A261537E8E700F31379 /* AppstagramFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppstagramFilter.h; path = Appstagram/Source/AppstagramFilter.h; sourceTree = "<group>"; };
778B2A271537E8E700F31379 /* AppstagramFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppstagramFilter.m; path = Appstagram/Source/AppstagramFilter.m; sourceTree = "<group>"; };
77956DA1153B7713007C8424 /* menu-icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "menu-icon.png"; sourceTree = "<group>"; };
- 77956DA4153B7852007C8424 /* menu-icon-selected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "menu-icon-selected.png"; sourceTree = "<group>"; };
77AF4DDC153A1864002E01E2 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
+ 77ED201F153E792E00F77082 /* rose-overlay.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "rose-overlay.png"; sourceTree = SOURCE_ROOT; };
+ 77ED2021153FCAB700F77082 /* santa-cruz-overlay.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "santa-cruz-overlay.png"; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -179,8 +181,9 @@
children = (
77200C971537DFF800831670 /* MainMenu.xib */,
771E4951153D229B00B6410D /* sepia-overlay.png */,
+ 77ED201F153E792E00F77082 /* rose-overlay.png */,
+ 77ED2021153FCAB700F77082 /* santa-cruz-overlay.png */,
77956DA1153B7713007C8424 /* menu-icon.png */,
- 77956DA4153B7852007C8424 /* menu-icon-selected.png */,
77200C8A1537DFF800831670 /* Appstagram-Info.plist */,
77200C8B1537DFF800831670 /* InfoPlist.strings */,
77200C8E1537DFF800831670 /* main.m */,
@@ -275,6 +278,8 @@
files = (
77114DD51533D07700EF693C /* InfoPlist.strings in Resources */,
771E4952153D229B00B6410D /* sepia-overlay.png in Resources */,
+ 77ED2020153E792E00F77082 /* rose-overlay.png in Resources */,
+ 77ED2022153FCAB700F77082 /* santa-cruz-overlay.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -287,7 +292,6 @@
77200C931537DFF800831670 /* Credits.rtf in Resources */,
77200C991537DFF800831670 /* MainMenu.xib in Resources */,
77956DA2153B7713007C8424 /* menu-icon.png in Resources */,
- 77956DA5153B7852007C8424 /* menu-icon-selected.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
2  Appstagram/Source/AppstagramDelegate.m
@@ -26,7 +26,7 @@ @implementation AppstagramDelegate
@synthesize statusItem = mStatusItem;
- (NSArray*)filterNames {
- return [NSArray arrayWithObjects:@"Boring", @"Ennui", @"Wistful", @"La Vie en Rose", @"Haze", @"Glow", nil];
+ return [NSArray arrayWithObjects:@"Boring", @"Ennui", @"Shootout", @"La Vie en Rose", @"Haze", @"Glow", @"Bushwick", nil];
}
- (void)makeFilterMenu {
View
58 Appstagram/Source/AppstagramFilter.m
@@ -26,6 +26,7 @@ + (AppstagramFilter*)sepiaFilter;
+ (AppstagramFilter*)roseFilter;
+ (AppstagramFilter*)blurFilter;
+ (AppstagramFilter*)glowFilter;
++ (AppstagramFilter*)santaCruzFilter;
@end
@@ -42,9 +43,10 @@ + (NSDictionary*)filterMap {
filters = [[NSDictionary alloc] initWithObjectsAndKeys:
[AppstagramFilter plainFilter], @"Boring",
[AppstagramFilter grayscaleFilter], @"Ennui",
- [AppstagramFilter sepiaFilter], @"Wistful",
+ [AppstagramFilter sepiaFilter], @"Shootout",
[AppstagramFilter roseFilter], @"La Vie en Rose",
[AppstagramFilter blurFilter], @"Haze",
+ [AppstagramFilter santaCruzFilter], @"Bushwick",
[AppstagramFilter glowFilter], @"Glow",
nil];
});
@@ -65,6 +67,21 @@ - (void)dealloc {
[super dealloc];
}
+- (void)addOverlayImageNamed:(NSString*)imageName toWindow:(NSWindow*)window {
+ AppstagramOverlayWindow* childWindow = window.appstagramOverlayWindow;
+ if(childWindow == nil) {
+ [[[AppstagramOverlayWindow alloc] initWithParentWindow:window] autorelease];
+ }
+
+ NSString* imagePath = [[NSBundle bundleForClass:[AppstagramFilter class]] pathForImageResource:imageName];
+ NSImage* overlay = [[[NSImage alloc] initWithContentsOfFile:imagePath] autorelease];
+ [window.appstagramOverlayWindow useOverlayImage:overlay];
+}
+
+- (void)removeOverlayWindowFrom:(NSWindow*)window {
+ [window.appstagramOverlayWindow removeFromParent];
+}
+
+ (AppstagramFilter*)grayscaleFilter {
AppstagramFilter* result = [[[AppstagramFilter alloc] init] autorelease];
CGSWindowFilterRef filter = NULL;
@@ -87,26 +104,19 @@ + (AppstagramFilter*)grayscaleFilter {
}
+ (AppstagramFilter*)sepiaFilter {
- AppstagramFilter* result = [[[AppstagramFilter alloc] init] autorelease];
+ __block AppstagramFilter* result = [[[AppstagramFilter alloc] init] autorelease];
CGSWindowFilterRef filter = NULL;
CGSConnection connection = _CGSDefaultConnection();
CGSNewCIFilterByName(connection, (CFStringRef)@"CISepiaTone", &filter);
CGSSetCIFilterValuesFromDictionary(connection, filter, (CFDictionaryRef)[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:1] forKey:@"inputIntensity"]);
result.applyBlock = ^(NSWindow* window) {
- AppstagramOverlayWindow* childWindow = window.appstagramOverlayWindow;
- if(childWindow == nil) {
- [[[AppstagramOverlayWindow alloc] initWithParentWindow:window] autorelease];
- }
-
- NSString* imagePath = [[NSBundle bundleForClass:[AppstagramFilter class]] pathForImageResource:@"sepia-overlay"];
- NSImage* overlay = [[[NSImage alloc] initWithContentsOfFile:imagePath] autorelease];
+ [result addOverlayImageNamed:@"sepia-overlay" toWindow:window];
CGSAddWindowFilter(connection, (int)window.windowNumber, filter, 4);
- [window.appstagramOverlayWindow useOverlayImage:overlay];
};
result.removeBlock = ^(NSWindow* window) {
CGSRemoveWindowFilter(connection, (int)window.windowNumber, filter);
- [window.appstagramOverlayWindow removeFromParent];
+ [result removeOverlayWindowFrom:window];
};
result.cleanupBlock = ^ {
CGSReleaseCIFilter(connection, filter);
@@ -123,7 +133,7 @@ + (AppstagramFilter*)blurFilter {
CGSSetCIFilterValuesFromDictionary(connection, filter, (CFDictionaryRef)[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:4] forKey:@"inputRadius"]);
result.applyBlock = ^(NSWindow* window) {
- CGSAddWindowFilter(connection, (int)window.windowNumber, filter, 2);
+ CGSAddWindowFilter(connection, (int)window.windowNumber, filter, 4);
};
result.removeBlock = ^(NSWindow* window) {
CGSRemoveWindowFilter(connection, (int)window.windowNumber, filter);
@@ -136,19 +146,19 @@ + (AppstagramFilter*)blurFilter {
}
+ (AppstagramFilter*)roseFilter {
- AppstagramFilter* result = [[[AppstagramFilter alloc] init] autorelease];
+ __block AppstagramFilter* result = [[[AppstagramFilter alloc] init] autorelease];
CGSWindowFilterRef filter = NULL;
CGSConnection connection = _CGSDefaultConnection();
- CGSNewCIFilterByName(connection, (CFStringRef)@"CIFalseColor", &filter);
- CIColor* color1 = [CIColor colorWithRed:255./255. green:217./255. blue:210./255];
- CIColor* color0 = [CIColor colorWithRed:76./255. green:0./255. blue:0./255];
- CGSSetCIFilterValuesFromDictionary(connection, filter, (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys:color0, @"inputColor0", color1, @"inputColor0", nil]);
+ CGSNewCIFilterByName(connection, (CFStringRef)@"CIHeightFieldFromMask", &filter);
+ CGSSetCIFilterValuesFromDictionary(connection, filter, (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:1.7], @"inputRadius", nil]);
result.applyBlock = ^(NSWindow* window) {
CGSAddWindowFilter(connection, (int)window.windowNumber, filter, 4);
+ [result addOverlayImageNamed:@"rose-overlay" toWindow:window];
};
result.removeBlock = ^(NSWindow* window) {
CGSRemoveWindowFilter(connection, (int)window.windowNumber, filter);
+ [result removeOverlayWindowFrom:window];
};
result.cleanupBlock = ^ {
CGSReleaseCIFilter(connection, filter);
@@ -177,6 +187,20 @@ + (AppstagramFilter*)glowFilter {
return result;
}
++ (AppstagramFilter*)santaCruzFilter {
+ __block AppstagramFilter* result = [[[AppstagramFilter alloc] init] autorelease];
+ result.applyBlock = ^(NSWindow* window) {
+ [result addOverlayImageNamed:@"santa-cruz-overlay" toWindow:window];
+ };
+ result.removeBlock = ^(NSWindow* window) {
+ [result removeOverlayWindowFrom:window];
+ };
+ result.cleanupBlock = ^ {
+ };
+
+ return result;
+}
+
+ (AppstagramFilter*)plainFilter {
AppstagramFilter* result = [[[AppstagramFilter alloc] init] autorelease];
result.applyBlock = ^(NSWindow* window) {};
View
BIN  Appstagram/menu-icon-selected.png
Deleted file not rendered
View
BIN  rose-overlay.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  santa-cruz-overlay.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.