LaserLine 2.0?

As noted on my [projects](/projects) page, last year I worked on an inspired little app, [LaserLine](http://www.acm.uiuc.edu/macwarriors/projects/laserline/).

Last week [Joey Hagedorn](http://joeyhagedorn.com/) (LaserLine’s progenitor) shared some of his recent brainstorms for the next iteration of LaserLine (he’s already started [building](http://www.joeyhagedorn.com/category/laserist/) new and improved hardware), and I must say I’m rearin’ to go.

Seeing as spring break is starting soon, and I’ll have a whole week’s worth of free time ([well](http://www.amazon.com/gp/product/0060521996/sr=8-1/qid=1142401672/ref=pd_bbs_1/104-1479412-7800751?%5Fencoding=UTF8) [almost](http://www.amazon.com/gp/product/0596000480/qid=1142401729/sr=2-1/ref=pd_bbs_b_2_1/104-1479412-7800751?s=books&v=glance&n=283155)) I think I’ll try and devote a sizable chunk of it to refreshing that old code.

The MacBook Pro

Ok, so this post is sooo past due…

Anyways, before I get started:

unboxing picture unboxing picture
unboxing picture unboxing picture
unboxing picture unboxing picture
unboxing picture unboxing picture
unboxing picture unboxing picture

So yea, if you hadn’t heard already – I got a MacBook.

It arrived two weeks ago today (1.5 weeks ahead of schedule). So why so late for the unboxing pictures? well… my original plan was to have some really groovy before-and-after pictures to go along with them – but that hasn’t quite worked out.

You see…a while back (last semester) I took a few pictures of my previous setup, and they turned out really nice – the lighting that day was excellent. The sad part is that there haven’t been any days where I’ve managed to get the same lighting in my room (busy schedules and gloomy weather don’t quite seem to work). So after giving the sun “just one more day” for the past 2 weeks, I figured things were becoming a tad ridiculous. There ya’ go, I’ll finish excusing myself.

How has the [MacBook](http://www.apple.com/macbookpro/) been so far? Simply put – it’s been amazing.

…I’ll be a bit more detailed with the next post.

Tip O’ The Day

So, say you have a certain [program](http://www.microsoft.com/mac/products/office2004/office2004.aspx?pid=office2004) who’s [developers](http://www.microsoft.com/mac/macbu/default.aspx?pid=macbu) figure it’s alright to pollute users’ home folders…

What to do?

$ /Developer/Tools/SetFile -a V  \
  ~/Documents/Microsoft\ User\ Data/

There, much better.

Down the Rabbit Hole…

Well, I’ve finally found a PowerBook [sic] that can [hold me](http://rentzsch.com/notes/noPowerbookCanHoldMe).

In ’round about 15 Days [Now](http://mikepiontek.com/journal/entries/3849/apple-order-status-widget/) a brand spanking new [MacBook Pro](http://www.apple.com/macbookpro/) will be beginning it’s long journey to my doorstep. So how will the new ride compare with the old?

Tesla Cardano
450MHz G4 2.0GHz CoreDuo
1GB RAM 2GB RAM
100MHz Bus 667MHz Bus
Radeon 9000 Pro (64MB) Radeon X1600 (256MB)
120GB + 40GB IDE 100GB SATA

…So yea, the good ol’ [PowerMac](http://www.apple-history.com/?page=gallery&model=g4agp&performa=off&sort=family&order=ASC) (circa 2000) doesn’t hold a candle to the competition.

I must say it has served me well, very well. It is a wonder that it has been able to stand up to 10.4, for that I suppose I should be thanking Apple’s engineers.

But enough is enough, while it would still be decent for casual use – *[I](http://en.wikipedia.org/wiki/Power_user)* need more, I want to be run *both* Illustrator and Photoshop, I want to watch H.264, I need to compile apps in a single sitting, and most importantly – I want a fancy widget-ripple effect.

down the rabbit hole...

That said, I have no idea what is in store for me with the new laptop. What I do know is that the 1st gen. iMac G5 was an…adventure.

So here’s to all those who took the leap and are running along the bloody edge that is the MacIntel – Groove On!

Code attack!

Over the weekend I managed to get some more coding in (though as usual, not as much as I’d have liked). So here’s a post about that:

Miscellaneous Projects: I decided I’d better make a home for all of my little projects. So now they all have a spot on my [miscellaneous projects](http://blog.oofn.net/projects/misc) page. And of course since no page would be complete with out the obligatory picture, I made a question-mark-in-a-package icon to keep them company, cool eh?

CTBadge: I knew when I started it that I’d eventually have to ditch the ripping of Mail.app’s badge images for my own purposes. And after [some](http://www.theronge.com) [suggestion](http://inessential.com/) I decided to make eventually *now*. It turned out making ‘counterfeits’ was actually not that bad… started up Illustrator, and a little while later (after finding the Zig-Zag Filter) I had vector (I love vector!) replicas of Mail’s raster badges.

I can't tell the difference

I can’t tell the difference

So now, thanks to the vector masks, [CTBadge](http://blog.oofn.net/2006/01/08/badging-for-everyone/) will get you renders of badges at any size, and also allows you to set the label and badge colors to what ever you’d like (while retaining the classy shading at the lower right corner – beautiful!).

And while all that is swell (and it is) I still wonder if letting people choose any color that they’d like for their badges is a *good* thing, I’ll rue the day when I see electric purple badges on my dock… but alternatively colored badges have their place I suppose – so there you go. (Though I sure hope people have a darn good reason for not using the classic white on red when they do – and “it looks better” doesn’t quite do it, but I suppose that’s just me).

CTGradient: Now it has a method to do a radial fill. After putting off including the code for a while, I finally settled on the implementation I preferred, which was leaving axial/radial specifics in the drawing methods where they belong – and not as a part of the instance. Though a few questions still remain – as I have it now, it draws so the gradient progresses from the center to the outermost edge, would there ever be a reason to have it progress to either the nearest edge or even off to the corner? meh, it’s good enough for now.

I also finished implementing all the *boring* parts of [CTGradient](http://blog.oofn.net/2006/01/15/gradients-in-cocoa/), that is, I finally implemented the NSCopying and NSCoding protocols, and also added some extra accessor methods, documentation, and #pragma’s to the source.

CTTabView: This a new project I’ve started work on, a view designed for doing more of a “Tabbed Views” sort of thing (like Safari/Adium/Firefox) than the “View with Tabs” thing that NSTabView does (and does well). Other people have made things like it… but none have really caught my fancy.

Well, that’s enough for now – I’ll save the rest for a later post.

Gradients in Cocoa

CGShadings are a pain. While CG is a heck of a powerful library… It always seems to take an elaborate amount of code (as well as time, if you’re not yet acquainted with it) to do some of the simplest little things. For a discussion on creating gradients with CGShading go [here](http://www.cocoadev.com/index.pl?GradientFill).

cocoa gradient

Now, AppKit provides a pretty decent layer of abstraction, but I find that there are still a number of holes in its coverage of those lower level APIs that could use some filling.

One of those that AppKit doesn’t cover (that it really, really should, especially given the whole resolution independence thing that’s in the works – 10.5 maybe? please?), are gradients.

When I started coding up a sourcelist (you know, the tableView with the iTunes/iPhoto/Mail styling) and also thinking of a few of the mini-projects that I had plans for, many of which could use gradients also – I figured that I might as well take a little detour and try my hand at filling in that gap.

And so, let me introduce you to my little Cocoa Obj-C Gradient class, CTGradient. It’s a small class that should provide a decent cocoa interface for CGShading.

In my case, CTGradient has gone a long way toward making the code in several of the projects I’ve been working on significantly less cluttered (and that’s always a welcome change). I no longer have lines of GCContext junk in my drawing functions nor do I have CG function callbacks proliferating my code. The few convenience methods that I tacked on help a bit with readability as well.

Download CTGradient
< 100 KB

And so, that said, I figure [a](http://mattgemmell.com/source/) [few](http://www.andymatuschak.org/articles/2006/01/11/making-the-hud-item-1-a-frame-themed-party) [people](http://wilshipley.com/blog/2005/07/pimp-my-code-part-3-gradient.html) might find it handy.

As it stands right now, it’s not *quite* finished (I expect the interface to change by a fair amount in the not to distant future – I have a few additions to make). But in any case the code is stable, so if it does what you need it to do, go ahead and make use of it!

With that I’ll end with a short list of those additions I have plans to make:

+ Radial Gradient (just need to figure out best method interface)
+ Chromatic blending (blending [HSB](http://en.wikipedia.org/wiki/HSB_color_space))
+ CTGradientWell (counterpart to NSColorWell – with palette to boot)
+ CTGradientSlider/Selecter? (view to let you add/remove/adjust color stops)
+ Miscellaneous methods for color stops
+ More pre-made gradients styles

Update: Updates and other info will be maintained at [svn.oofn.net](http://svn.oofn.net/#CTGradient).

Update: With OS 10.5’s AppKit, I would recommend using only NSGradient.

« Newer EntriesNext Page »
« Previous PageOlder Entries »