Permalink
Browse files

Updates and renames

  • Loading branch information...
ccgus committed Oct 24, 2013
1 parent ccf863a commit 28f7056eb941057a6fc5e4dc965d1e6835088933
@@ -1,26 +0,0 @@
-// Note, this requires the Acorn JSEnabler plugin to be installed.
-// http://code.google.com/p/flycode/source/browse/trunk/jstalk/extras/acornplugin/
-
-// application: gets an object from Acorn over DO
-var acorn = JSTalk.application_("Acorn");
-var outPath = "/tmp/jimi.png";
-var firstDoc = acorn.orderedDocuments().objectAtIndex_(0);
-
-for (i = 0; i < 10; i++) {
- firstDoc.windowController().callFilterWithName_("CIGaussianBlur");
- NSThread.sleepForTimeInterval_(0.2);
-}
-
-firstDoc.dataRepresentationOfType_("public.png").writeToFile_(outPath);
-
-firstDoc.undoManager().undo();
-
-var qt = SBApplication.application_("QuickTime Player");
-
-print(qt);
-
-qt.open_(NSURL.fileURLWithPath_(outPath));
-qt.activate();
-
-print("Hurray!");
-
@@ -1,9 +0,0 @@
-var imageURL = NSURL.URLWithString_("http://flyingmeat.com/images/fmlogo.pdf");
-
-var image = NSImage.alloc().initWithContentsOfURL_(imageURL).autorelease();
-
-var acorn = JSTalk.application_("Acorn");
-
-acorn.sharedDocumentController().newDocumentWithImageData_(image.TIFFRepresentation());
-
-
@@ -1,71 +0,0 @@
-
-var acorn = [JSTalk application:"Acorn"];
-var doc = [[acorn orderedDocuments] objectAtIndex:0];
-var image = [[[NSImage alloc] initWithData:[doc dataRepresentationOfType:"public.png"]] autorelease];
-var bitmap = [image bestRepresentationForDevice:nil];
-
-var extent = NSMakeRect(0, 0, [bitmap pixelsWide], [bitmap pixelsHigh]);
-var xOffset = 5;
-var yOffset = 35;
-var curveHeight = 15;
-var imageYOffset = 10;
-var whiteBorderWidth = 4;
-var doubleBorderWidth = whiteBorderWidth * 2;
-
-var newSize = NSMakeSize(extent.size.width + (whiteBorderWidth * 2),
- extent.size.height + imageYOffset + (whiteBorderWidth * 2));
-
-var newImage = [[[NSImage alloc] initWithSize:newSize] autorelease];
-
-[newImage lockFocus];
-
-[[NSGraphicsContext currentContext] saveGraphicsState];
-
-var shadow = [[NSShadow alloc] init];
-[shadow setShadowColor:[[NSColor blackColor] colorWithAlphaComponent:.6]];
-
-var shadowOffset = NSMakeSize(0, -(yOffset + 5));
-[shadow setShadowOffset:shadowOffset];
-[shadow setShadowBlurRadius:5];
-shadow.set()
-
-// make a curved path, at the bottom of our image.
-bezierPath = NSBezierPath.bezierPath();
-
-[bezierPath moveToPoint:NSMakePoint(xOffset, 40 + yOffset)];
-[bezierPath lineToPoint:NSMakePoint(extent.size.width - (xOffset) + doubleBorderWidth, 40 + yOffset)];
-[bezierPath lineToPoint:NSMakePoint(extent.size.width - (xOffset) + doubleBorderWidth, 10 + yOffset)];
-
-[bezierPath curveToPoint:NSMakePoint(newSize.width / 2, curveHeight + yOffset)
- controlPoint1:NSMakePoint(extent.size.width - (xOffset), 10 + yOffset)
- controlPoint2:NSMakePoint(newSize.width *.75, curveHeight + yOffset)];
-
-[bezierPath curveToPoint:NSMakePoint(xOffset, 10 + yOffset)
- controlPoint1:NSMakePoint(newSize.width *.25, curveHeight + yOffset)
- controlPoint2:NSMakePoint(xOffset, 10 + yOffset)];
-
-[bezierPath fill];
-
-// get rid of our shadow
-[[NSGraphicsContext currentContext] restoreGraphicsState];
-
-// draw a white border
-[[NSColor whiteColor] set];
-[[NSBezierPath bezierPathWithRect:NSMakeRect(0, imageYOffset, newSize.width, extent.size.height + whiteBorderWidth * 2)] fill];
-
-// draw our gray border around the white border
-[[NSColor lightGrayColor] set];
-[[NSBezierPath bezierPathWithRect:NSMakeRect(.5, imageYOffset + .5 , newSize.width - 1, (extent.size.height - 1) + (whiteBorderWidth * 2))] stroke];
-
-// NSImage takes into account dpi of the image. So we force it's size, to avoid small images.
-[image setSize: extent.size];
-
-// draw our image
-[image drawAtPoint:NSMakePoint(whiteBorderWidth, imageYOffset + whiteBorderWidth)
- fromRect:NSMakeRect(0, 0, extent.size.width, extent.size.height)
- operation:NSCompositeCopy
- fraction:1];
-
-[newImage unlockFocus];
-
-[[acorn sharedDocumentController] newDocumentWithImageData:[newImage TIFFRepresentation]];
@@ -1,6 +0,0 @@
-var jst = JSTalk.application_("JSTalk Editor");
-
-if (jst.displayDialog_withTitle_("Hello", "What?") == NSOKButton) {
- print("woo");
-}
-
@@ -1,8 +1,8 @@
/*
-This a sample on how to use the JSTCodeSketcher class, which add experimental processing.org like functionality to JSTalk.
+This a sample on how to use the COSCodeSketcher class, which add experimental processing.org like functionality to Cocoa Script.
*/
-var sketcher = [JSTCodeSketcher codeSketcherWithName:"Bezier"];
+var sketcher = [COSCodeSketcher codeSketcherWithName:"Bezier"];
[sketcher setFlipped:false];
function makePointObject(x, y) {
@@ -89,7 +89,6 @@ sketcher.mouseDragged = function(event) {
movingPoint.y = loc.y;
}
else {
- print([event deltaX])
points.forEach(function(p) {
p.x += [event deltaX];
p.y -= [event deltaY];
@@ -1,8 +1,8 @@
/*
-This a sample on how to use the JSTCodeSketcher class, which add experimental processing.org like functionality to JSTalk.
+This a sample on how to use the COSCodeSketcher class, which add experimental processing.org like functionality to Cocoa Script.
*/
-var sketcher = [JSTCodeSketcher codeSketcherWithName:"Draw"];
+var sketcher = [COSCodeSketcher codeSketcherWithName:"Draw"];
sketcher.setup = function() {
[sketcher setSize:NSMakeSize(600, 300)];
@@ -1,8 +1,8 @@
/*
-This a sample on how to use the JSTCodeSketcher class, which add experimental processing.org like functionality to JSTalk.
+This a sample on how to use the COSCodeSketcher class, which add experimental processing.org like functionality to Cocoa Script.
*/
-var sketcher = [JSTCodeSketcher codeSketcherWithName:"Draw"];
+var sketcher = [COSCodeSketcher codeSketcherWithName:"Draw"];
sketcher.setup = function() {
[sketcher setSize:NSMakeSize(600, 300)];
@@ -0,0 +1,13 @@
+var pi = [NSProcessInfo processInfo];
+var argCount = [[pi arguments] count];
+
+print("There are " + argCount + " args");
+
+var idx = 0;
+while (idx < argCount) {
+
+ print("argument " + idx + ": " + [pi arguments][idx]);
+
+ idx++;
+}
+
@@ -1,13 +0,0 @@
-var pi = NSProcessInfo.processInfo();
-var argCount = pi.arguments().count();
-
-print("There are " + argCount + " args");
-
-var idx = 0;
-while (idx < argCount) {
-
- print("argument " + idx + ": " + pi.arguments()[idx]);
-
- idx++;
-}
-
@@ -1,33 +0,0 @@
-var url = [NSURL URLWithString:"http://api.flickr.com/services/feeds/photos_public.gne?id=87865690@N00&lang=en-us&format=rss_200"];
-var xmlDoc = [[[NSXMLDocument alloc] initWithContentsOfURL:url options:null error:null] autorelease];
-var root = [xmlDoc rootElement];
-var tmpDir = NSTemporaryDirectory() + "ccgus/";
-
-[[NSFileManager defaultManager] createDirectoryAtPath:tmpDir attributes:nil];
-
-var ar = [root nodesForXPath:"channel/item/description/." error:null];
-
-for (i=0; i < [ar count]; i++) {
-
- var s = ar[i] + ""; // coerce this into a js string
-
- urlstart = s.search('src="http') + 5;
-
- s = s.substr(urlstart);
-
- urlend = s.search('"');
-
- s = s.substr(0, urlend);
-
- var imgURL = [NSURL URLWithString:s];
- var fileName = [[imgURL path] lastPathComponent];
-
- var imageData = [NSData dataWithContentsOfURL: imgURL];
-
- if (imageData) {
- // writeToFile is defined in JSTExtras
- [imageData writeToFile: tmpDir + fileName];
- }
-}
-
-[[NSWorkspace sharedWorkspace] openFile: tmpDir];
@@ -3,10 +3,9 @@ var s = "break case catch continue default delete do else finally for function i
words = s.split(" ");
var i = 0;
list = "";
-while (i < words.length) {
- list = list + '@"' + words[i] + '", ';
- i++
-}
+words.forEach(function(element, index, array) {
+ list = list + '@"' + element + '", ';
+});
print("NSArray *blueWords = [NSArray arrayWithObjects:" + list + " nil];");
@@ -0,0 +1,2 @@
+
+[[SBApplication application:"Messages"] setStatusMessage:"Happy (funball)"];
@@ -0,0 +1,9 @@
+var imageURL = [NSURL URLWithString:"http://flyingmeat.com/images/fmlogo.pdf"];
+
+var image = [[NSImage alloc] initWithContentsOfURL:imageURL];
+
+var acorn = [COScript application:"Acorn"];
+
+[[acorn sharedDocumentController] newDocumentWithImageData:[image TIFFRepresentation]];
+
+
@@ -1,2 +0,0 @@
-
-SBApplication.application_("iChat").setStatusMessage_("Happy (funball)");
@@ -168,14 +168,12 @@
CC8642ED163B287800908427 /* COSCodeSketcher.m in Sources */ = {isa = PBXBuildFile; fileRef = CC8642C7163B287800908427 /* COSCodeSketcher.m */; };
CC8642EE163B287800908427 /* COSImageTools.h in Headers */ = {isa = PBXBuildFile; fileRef = CC8642C8163B287800908427 /* COSImageTools.h */; };
CC8642EF163B287800908427 /* COSImageTools.m in Sources */ = {isa = PBXBuildFile; fileRef = CC8642C9163B287800908427 /* COSImageTools.m */; };
- CC8642F0163B287800908427 /* JSTOpenCL_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = CC8642CA163B287800908427 /* JSTOpenCL_Prefix.pch */; };
CC8642F1163B287800908427 /* COSOpenCLContext.h in Headers */ = {isa = PBXBuildFile; fileRef = CC8642CB163B287800908427 /* COSOpenCLContext.h */; };
CC8642F2163B287800908427 /* COSOpenCLContext.m in Sources */ = {isa = PBXBuildFile; fileRef = CC8642CC163B287800908427 /* COSOpenCLContext.m */; };
CC8642F3163B287800908427 /* COSOpenCLProgram.h in Headers */ = {isa = PBXBuildFile; fileRef = CC8642CD163B287800908427 /* COSOpenCLProgram.h */; };
CC8642F4163B287800908427 /* COSOpenCLProgram.m in Sources */ = {isa = PBXBuildFile; fileRef = CC8642CE163B287800908427 /* COSOpenCLProgram.m */; };
CC8642F5163B287800908427 /* COSQuickCIFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = CC8642CF163B287800908427 /* COSQuickCIFilter.h */; };
CC8642F6163B287800908427 /* COSQuickCIFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = CC8642D0163B287800908427 /* COSQuickCIFilter.m */; };
- CC8642F7163B287800908427 /* OpenCL.bridgesupport in Resources */ = {isa = PBXBuildFile; fileRef = CC8642D1163B287800908427 /* OpenCL.bridgesupport */; };
CC8642F8163B287800908427 /* ccgus.jpg in Resources */ = {isa = PBXBuildFile; fileRef = CC8642D3163B287800908427 /* ccgus.jpg */; };
CC8642F9163B287800908427 /* clouds.jpg in Resources */ = {isa = PBXBuildFile; fileRef = CC8642D4163B287800908427 /* clouds.jpg */; };
CC8642FA163B287800908427 /* duck.jpg in Resources */ = {isa = PBXBuildFile; fileRef = CC8642D5163B287800908427 /* duck.jpg */; };
@@ -424,14 +422,12 @@
CC8642C7163B287800908427 /* COSCodeSketcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = COSCodeSketcher.m; sourceTree = "<group>"; };
CC8642C8163B287800908427 /* COSImageTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = COSImageTools.h; sourceTree = "<group>"; };
CC8642C9163B287800908427 /* COSImageTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = COSImageTools.m; sourceTree = "<group>"; };
- CC8642CA163B287800908427 /* JSTOpenCL_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTOpenCL_Prefix.pch; sourceTree = "<group>"; };
CC8642CB163B287800908427 /* COSOpenCLContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = COSOpenCLContext.h; sourceTree = "<group>"; };
CC8642CC163B287800908427 /* COSOpenCLContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = COSOpenCLContext.m; sourceTree = "<group>"; };
CC8642CD163B287800908427 /* COSOpenCLProgram.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = COSOpenCLProgram.h; sourceTree = "<group>"; };
CC8642CE163B287800908427 /* COSOpenCLProgram.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = COSOpenCLProgram.m; sourceTree = "<group>"; };
CC8642CF163B287800908427 /* COSQuickCIFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = COSQuickCIFilter.h; sourceTree = "<group>"; };
CC8642D0163B287800908427 /* COSQuickCIFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = COSQuickCIFilter.m; sourceTree = "<group>"; };
- CC8642D1163B287800908427 /* OpenCL.bridgesupport */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = OpenCL.bridgesupport; sourceTree = "<group>"; };
CC8642D3163B287800908427 /* ccgus.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = ccgus.jpg; sourceTree = "<group>"; };
CC8642D4163B287800908427 /* clouds.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = clouds.jpg; sourceTree = "<group>"; };
CC8642D5163B287800908427 /* duck.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = duck.jpg; sourceTree = "<group>"; };
@@ -833,14 +829,12 @@
CC8642C7163B287800908427 /* COSCodeSketcher.m */,
CC8642C8163B287800908427 /* COSImageTools.h */,
CC8642C9163B287800908427 /* COSImageTools.m */,
- CC8642CA163B287800908427 /* JSTOpenCL_Prefix.pch */,
CC8642CB163B287800908427 /* COSOpenCLContext.h */,
CC8642CC163B287800908427 /* COSOpenCLContext.m */,
CC8642CD163B287800908427 /* COSOpenCLProgram.h */,
CC8642CE163B287800908427 /* COSOpenCLProgram.m */,
CC8642CF163B287800908427 /* COSQuickCIFilter.h */,
CC8642D0163B287800908427 /* COSQuickCIFilter.m */,
- CC8642D1163B287800908427 /* OpenCL.bridgesupport */,
CC8642D2163B287800908427 /* res */,
);
name = imagetools;
@@ -1022,7 +1016,6 @@
CC8642EA163B287800908427 /* COSCIImageAdditions.h in Headers */,
CC8642EC163B287800908427 /* COSCodeSketcher.h in Headers */,
CC8642EE163B287800908427 /* COSImageTools.h in Headers */,
- CC8642F0163B287800908427 /* JSTOpenCL_Prefix.pch in Headers */,
CC8642F1163B287800908427 /* COSOpenCLContext.h in Headers */,
CC8642F3163B287800908427 /* COSOpenCLProgram.h in Headers */,
CC8642F5163B287800908427 /* COSQuickCIFilter.h in Headers */,
@@ -1137,7 +1130,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- CC8642F7163B287800908427 /* OpenCL.bridgesupport in Resources */,
CC8642F8163B287800908427 /* ccgus.jpg in Resources */,
CC8642F9163B287800908427 /* clouds.jpg in Resources */,
CC8642FA163B287800908427 /* duck.jpg in Resources */,
@@ -1,11 +0,0 @@
-#define NS_BUILD_32_LIKE_64 1
-
-#ifdef __OBJC__
- #import <Cocoa/Cocoa.h>
-#endif
-
-#ifdef DEBUG
- #define debug(...) NSLog(__VA_ARGS__)
-#else
- #define debug(...)
-#endif
Oops, something went wrong.

0 comments on commit 28f7056

Please sign in to comment.