git-svn-id: svn://qnap.local/TwoTerm/trunk@1655 5590a31f-7b70-45f8-8c82-aa3a8e5f4507

This commit is contained in:
Kelvin Sherlock 2010-07-10 21:12:17 +00:00
parent c9d5afde27
commit 412b1d58e0
7 changed files with 1094 additions and 62 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>ActivePerspectiveName</key>
<string>Project</string>
<string>Debug</string>
<key>AllowedModules</key>
<array>
<dict>
@ -231,8 +231,6 @@
<key>Layout</key>
<array>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@ -269,8 +267,6 @@
<key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
<array>
<string>29B97314FDCFA39411CA2CEA</string>
<string>B6697A3911E7CC66002ED475</string>
<string>B6697A3A11E7CC80002ED475</string>
<string>080E96DDFE201D6D7F000001</string>
<string>29B97315FDCFA39411CA2CEA</string>
<string>29B97317FDCFA39411CA2CEA</string>
@ -278,19 +274,27 @@
<string>1DDD58140DA1D0A300B32029</string>
<string>B676065011DEBAE900D6B66C</string>
<string>29B97323FDCFA39411CA2CEA</string>
<string>1058C7A0FEA54F0111CA2CBB</string>
<string>1058C7A2FEA54F0111CA2CBB</string>
<string>19C28FACFE9D520D11CA2CBB</string>
<string>1C37FBAC04509CD000000102</string>
<string>B60EBE2E11E918E700C1974F</string>
<string>B60EBE2F11E918E700C1974F</string>
<string>1DDD58140DA1D0A300B32029</string>
<string>B676065011DEBAE900D6B66C</string>
<string>B60EBE3011E918E700C1974F</string>
<string>1C77FABC04509CD000000102</string>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>21</integer>
<integer>16</integer>
<integer>0</integer>
<integer>44</integer>
<integer>43</integer>
<integer>42</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
<string>{{0, 0}, {324, 843}}</string>
<string>{{0, 131}, {324, 843}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@ -306,8 +310,6 @@
<string>MainColumn</string>
<real>324</real>
</array>
<key>RubberWindowFrame</key>
<string>347 111 1060 902 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@ -323,7 +325,7 @@
<key>PBXProjectModuleGUID</key>
<string>B676054211DADB9000D6B66C</string>
<key>PBXProjectModuleLabel</key>
<string>EmulatorView.h</string>
<string>ScanLineFilter.m</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@ -331,11 +333,11 @@
<key>PBXProjectModuleGUID</key>
<string>B676054311DADB9000D6B66C</string>
<key>PBXProjectModuleLabel</key>
<string>EmulatorView.h</string>
<string>ScanLineFilter.m</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>B60EBCFF11E7F73B00C1974F</string>
<string>B60EBE5911E91A8800C1974F</string>
<key>history</key>
<array>
<string>B676058811DAE21100D6B66C</string>
@ -343,7 +345,6 @@
<string>B676058B11DAE21100D6B66C</string>
<string>B676058C11DAE21100D6B66C</string>
<string>B676060711DD4FA600D6B66C</string>
<string>B676062F11DE96AE00D6B66C</string>
<string>B676064811DEB80600D6B66C</string>
<string>B67606C811DED91C00D6B66C</string>
<string>B65FA28111E29EDE00EB447E</string>
@ -367,8 +368,12 @@
<string>B6697A5911E7E072002ED475</string>
<string>B6697A5A11E7E072002ED475</string>
<string>B60EBCED11E7F6BE00C1974F</string>
<string>B60EBCEE11E7F6BE00C1974F</string>
<string>B60EBCEF11E7F6BE00C1974F</string>
<string>B60EBDFA11E916AE00C1974F</string>
<string>B60EBDFB11E916AE00C1974F</string>
<string>B60EBDFC11E916AE00C1974F</string>
<string>B60EBE1311E9170000C1974F</string>
<string>B60EBE3311E918EC00C1974F</string>
<string>B60EBE3411E918EC00C1974F</string>
</array>
</dict>
<key>SplitCount</key>
@ -383,8 +388,6 @@
<dict>
<key>Frame</key>
<string>{{0, 0}, {714, 444}}</string>
<key>RubberWindowFrame</key>
<string>347 111 1060 902 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
@ -408,8 +411,6 @@
<dict>
<key>Frame</key>
<string>{{10, 27}, {714, 385}}</string>
<key>RubberWindowFrame</key>
<string>347 111 1060 902 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -484,7 +485,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {714, 375}}</string>
<string>{{10, 27}, {714, 385}}</string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -557,6 +558,8 @@
<key>Layout</key>
<array>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>
@ -568,6 +571,8 @@
<dict>
<key>Frame</key>
<string>{{0, 0}, {1060, 279}}</string>
<key>RubberWindowFrame</key>
<string>363 -152 1060 902 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXDebugCLIModule</string>
@ -642,7 +647,11 @@
</array>
<key>Frame</key>
<string>{{517, 0}, {543, 281}}</string>
<key>RubberWindowFrame</key>
<string>363 -152 1060 902 0 0 1920 1178 </string>
</dict>
<key>RubberWindowFrame</key>
<string>363 -152 1060 902 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXDebugSessionModule</string>
@ -706,13 +715,15 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>B60EBCFB11E7F6BE00C1974F</string>
<string>B60EBE5A11E91A8800C1974F</string>
<string>B60EBD0811E8DEB000C1974F</string>
<string>B60EBD0911E8DEB000C1974F</string>
<string>B60EBCFC11E7F6BE00C1974F</string>
<string>/Users/kelvin/Projects/2Term/2Term.xcodeproj</string>
<string>B60EBCFA11E7F6BE00C1974F</string>
</array>
<key>WindowString</key>
<string>347 111 1060 902 0 0 1920 1178 </string>
<string>363 -152 1060 902 0 0 1920 1178 </string>
<key>WindowToolsV3</key>
<array>
<dict>

