Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Horlick committed Aug 5, 2018
0 parents commit d0fcaf7
Show file tree
Hide file tree
Showing 117 changed files with 13,074 additions and 0 deletions.
68 changes: 68 additions & 0 deletions Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,68 @@
{
"images" : [
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "spiritied_array_app_icon_16.png",
"scale" : "1x"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "spiritied_array_app_icon_32-1.png",
"scale" : "2x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "spiritied_array_app_icon_32.png",
"scale" : "1x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "spiritied_array_app_icon_64.png",
"scale" : "2x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "spiritied_array_app_icon_128.png",
"scale" : "1x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "spiritied_array_app_icon_256-1.png",
"scale" : "2x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "spiritied_array_app_icon_256.png",
"scale" : "1x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "spiritied_array_app_icon_512.png",
"scale" : "2x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "spiritied_array_app_icon_512-1.png",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "spiritied_array_app_icon_1024.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
674 changes: 674 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions README.md
@@ -0,0 +1,30 @@
_Spirited Array_ is a Mac application for de-pixelating and then whimsically re-pixelating animated GIF's. Inspired by the nightly Electrical Water Pageant on the Seven Seas Lagoon at Walt Disney World, Spirited Array was written to simulate light board animations of unspecified dimension, without expensive hardware.

# Operation

To operate, open the Application on your Mac and choose _Open_ from the _File_ pull-down menu. Then, navigate to and select an animated GIF, static GIF, (static) PNG or (static) TIFF file.

An attempt will be made to recognize any pixelation your file exhibits, and remove it. Finally, your animation will be re-pixelated according to the configured tiling strategy, and animated in a loop. Details about your animation will be provided in a status bar at the lower left-hand corner of the animation window.

| ![](docs/animation_window.png) |
|:--:|
| _screenshot of animation processed from prguitarman's "Pop Tart Cat" GIF (popularized as "Nyan Cat" in a video by saraj00n.)_ |

You may choose different tiling strategies with the _Tiling_ pull-down menu.

To change the dimensions of the virtual array, simply resize the animation window.

Use the linked sliders that appear after processing to change the tile size and restart the de-pixelation and re-pixelation sequence.

By default, the vertical and horizontal sliders will be locked together. You can toggle locking on and off by clicking on the padlock icon in the lower right-hand corner of the animation window.

To export re-pixelated video to a file, use the appropriate Export corresponding to the desired output format under the _File_ Menu.

# Building from Source

_Spirited Array_ is licensed under GPL v3.0 and available to clone [on github](https://github.com/dhorlick/spirited_array).

The project should build directly in XCode 9.

_Spirited Array_ makes use of MIT-licensed [libungif-4.1.4](https://sourceforge.net/projects/giflib/files/libungif-4.x/4.1.1/), a decompression-only version of the venerable giflib. To keep things simple, an actual binary is included. But feel free to compile libungif (or giflib) yourself, and replace `libungif.a`.

13 changes: 13 additions & 0 deletions appkit/AppKitAwareSpiritedArrayFactory.h
@@ -0,0 +1,13 @@
//
// AppKitAwareSpirtedArrayFactory.h
// spiritedarray
//
// Created by Dave Horlick on 8/27/13.
// Copyleft 2013 River Porpoise Software
//

#import "SpiritedArrayFactory.h"

@interface AppKitAwareSpiritedArrayFactory : SpiritedArrayFactory

@end
58 changes: 58 additions & 0 deletions appkit/AppKitAwareSpiritedArrayFactory.m
@@ -0,0 +1,58 @@
//
// AppKitAwareSpirtedArrayFactory.m
// spiritedarray
//
// Created by Dave Horlick on 8/27/13.
// Copyleft 2013 River Porpoise Software
//

#import "AppKitAwareSpiritedArrayFactory.h"
#import "CoreGraphicsImageDataBackedSpiritedArray.h"

@implementation AppKitAwareSpiritedArrayFactory

+(SpiritedArray *) build:(NSString *)imageFileName
{
NSLog(@"imageFileName = %@", imageFileName);
NSString* extension = [SpiritedArrayFactory fileExtension: imageFileName];
NSLog(@"extension = %@", extension);
// CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

if ([extension caseInsensitiveCompare: @"png"]==0)
{
/** ?
UIImage *image = [UIImage imageNamed:@"image.png"];
CGImageRef imageRef = [image CGImage];
*/

NSImage* nsImage = [[NSImage alloc] initWithContentsOfFile:imageFileName];
if (nsImage == nil)
{
@throw [NSException exceptionWithName:@"Can't open image file" reason:[NSString stringWithFormat:@"Attempt to open %@ returned nil.", imageFileName] userInfo: nil];
}

// CGContextRef context = CGBitmapContextCreate(NULL, 14, 14, 8, 0, colorSpace, kCGImageAlphaPremultipliedLast);
// [nsImage CGImageForProposedRect:nil context:context hints:nil];

NSData *imageData = [nsImage TIFFRepresentation];

return [[CoreGraphicsImageDataBackedSpiritedArray alloc] initWithImageData:(UInt8*)[imageData bytes] Width: [nsImage size].width Height:[nsImage size].height];

// CFDataRef cfImageData = CFBridgingRetain(imageData);
// CGImageSourceRef source = CGImageSourceCreateWithData(cfImageData, NULL);
// CGImageRef maskRef = CGImageSourceCreateImageAtIndex(source, 0, NULL);

// CGContextRelease(context);
// CFRelease(cfImageData);
// CFRelease(source);

// TODO release imageData, somehow?
}
else
{
return [[AppKitAwareSpiritedArrayFactory superclass] build:imageFileName];
}
}


@end
60 changes: 60 additions & 0 deletions appkit/SAAppDelegate.h
@@ -0,0 +1,60 @@
//
// SAAppDelegate.h
// spiritedarray
//
// Created by Dave Horlick on 10/19/12.
// Copyleft 2012 River Porpoise Software
//

#import <Cocoa/Cocoa.h>
#import <AudioToolbox/MusicPlayer.h>

#import "SAMacView.h"
#import "SpiritedArray.h"
#import "SAVideoExportSettings.h"
#import "SAVideoExportSettingsController.h"

@interface SAAppDelegate : NSObject <NSApplicationDelegate>
{
BOOL inaugural;
}
@property IBOutlet SAViewHelper* viewHelper; // TODO make this readonly?
@property (getter=desiredTileWidth, setter=setDesiredTileWidth:) IBOutlet NSNumber* desiredTileWidth;
@property (getter=desiredTileHeight, setter=setDesiredTileHeight:) IBOutlet NSNumber* desiredTileHeight;

@property (assign) IBOutlet NSWindow *window;
@property (weak) IBOutlet SAMacView *view;
@property (weak) IBOutlet NSView *exportSettingsView;
@property (weak) IBOutlet NSMenuItem *exportAsGif;
@property (weak) IBOutlet NSMenuItem *exportAsH264EncodedMp4Video;
@property (weak) IBOutlet NSMenuItem *exportAsH264EncodedQuickTimeMovie;
@property (weak) IBOutlet NSMenuItem* solidColors;
@property (weak) IBOutlet NSMenuItem* lightEmittingDiodes;
@property (weak) IBOutlet NSMenuItem* meta;
@property (weak) IBOutlet NSMenuItem* fatBits;
@property (weak) IBOutlet NSMenuItem* graphPaper;
@property (weak) IBOutlet NSMenuItem* crossStitch;
@property (weak) IBOutlet NSMenu* linePrinter;
@property (weak) IBOutlet NSMenu* tiling;
@property (weak) IBOutlet SAVideoExportSettingsController* videoExportSettingsController;
@property (weak) IBOutlet NSButton *lockIcon;
@property (weak) IBOutlet NSSlider *tileWidthSlider;
@property (weak) IBOutlet NSSlider *tileHeightSlider;

+(void) uncheckAllBut:(NSMenuItem*)selection In:(NSMenu*)menu;
+(void) uncheckAllButName:(NSString*)name In:(NSMenu*)menu;

-(IBAction) doOpenFile:(id)sender;
-(IBAction) doExportAsGif:(id)sender;

-(IBAction)doSolidColors:(id)sender;
-(IBAction)doLightEmittingDiodes:(id)sender;
-(IBAction)doFatBits:(id)sender;
-(IBAction)doGraphPaper:(id)sender;

-(IBAction)doExportAsH264EncodedMp4Video:(id)sender;
-(IBAction)doExportAsH264EncodedQuickTimeMovie:(id)sender;

- (IBAction)toggleResizeTileWidthAndHeightTogether:(id)sender;

@end

0 comments on commit d0fcaf7

Please sign in to comment.