Tuesday, February 25, 2014

Cocoa Script “Shaders”

Gus Mueller:

I also played around with Cocoa Script “shaders” for shape graphics in Acorn. This won’t ship in 4.4 (or maybe ever?), but it was fun to code up and might be something awesome some day. How it works is a little hard to explain, but I'll try. Basically, instead of a rectangle having just a stroke and a fill when it draws, it will call a snippet of Cocoa Script code in place of the normal drawing routines. That snippet of code then has access to a bunch of libraries, and can do whatever it wants in the context it is drawing into.

1 Comment

I did something similar in RealBASIC initially for a label design app I did for a paper company.

I then released it as open source https://code.google.com/p/rbstuff/wiki/ScriptPictureEffects

One of the (few?) cool things about RealBASIC is that it includes a subset of the language which is a bundled runtime interpreter - RBScript. It is like Lua in that the environment is very extensible so you can add functions and variables to the interpreter context. I published the graphics object and a picture processing plugin.

RealBASIC is now called Xojo. I assume they still have the scripting but haven't checked as I stopped using it - too many frameworks and languages in my head with all the Windows C++ plus Mac and iOS stuff.

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment