Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More renaming and organizational changes

  • Loading branch information...
commit e773684ea34af9dca9d878f68f4ada6b4f61b541 1 parent 06d50bd
@ccgus authored
View
4 plugins/imagetools/samples/colorwheel.jstalk → example_scripts/CIImage Color Wheel.jstalk
@@ -1,4 +1,4 @@
-var filter = [JSTQuickCIFilter quickFilterWithKernel:"""
+var filter = [COSQuickCIFilter quickFilterWithKernel:"""
bool isOdd(int v) {
float dividend = float(v) / 2.0;
return dividend != floor(dividend);
@@ -48,5 +48,5 @@ kernel vec4 colorWheel(float radius) {
[filter addKernelArgument:[NSNumber numberWithInt:100]];
-[JSTImageTools viewCIImage:[filter outputImage] inWindowNamed:"test" extent:CGRectMake(0, 0, 200, 200)];
+[COSImageTools viewCIImage:[filter outputImage] inWindowNamed:"Color Wheel" extent:CGRectMake(0, 0, 200, 200)];
View
8 ...ins/imagetools/samples/ciimagemask.jstalk → example_scripts/CIImage Masking.jstalk
@@ -1,11 +1,11 @@
-var img = [CIImage jstImageNamed:"duck"];
-var img2 = [CIImage jstImageNamed:"llama"];
-var mask = [CIImage jstImageNamed:"mask4"];
+var img = [CIImage cosImageNamed:"duck"];
+var img2 = [CIImage cosImageNamed:"llama"];
+var mask = [CIImage cosImageNamed:"mask4"];
var blendFilter = [CIFilter filterWithName:"CIBlendWithMask"];
[blendFilter setValue:img forKey:"inputImage"];
[blendFilter setValue:img2 forKey:"inputBackgroundImage"];
[blendFilter setValue:mask forKey:@"inputMaskImage"];
-[JSTImageTools viewCIImage:[blendFilter outputImage] inWindowNamed:"mask" extent:CGRectMake(0, 0, 400, 400)];
+[COSImageTools viewCIImage:[blendFilter outputImage] inWindowNamed:"mask" extent:CGRectMake(0, 0, 400, 400)];
View
2  ...ns/imagetools/samples/codesketcher.jstalk → example_scripts/Code Sketch - Newtime.jstalk
@@ -1,4 +1,4 @@
-var sketcher = [JSTCodeSketcher codeSketcherWithName:"Code Sketcher - New Time"];
+var sketcher = [COSCodeSketcher codeSketcherWithName:"Code Sketcher - New Time"];
[sketcher setFrameRate:60];
var drawFunction = function() {
View
6 plugins/imagetools/samples/ciimage.jstalk → example_scripts/Custom CIKernel.coscript
@@ -1,5 +1,5 @@
-var filter = [JSTQuickCIFilter quickFilterWithKernel:"""
-kernel vec4 foo(vec4 colorA, vec4 colorB) {
+var filter = [COSQuickCIFilter quickFilterWithKernel:"""
+kernel vec4 mykernel(vec4 colorA, vec4 colorB) {
vec2 dest = destCoord();
vec4 ret = dest.x < 100.0 ? colorA : colorB;
return premultiply(ret);
@@ -10,5 +10,5 @@ kernel vec4 foo(vec4 colorA, vec4 colorB) {
var img = [filter outputImage];
-[JSTImageTools viewCIImage:img inWindowNamed:"test" extent:CGRectMake(0, 0, 400, 200)];
+[COSImageTools viewCIImage:img inWindowNamed:"test" extent:CGRectMake(0, 0, 400, 200)];
View
2  plugins/imagetools/samples/nsimage.jstalk → example_scripts/NSImage Draw Buttons.jstalk
@@ -75,5 +75,5 @@ drawInImage(both, function() {
});
-[JSTImageTools viewNSImage:both inWindowNamed:"buttons"];
+[COSImageTools viewNSImage:both inWindowNamed:"buttons"];
View
11 ...magetools/samples/openclDesaturate.jstalk → example_scripts/OpenCL Desaturate.jstalk
@@ -1,6 +1,6 @@
var src = """
-__kernel void clDesaturate(image2d_t src, image2d_t dst, int width, int height) {
+__kernel void clDesaturate(read_write image2d_t src, read_write image2d_t dst, int width, int height) {
int2 coord = (int2)(get_global_id(0), get_global_id(1));
@@ -16,13 +16,14 @@ __kernel void clDesaturate(image2d_t src, image2d_t dst, int width, int height)
}
""";
-var context = [JSTOpenCLContext new];
+var context = [COSOpenCLContext new];
var program = [context programWithSource:src];
[program build];
+var imagePath = [COSImageTools pathOfImageNamed:"llama"];
var kernel = [program createKernel:"clDesaturate"];
-var inBuffer = [JSTOpenCLImageBuffer instanceWithContext:context usingImageAtPath:@"/Volumes/srv/Users/gus/Desktop/uhcorn.png"];
-var outBuffer = [JSTOpenCLImageBuffer instanceWithContext:context width:[inBuffer width] height:[inBuffer height]];
+var inBuffer = [COSOpenCLImageBuffer instanceWithContext:context usingImageAtPath:imagePath];
+var outBuffer = [COSOpenCLImageBuffer instanceWithContext:context width:[inBuffer width] height:[inBuffer height]];
[kernel setArgument:0 buffer:inBuffer];
[kernel setArgument:1 buffer:outBuffer];
@@ -32,4 +33,4 @@ var outBuffer = [JSTOpenCLImageBuffer instanceWithContext:context width:[inBuffe
[kernel enqueueCallWithGlobalSizeX:[inBuffer width] Y:[inBuffer height]];
[context finish];
-[JSTImageTools viewImageBuffer:outBuffer inWindowNamed:"OpenCL"];
+[COSImageTools viewImageBuffer:outBuffer inWindowNamed:"OpenCL"];
View
8 plugins/imagetools/samples/opencl.jstalk → example_scripts/OpenCL Simple Kernel.jstalk
@@ -1,5 +1,5 @@
var src = """
-__kernel void test2(image2d_t img) {
+__kernel void test2(write_only image2d_t img) {
int2 coord = (int2)(get_global_id(0), get_global_id(1));
float4 val = (float4)(1, 0, 0, 1);
@@ -13,17 +13,17 @@ __kernel void test2(image2d_t img) {
var w = 400;
var h = 400;
-var context = [JSTOpenCLContext new];
+var context = [COSOpenCLContext new];
var program = [context programWithSource:src];
[program build];
var kernel = [program createKernel:"test2"];
-var buffer = [JSTOpenCLImageBuffer instanceWithContext:context width:w height:h];
+var buffer = [COSOpenCLImageBuffer instanceWithContext:context width:w height:h];
[kernel setArgument:0 buffer:buffer];
[kernel enqueueCallWithGlobalSizeX:w Y:h];
[context finish];
-[JSTImageTools viewImageBuffer:buffer inWindowNamed:"foo"];
+[COSImageTools viewImageBuffer:buffer inWindowNamed:"foo"];
View
2  plugins/imagetools/COSCIImageAdditions.h
@@ -11,6 +11,6 @@
@interface CIImage (COSCIImageAdditions)
-+ (id)jstImageNamed:(NSString*)imageName;
++ (id)cosImageNamed:(NSString*)imageName;
@end
View
5 plugins/imagetools/COSCIImageAdditions.m
@@ -12,10 +12,13 @@
@implementation CIImage (COSCIImageAdditions)
+ (id)jstImageNamed:(NSString*)imageName {
+ return [self cosImageNamed:imageName];
+}
+
++ (id)cosImageNamed:(NSString*)imageName {
NSURL *url = [[NSBundle bundleForClass:[COSImageTools class]] URLForImageResource:imageName];
-
if (!url) {
url = [[NSBundle mainBundle] URLForImageResource:imageName];
}
View
16 plugins/imagetools/COSImageTools.m
@@ -21,7 +21,7 @@ + (id)imageWithSize:(NSSize)s {
@implementation COSImageTools
-+ (CGImageRef)createImageRefFromBuffer:(JSTOpenCLImageBuffer*)imgBuffer {
++ (CGImageRef)createImageRefFromBuffer:(COSOpenCLImageBuffer*)imgBuffer {
CGColorSpaceRef cs = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
@@ -40,7 +40,7 @@ + (CGImageRef)createImageRefFromBuffer:(JSTOpenCLImageBuffer*)imgBuffer {
}
-+ (NSData*)tiffDataFromImageBuffer:(JSTOpenCLImageBuffer*)imgBuffer {
++ (NSData*)tiffDataFromImageBuffer:(COSOpenCLImageBuffer*)imgBuffer {
CGImageRef img = [self createImageRefFromBuffer:imgBuffer];
@@ -105,7 +105,7 @@ + (NSWindow*)getImageViewWindowNamed:(NSString*)winName defaultSize:(NSSize)s {
return w;
}
-+ (void)viewImageBuffer:(JSTOpenCLImageBuffer*)imgBuffer inWindowNamed:(NSString*)winName {
++ (void)viewImageBuffer:(COSOpenCLImageBuffer*)imgBuffer inWindowNamed:(NSString*)winName {
CGImageRef img = [self createImageRefFromBuffer:imgBuffer];
@@ -130,7 +130,7 @@ + (void)viewNSImage:(NSImage*)img inWindowNamed:(NSString*)winName {
}
-+ (void)dumpPixelsInBuffer:(JSTOpenCLImageBuffer*)imgBuffer {
++ (void)dumpPixelsInBuffer:(COSOpenCLImageBuffer*)imgBuffer {
size_t bpr = [imgBuffer bytesPerRow];
size_t x = 0, y = 0;
@@ -225,6 +225,12 @@ + (void)setShouldUseCISofwareRenderer:(BOOL)b {
JSTImageToolsCISWRender = b;
}
+
++ (NSString*)pathOfImageNamed:(NSString*)imageName {
+ return [[NSBundle bundleForClass:[self class]] pathForImageResource:imageName];
+}
+
+
@end
@implementation JSTSimpleCIView
@@ -261,4 +267,6 @@ - (void)drawRect:(NSRect)r {
}
+
+
@end
View
2  plugins/imagetools/COSOpenCLProgram.h
@@ -73,7 +73,7 @@ typedef struct _JSTOCLFloatPixel {
-@interface JSTOpenCLImageBuffer : JSTOpenCLBuffer {
+@interface COSOpenCLImageBuffer : JSTOpenCLBuffer {
size_t _width;
size_t _height;
View
2  plugins/imagetools/COSOpenCLProgram.m
@@ -165,7 +165,7 @@ - (void)dealloc {
@end
-@implementation JSTOpenCLImageBuffer
+@implementation COSOpenCLImageBuffer
@synthesize width=_width;
View
30 plugins/imagetools/samples/codesketcher-draw.jstalk
@@ -1,30 +0,0 @@
-var sketcher = [JSTCodeSketcher codeSketcherWithName:"Draw"];
-
-[sketcher setSetup:function() {
- print("setup!")
- [sketcher setSize:NSMakeSize(600, 300)];
- [sketcher clear];
-}];
-
-[sketcher setMouseDown:function() {
- // reset our points
- m1 = m2 = m3 = m4 = null;
-}];
-
-[sketcher setMouseDragged:function() {
- var m0 = [sketcher mouseLocation];
-
- if (m4) {
- [[NSColor colorWithCalibratedWhite:0 alpha:.1] set];
-
- [NSBezierPath strokeLineFromPoint:m0 toPoint:m4]
- [NSBezierPath strokeLineFromPoint:m1 toPoint:m4]
- [NSBezierPath strokeLineFromPoint:m2 toPoint:m4]
- [NSBezierPath strokeLineFromPoint:m3 toPoint:m4]
- }
-
- m4 = m3;
- m3 = m2;
- m2 = m1;
- m1 = m0;
-}];
Please sign in to comment.
Something went wrong with that request. Please try again.