View File

@ -12,6 +12,10 @@
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
B60EBD1211E8DEEF00C1974F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B60EBD1111E8DEEF00C1974F /* QuartzCore.framework */; };
B60EBDE311E90FC300C1974F /* ScanLineFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = B60EBDE211E90FC300C1974F /* ScanLineFilter.m */; };
B60EBDE811E9143F00C1974F /* ScanLineFilter.cikernel in Sources */ = {isa = PBXBuildFile; fileRef = B60EBDE711E9143F00C1974F /* ScanLineFilter.cikernel */; };
B60EBE2B11E918D500C1974F /* ScanLineFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = B60EBDE711E9143F00C1974F /* ScanLineFilter.cikernel */; };
B669798511E6A786002ED475 /* Lock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B669798411E6A786002ED475 /* Lock.cpp */; };
B66979D111E6BCAE002ED475 /* sl25.png in Resources */ = {isa = PBXBuildFile; fileRef = B66979CF11E6BCAE002ED475 /* sl25.png */; };
B66979FA11E6BEB5002ED475 /* sl75.png in Resources */ = {isa = PBXBuildFile; fileRef = B66979F811E6BEB5002ED475 /* sl75.png */; };
@ -28,6 +32,17 @@
B6F444C811E41AC000C3A836 /* VT05.mm in Sources */ = {isa = PBXBuildFile; fileRef = B6F444C711E41AC000C3A836 /* VT05.mm */; };
/* End PBXBuildFile section */
/* Begin PBXBuildRule section */
B60EBE2311E9182E00C1974F /* PBXBuildRule */ = {
isa = PBXBuildRule;
compilerSpec = "com.apple.build-tasks.copy-strings-file";
fileType = sourcecode.glsl;
isEditable = 1;
outputFiles = (
);
};
/* End PBXBuildRule section */
/* Begin PBXFileReference section */
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
@ -41,6 +56,10 @@
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
8D1107310486CEB800E47090 /* TwoTerm-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "TwoTerm-Info.plist"; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* 2Term.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = 2Term.app; sourceTree = BUILT_PRODUCTS_DIR; };
B60EBD1111E8DEEF00C1974F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
B60EBDE111E90FC300C1974F /* ScanLineFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScanLineFilter.h; sourceTree = "<group>"; };
B60EBDE211E90FC300C1974F /* ScanLineFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScanLineFilter.m; sourceTree = "<group>"; };
B60EBDE711E9143F00C1974F /* ScanLineFilter.cikernel */ = {isa = PBXFileReference; explicitFileType = sourcecode.glsl; fileEncoding = 4; path = ScanLineFilter.cikernel; sourceTree = "<group>"; };
B669798311E6A786002ED475 /* Lock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Lock.h; sourceTree = "<group>"; };
B669798411E6A786002ED475 /* Lock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Lock.cpp; sourceTree = "<group>"; };
B66979CF11E6BCAE002ED475 /* sl25.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sl25.png; sourceTree = "<group>"; };
@ -75,6 +94,7 @@
buildActionMask = 2147483647;
files = (
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
B60EBD1211E8DEEF00C1974F /* QuartzCore.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -95,6 +115,8 @@
B699A03211E528DE00F54CC8 /* iGeometry.h */,
B6697A0D11E6BF95002ED475 /* CurveView.h */,
B6697A0E11E6BF95002ED475 /* CurveView.m */,
B60EBDE111E90FC300C1974F /* ScanLineFilter.h */,
B60EBDE211E90FC300C1974F /* ScanLineFilter.m */,
);
name = Classes;
sourceTree = "<group>";
@ -102,6 +124,7 @@
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
B60EBD1111E8DEEF00C1974F /* QuartzCore.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";
@ -151,6 +174,7 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
B60EBDE711E9143F00C1974F /* ScanLineFilter.cikernel */,
B66979CE11E6BCAE002ED475 /* images */,
8D1107310486CEB800E47090 /* TwoTerm-Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
@ -218,6 +242,7 @@
8D11072E0486CEB800E47090 /* Frameworks */,
);
buildRules = (
B60EBE2311E9182E00C1974F /* PBXBuildRule */,
);
dependencies = (
);
@ -249,6 +274,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B60EBE2B11E918D500C1974F /* ScanLineFilter.cikernel in Resources */,
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */,
B676065111DEBAE900D6B66C /* TermWindow.xib in Resources */,
@ -277,6 +303,8 @@
B669798511E6A786002ED475 /* Lock.cpp in Sources */,
B6697A0F11E6BF95002ED475 /* CurveView.m in Sources */,
B6697A3D11E7CCA0002ED475 /* PTSE.mm in Sources */,
B60EBDE311E90FC300C1974F /* ScanLineFilter.m in Sources */,
B60EBDE811E9143F00C1974F /* ScanLineFilter.cikernel in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -6,6 +6,8 @@
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#include <QuartzCore/QuartzCore.h>
#import "EmulatorView.h"
#import "CharacterGenerator.h"
@ -14,6 +16,8 @@
#include "OutputChannel.h"
#import "ScanLineFilter.h"
@implementation EmulatorView
@synthesize fd = _fd;
@ -22,6 +26,8 @@
-(void)awakeFromNib
{
NSImage *image;
CIFilter *filter;
NSMutableArray *filters;
_charWidth = 7;
_charHeight = 16;
@ -35,6 +41,30 @@
_backgroundColor = [[NSColor blackColor] retain];
_boldColor = [[NSColor redColor] retain];
[self setWantsLayer: YES];
filters = [NSMutableArray arrayWithCapacity: 3];
//add the scanlines (which are vertical and must therfore be rotated
filter = [[ScanLineFilter new] autorelease];
[filter setValue: [NSNumber numberWithFloat: 0.75] forKey: @"inputOpacity"];
[filters addObject: filter];
//blur it a bit...
filter = [CIFilter filterWithName: @"CIGaussianBlur"];
[filter setDefaults];
[filter setValue: [NSNumber numberWithFloat: 0.33] forKey: @"inputRadius"];
[filters addObject: filter];
[self setContentFilters: filters];
_charGen = [[CharacterGenerator generator] retain];
_emulator = [VT52 new];
@ -168,8 +198,8 @@
_screen.unlock();
[_scanLine setFill];
NSRectFillUsingOperation(screenRect, NSCompositeSourceOver);
//[_scanLine setFill];
//NSRectFillUsingOperation(screenRect, NSCompositeSourceOver);
//NSRectFill(screenRect);

19
ScanLineFilter.cikernel Normal file
View File

@ -0,0 +1,19 @@
/*
* simulate scanlines by darkening every other line.
*
*/
kernel vec4 scanline(sampler image, float opacity)
{
vec2 coord = samplerCoord(image);
vec4 pixel = sample(image, coord);
float isOdd = mod(floor(coord.y), 2.0);
// isOdd == 0 --> return pixel
// isOdd == 1 --> return pixel * opacity
float multiplier = compare(isOdd - 1.0, 1.0, opacity);
return pixel * multiplier;
}

