<?xml version='1.0' encoding='UTF-8'?>
   <feed xmlns='http://www.w3.org/2005/Atom'
         xml:lang='en-us'>
     <title>The Shape of Everything</title>
     <id>http://shapeof.com/</id>
     <link href='./' />
     <link rel='self' href='http://shapeof.com/atom.xml' />
     <link href="http://shapeof.com/" rel="alternate" title="The Shape of Everything" type="text/html" />
     <updated>2010-07-29T17:10:52-08:00</updated>
     <author>
       <name>Gus Mueller</name>
     </author><entry>
   <title>Making a Color Wheel in Core Image</title>
   <link href="http://shapeof.com/archives/2010/07/making_a_color_wheel_in_core_image.html" rel="alternate" title="Making a Color Wheel in Core Image" type="text/html" />
   <id>urn:uuid:e9003793-0679-4ded-8aa1-c4be944eeb88</id>
   <published>2010-07-29T13:37:13-08:00</published>
   <updated>2010-07-29T17:10:43-08:00</updated>
   <content type="html" xml:base="http://shapeof.com/" xml:lang="en"><![CDATA[
   For some reason recently, I wanted to see if I could write a Core Image filter to make a color wheel.  Ok, that's kind of a lie. I recently came across Apple's private CIColorWheelGenerator filter and <a href="http://twitter.com/ccgus/status/18791786428">I was really intrigued</a> at how they did it.  Here's what the output from it looks like:<br/>
<br/>
<center><img src="http://shapeof.com/2010/images/apple-colorwheel.png" /><br/><span style="font-size: .8em;">(Exhibit A, the output from Apple's private color wheel generator)</span></center>
<br/>
I didn't spend much time on it, but my friend George Codillo did, and here's what he came up with (along with some help from Andy Finnell's <a href="http://losingfight.com/blog/2007/01/25/image-filter-theatre-hsb-mixer/">HSB mixer CI Kernel</a>).<br/>
<br/>
<center><img src="http://shapeof.com/2010/images/kernelr-colorwheel.png" /><br/><span style="font-size: .8em;">(Exhibit B, the color wheel in Acorn's <a href="http://flyingmeat.com/acorn/docs-2.0/writing%20plugins.html">Kernelr sample code</a>, as coded up by George.)</span></center>
<br/>
And here's his code:<br/>
<pre class="code">bool isOdd(int v) {
    float dividend = float(v) / 2.0;
    return dividend != floor(dividend);
}

vec4 hsvToRgb(vec4 hsv) {
    float h = hsv.r;
    float s = hsv.g;
    float v = hsv.b;
    int i = int(floor(h));
    float f = isOdd(i) ? h - float(i) : 1.0 - (h - float(i));
    float m = v * (1.0 - s);
    float n = v * (1.0 - s * f);
    vec4 result = (i == 0) ? vec4(v, n, m, hsv.a) : ((i == 1) ?
        vec4(n, v, m, hsv.a) : ((i == 2) ? vec4(m, v, n, hsv.a) : ((i == 3) ?
        vec4(m, n, v, hsv.a) : ((i == 4) ? vec4(n, m, v, hsv.a) : ((i == 5) ?
        vec4(v, m, n, hsv.a) : vec4(v, n, m, hsv.a))))));
    
    return (h == -1.0) ? vec4(v, v, v, hsv.a) : result;
}

kernel vec4 colorWheel(sampler src, float radius) {
    
    vec2 center = vec2(radius, radius);
    vec2 v0 = destCoord();
    vec2 v1 = vec2(v0.x, radius);
    float a = distance(v0, v1);
    float b = distance(v1, center);
    
    float angle = atan(a,b);
    
    float pi = 3.14159265;
    angle = (v0.x&#62;radius)?((v0.y&#62;radius)?
        (atan(b,a)+pi/2.0):atan(a,b)+pi):
        (v0.y&#60;radius)?(atan(b,a)+(pi*1.5)):atan(a,b);
    
    vec4 theColor = vec4(1.0);
    
    theColor.r = (angle * 3.0) / pi;
    
    // make it a cirlce
    float dist = length(destCoord() - center);
    theColor.a = clamp(radius - dist, 0.0, 1.0);
    
    return premultiply(hsvToRgb(theColor));
}</pre>
<br/>
(You can also get away with coding this up in Quartz Composer, but I've found it to be a bit of a pain.  Rather, you should check out Kernelr which is an Acorn plugin for testing CI Kernels and is available as part of the <a href="http://flyingmeat.com/acorn/docs-2.0/writing%20plugins.html">Acorn SDK</a>.)<br/>
<br/>
Got another implementation to share?  Let me know and I'll link to it!<br/>
<br/>
Update: <a href="http://jens.ayton.se/blag/">Jens Ayton</a> points to a GLSL implementation: <a href="http://gist.github.com/499357">http://gist.github.com/499357</a>
<br/>
<br/>
<center>…</center>
<br/>
Math is neat.<br/>
<br/>
I'm on a Boat.
   ]]></content>
 </entry><entry>
   <title>Acorn 2.3.2b1</title>
   <link href="http://shapeof.com/archives/2010/07/acorn_2.3.2b1.html" rel="alternate" title="Acorn 2.3.2b1" type="text/html" />
   <id>urn:uuid:6145f337-9152-48c1-98b2-467ae83f7344</id>
   <published>2010-07-29T13:27:16-08:00</published>
   <updated>2010-07-29T13:30:05-08:00</updated>
   <content type="html" xml:base="http://shapeof.com/" xml:lang="en"><![CDATA[
   I've got a beta build of <a href="http://flyingmeat.com/acorn/">Acorn</a> (2.3.2b1) ready for folks who like to live on the edge.  You can grab it from the <a href=" 2.3.2b1">latest builds page</a>.<br/>
<br/>
This release has a ~12 bug fixes, and adds a couple of minor new features.  Read all about it on the <a href="http://flyingmeat.com/download/latest/acornshortnotes.html">release notes page</a>.
   ]]></content>
 </entry><entry>
   <title>DefCon Ninja Party Badge</title>
   <link href="http://shapeof.com/archives/2010/07/defcon_ninja_party_badge.html" rel="alternate" title="DefCon Ninja Party Badge" type="text/html" />
   <id>urn:uuid:d0256905-7b25-44ea-be87-52c208cb71b8</id>
   <published>2010-07-28T13:43:10-08:00</published>
   <updated>2010-07-28T13:44:07-08:00</updated>
   <content type="html" xml:base="http://shapeof.com/" xml:lang="en"><![CDATA[
   Wired: <a href="http://www.wired.com/threatlevel/2010/07/defcon-ninja-badge/">DefCon Ninja Party Badge</a>.<br/>
<br/>
<blockquote style="margin:0px;">LAS VEGAS — A hacker group known as the Ninjas has created what may be the best DefCon badge ever. The badge allows wireless ninja battle between badge holders.</blockquote>
<br/>
Super awesome.  I love the future.
   ]]></content>
 </entry><entry>
   <title>Automated Testing With JSTalk</title>
   <link href="http://shapeof.com/archives/2010/07/automated_testing_with_jstalk.html" rel="alternate" title="Automated Testing With JSTalk" type="text/html" />
   <id>urn:uuid:51084482-36fd-4e75-bc10-9bd5b9303e89</id>
   <published>2010-07-27T18:15:27-08:00</published>
   <updated>2010-07-27T18:59:20-08:00</updated>
   <content type="html" xml:base="http://shapeof.com/" xml:lang="en"><![CDATA[
   I've been writing more tests for <a href="http://flyingmeat.com/acorn/">Acorn</a> lately, and it's been kind of fun since I've been coding them up using my little Cocoa/JavaScript language, <a href="http://jstalk.org/">JSTalk</a>.<br/>
<br/>
Acorn has traditionally had all of its tests coded up in Objective-C, and run via part of the build process or by a special Debug menu that shows up in my dev builds.  (I don't use the built in testing framework that Xcode supplies, since it doesn't work very well with Acorn.  So I <a href="http://gusmueller.com/blog/archives/2009/10/how_to_write_your_own_automated_testing_framework.html">wrote my own</a>, which is actually pretty easy.)<br/>
<br/>
It's all well and good, but the problem I run into is that to fix a single test, I have to run through all the other tests just to get to my problematic one, which can be a bit annoying if I have a breakpoint set on a commonly used method.  So  to get around this problem I've been writing up single tests as a JSTalk script:<br/>
<pre class="code">// standard include stuff for the tests
[jstalk include:"acornsetup.jstalk"];

var testFileName = "floodfillend2.png";
var doc          = [acorn open:PXTestImageFolder + "/floodfillstart.png"];
var win          = [doc windowController];

[[acorn toolPalette] setFrontColor:[NSColor redColor]];

PXWithUndo(doc, function() {
    [[win canvas] placeBezierRectOnMask:NSMakeRect(0, 50, 30, 30)];
});

PXWithUndo(doc, function() {
    [[doc currentLayer] floodFillAtPoint:NSMakePoint(8, 62)];
});

PXCompare(doc, testFileName, 0, true);</pre>
<br/>
The first line includes some standard bits that the test scripts can use such as finding the PXTestImageFolder location, assigning the variable "acorn" to the app (var acorn = [JSTalk application:"Acorn"];), as well as some other things.  The function PXWithUndo is kind of interesting:<br/>
<pre class="code">function PXWithUndo(doc, f) {
    [[doc undoManager] setGroupsByEvent:false];
    [[doc undoManager] beginUndoGrouping];
    f();
    [[doc undoManager] endUndoGrouping];
    [[doc undoManager] setGroupsByEvent:true];
}</pre>
<br/>
The english version of the script goes something like this:<br/>
<br/>
- open up file "floodfillstart.png"<br/>
- put a selection on the canvas<br/>
- tell the current layer to perform a flood fill at a specific point<br/>
- call PXCompare with some arguments, testing it against an image it should look like at this point.<br/>
<br/>
The PXCompare function takes a document (which is the one we just worked with), a path to a file to compare it against, an int which is the tolerance to use when comparing the two images, and finally a bool which lets the function know wether or not to test our undo support.  If the compare test fails, Acorn opens up the images and an alert box letting us know "hey something broke".<br/>
<br/>
I've got a folder with a bunch of these tests, which all get run as part of Acorn's build script.  If a test fails, then the build script stops everything and you get to hear me curse loudly.<br/>
<br/>
So the moral of this story is automated testing is awesome and even if Xcode's testing framework doesn't suit you then you should probably investigate using something else.  And why not check out <a href="http://jstalk.org/">JSTalk</a> while you're at it?  It's super easy, I promise!
   ]]></content>
 </entry><entry>
   <title>Fancy, Your Pants Are: Star Wars Gentlemen</title>
   <link href="http://shapeof.com/archives/2010/07/fancy__your_pants_are:_star_wars_gentlemen.html" rel="alternate" title="Fancy, Your Pants Are: Star Wars Gentlemen" type="text/html" />
   <id>urn:uuid:b73ba6c3-faea-446b-a9c7-f581d7d4205b</id>
   <published>2010-07-10T11:38:00-08:00</published>
   <updated>2010-07-10T11:39:47-08:00</updated>
   <content type="html" xml:base="http://shapeof.com/" xml:lang="en"><![CDATA[
   Fancy, Your Pants Are: <a href="http://www.geekologie.com/2010/06/fancy_your_pants_are_star_wars.php">Star Wars Gentlemen</a>.<br/>
<br/>
No comment.<br/>
<br/>
Well OK just one: AWESOME.<br/>
<br/>
And there's more on <a href="http://gregpeltz.blogspot.com/">Greg Peltz's blog</a>.
   ]]></content>
 </entry><entry>
   <title>Super Mario Bros. Projection</title>
   <link href="http://shapeof.com/archives/2010/07/super_mario_bros._projection.html" rel="alternate" title="Super Mario Bros. Projection" type="text/html" />
   <id>urn:uuid:61c5ccda-5089-4d46-a228-62c472343e6b</id>
   <published>2010-07-07T13:33:16-08:00</published>
   <updated>2010-07-07T13:35:00-08:00</updated>
   <content type="html" xml:base="http://shapeof.com/" xml:lang="en"><![CDATA[
   This is pretty neat.  Someone projected (or overlaid somehow?  CG?) <a href="http://vimeo.com/13118504">a fast run through Super Mario Bros.</a> outside.<br/>
<br/>
(via <a href="http://twitter.com/flyosity/status/17978119618">Mike Rundle</a>)<br/>

   ]]></content>
 </entry><entry>
   <title>Terminal Tips and Tricks For Mac OS X</title>
   <link href="http://shapeof.com/archives/2010/07/terminal_tips_and_tricks_for_mac_os_x.html" rel="alternate" title="Terminal Tips and Tricks For Mac OS X" type="text/html" />
   <id>urn:uuid:dd511523-bc9e-444f-aa64-9a6dfd64ac09</id>
   <published>2010-07-06T10:03:41-08:00</published>
   <updated>2010-07-06T10:05:24-08:00</updated>
   <content type="html" xml:base="http://shapeof.com/" xml:lang="en"><![CDATA[
   Super User: <a href="http://superuser.com/questions/52483/terminal-tips-and-tricks-for-mac-os-x">Terminal Tips and Tricks For Mac OS X</a>.<br/>
<br/>
There's a bunch of great stuff in there, including interesting twists on things I already knew about.  Also- I had no idea you could open up text files (for man pages) in Preview.
   ]]></content>
 </entry><entry>
   <title>NoMoreiTunes Safari Extension</title>
   <link href="http://shapeof.com/archives/2010/06/nomoreitunes_safari_extension.html" rel="alternate" title="NoMoreiTunes Safari Extension" type="text/html" />
   <id>urn:uuid:0a001e1c-521b-4962-a6e5-01351a1965c7</id>
   <published>2010-06-15T08:52:36-08:00</published>
   <updated>2010-06-15T08:53:43-08:00</updated>
   <content type="html" xml:base="http://shapeof.com/" xml:lang="en"><![CDATA[
   <a href="http://einserver.de/nomoreitunes/">NoMoreiTunes Safari Extension</a>:<br/>
<br/>
<blockquote style="margin:0px;">"NoMoreiTunes is an extension for Safari 5 which disables the script that tries to start iTunes when you visit a link to the iTunes Store."</blockquote>
<br/>
I love this and would like to subscribe to your newsletter.
   ]]></content>
 </entry><entry>
   <title>VoodooPad for iPad Update</title>
   <link href="http://shapeof.com/archives/2010/06/voodoopad_for_ipad_update.html" rel="alternate" title="VoodooPad for iPad Update" type="text/html" />
   <id>urn:uuid:e78a9f37-53c5-4b6d-b99f-b9a84fb68801</id>
   <published>2010-06-14T16:09:15-08:00</published>
   <updated>2010-07-02T12:59:54-08:00</updated>
   <content type="html" xml:base="http://shapeof.com/" xml:lang="en"><![CDATA[
   I've had a flurry of questions about <a href="http://flyingmeat.com/voodoopad/">VoodooPad</a> for the iPad recently, so I thought I'd give a small update for folks.<br/>
<br/>
It's coming along nicely, and I was using it last week at WWDC to take notes and such.  But it still has a ways to go before it's ready for the store.  Luckily for folks who want VPiP, it's the only thing I'm working on right now- so hopefully it'll be sooner rather than later.<br/>
<br/>
As far as features go, I need to temper your over-enthusiastic expectations if you have any.  VoodooPad for the iPad is going to be simple.  It syncs, it links, it edits.  It does the basic stuff.  However, VPiP is going to be closer in features to VoodooPad 1.0 than it is to VoodooPad 4.3.  Since the iPad is so different than the desktop, I'm really having to start over in many ways.  The core of VP is there, but I expect it to grow in different ways than VP desktop did (which has had over 7 years to mature).<br/>
<br/>
I forget the exact quote, but something along the lines of "any sufficiently complex system can be proven to have evolved from a simple one" pretty much describes VP's evolution, and what I want to do with VPiP as well.<br/>
<br/>
I appreciate the patience, and no one wants this to be finished up more than myself.<br/>
<br/>
<br/>
PS:<br/>
VP = VoodooPad<br/>
VPP = VoodooPad Pro<br/>
VPL = VoodooPad Lite<br/>
VPiP = VoodooPad iPad<br/>
VPm = VoodooPad iPhone (m is mobile.  When finished, will be a fat binary with VPiP)<br/>
VPR = <a href="http://itunes.apple.com/us/app/vp-reader/id307017757?mt=8">VP Reader</a>
<br/>
<br/>
A theoretical 5.0 version of VoodooPad will dump the Pro and Lite, and make it just a single version along the lines of what I do for <a href="http://flyingmeat.com/acorn/">Acorn</a>.
   ]]></content>
 </entry><entry>
   <title>Towards a better BBCode</title>
   <link href="http://shapeof.com/archives/2010/05/towards_a_better_bbcode.html" rel="alternate" title="Towards a better BBCode" type="text/html" />
   <id>urn:uuid:a70c154d-3224-437b-8580-a3de59b0238e</id>
   <published>2010-05-30T11:19:00-08:00</published>
   <updated>2010-05-30T11:22:51-08:00</updated>
   <content type="html" xml:base="http://shapeof.com/" xml:lang="en"><![CDATA[
   Rosio Pavoris: <a href="http://cairnarvon.rotahall.org/2010/05/25/towards-a-better-bbcode/">Towards a better BBCode</a>.<br/>
<br/>
<blockquote style="margin:0px;">The discussions of learned societies on the subject have been less than satisfactory, so I decided to just implement my own mark-up language, based on the venerable S-expression:<br/>
<br/>
<blockquote><code>{b This} is {i {u expert} {o mark-up}}.</code></blockquote>
<br/>
This will turn into:<br/>
<br/>
<blockquote><b>This</b> is <i><u>expert</u> <span style="text-decoration: overline">mark-up</span></i>.</blockquote>
</blockquote>
<br/>
I really like what he's come up with here.
   ]]></content>
 </entry><entry>
   <title>JSNES</title>
   <link href="http://shapeof.com/archives/2010/05/jsnes.html" rel="alternate" title="JSNES" type="text/html" />
   <id>urn:uuid:9b6c4a6d-ff3f-435b-8af9-7b409cc330bf</id>
   <published>2010-05-16T12:54:21-08:00</published>
   <updated>2010-05-16T12:54:54-08:00</updated>
   <content type="html" xml:base="http://shapeof.com/" xml:lang="en"><![CDATA[
   <a href="http://benfirshman.com/projects/jsnes/">JSNES</a> is a Nintendo Entertainment System emulator, written in JavaScript.  Wowsers.
   ]]></content>
 </entry><entry>
   <title>MarsEdit 3 Is Here</title>
   <link href="http://shapeof.com/archives/2010/05/marsedit_3_is_here.html" rel="alternate" title="MarsEdit 3 Is Here" type="text/html" />
   <id>urn:uuid:ccd2f0dc-4d83-4004-b58c-4c4cc9a209a4</id>
   <published>2010-05-04T10:21:12-08:00</published>
   <updated>2010-05-04T10:23:50-08:00</updated>
   <content type="html" xml:base="http://shapeof.com/" xml:lang="en"><![CDATA[
   <a href="http://www.red-sweater.com/">Red Sweater</a> / <a href="http://www.red-sweater.com/blog/">Daniel Jalkut</a> has released an update to their great weblog editor, <a href="http://www.red-sweater.com/marsedit/">MarsEdit 3</a>.  Daniel has been working hard on MarsEdit 3 for a while now; and the best weblog editor for the Mac just got better.
   ]]></content>
 </entry>
</feed>