18
ScanLineFilter.h Normal file
View File

@ -0,0 +1,18 @@
//
// ScanLineFilter.h
// 2Term
//
// Created by Kelvin Sherlock on 7/10/2010.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <QuartzCore/CoreImage.h>
@interface ScanLineFilter : CIFilter {
NSNumber *inputOpacity;
CIImage *inputImage;
}
@end

76
ScanLineFilter.m Normal file
View File

@ -0,0 +1,76 @@
//
// ScanLineFilter.m
// 2Term
//
// Created by Kelvin Sherlock on 7/10/2010.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import "ScanLineFilter.h"
#import <ApplicationServices/ApplicationServices.h>
@implementation ScanLineFilter
static CIKernel *_kernel = nil;
+(void)initialize
{
if (!_kernel)
{
NSError *err;
NSBundle *bundle = [NSBundle mainBundle];
NSString *path = [bundle pathForResource: @"ScanLineFilter" ofType: @"cikernel"];
NSString *code = [NSString stringWithContentsOfFile: path
encoding: NSUTF8StringEncoding
error: &err];
NSArray *array = [CIKernel kernelsWithString: code];
_kernel = [[array objectAtIndex: 0] retain];
}
}
- (NSDictionary *)customAttributes
{
return [NSDictionary dictionaryWithObjectsAndKeys:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithDouble: 0.00], kCIAttributeMin,
[NSNumber numberWithDouble: 0.00], kCIAttributeMax,
[NSNumber numberWithDouble: 0.00], kCIAttributeSliderMin,
[NSNumber numberWithDouble: 1.00], kCIAttributeSliderMax,
[NSNumber numberWithDouble: 0.50], kCIAttributeDefault,
[NSNumber numberWithDouble: 0.00], kCIAttributeIdentity,
kCIAttributeTypeDistance, kCIAttributeType,
nil], @"inputOpacity",
nil];
}
// called when setting up for fragment program and also calls fragment program
- (CIImage *)outputImage
{
float opacity;
CISampler *src;
src = [CISampler samplerWithImage:inputImage];
opacity = [inputOpacity floatValue];
if (opacity < 0) opacity = 0;
if (opacity > 1.0) opacity = 1.0;
return [self apply: _kernel, src, [NSNumber numberWithFloat: opacity], nil];
}
@end