one more lisp web toy/tool

« previous entry | next entry »
Nov. 1st, 2006 | 05:22 pm

I just put up Cornershop, a tool for generating rounded corner graphics for website design. It's another skippy-powered project, but it does get a little tricky.

The initial version used Wu's circle algorithm to generate one quarter of an anti-aliased circle, then flipped it or translated it to get all four corners. That was pretty fast, but as the radius got big (I allow up to 150 pixels), it consed a lot (about 300KB) and got pretty slow (about 0.25s for four graphics).

The output images differ by foreground, background, and size. Since GIF is an indexed image format, changing the color table doesn't involve changing a single bit of image data. If you have an existing GIF for each allowed size, you can make a new image in any color by reading the "template" gif, munging its color table in memory, and writing out a new file. With that strategy, making any size from 2 to 150 pixels in any color takes a relatively constant 0.001s, and it takes only about 3MB of template images.

Go check it out!

Tags: ,

Link | Leave a comment | Add to Memories | Tell a Friend

Comments {8}

Super cool!

from: anonymous
date: Nov. 1st, 2006 07:22 pm (UTC)
Link

I was just groaning about having to create a set of rounded corners and her they are along with the css to boot!

Reply | Thread

(no subject)

from: [info]batkins_
date: Nov. 1st, 2006 07:35 pm (UTC)
Link

Awesome!

Reply | Thread

Interesting

from: anonymous
date: Nov. 1st, 2006 07:55 pm (UTC)
Link

Your list of binary file manipulation apis is growing.

Reply | Thread

Zach Beane

Re: Interesting

from: [info]xach
date: Nov. 1st, 2006 08:00 pm (UTC)
Link

For replacing the color table, the API usage is mostly:

READ-SEQUENCE
REPLACE
(SETF AREF)
WRITE-SEQUENCE

It helps that I created the template GIFs and know exactly where the color table lives, so I can hardcode some things and I don't have to parse at all.

Reply | Parent | Thread

McCoy Pauley

:)

from: [info]dixieflatline
date: Nov. 1st, 2006 08:11 pm (UTC)
Link






Reply | Thread

Fighing the good fight

from: anonymous
date: Feb. 27th, 2008 03:01 pm (UTC)
Link

Way to keep common lisp going!

Reply | Thread

Zach Beane

Re: Fighing the good fight

from: [info]xach
date: Feb. 27th, 2008 03:06 pm (UTC)
Link

Fortunately it's not just me!

Reply | Parent | Thread

Wow

from: anonymous
date: Apr. 4th, 2008 06:35 pm (UTC)
Link

Thank you so much : D
I was looking for a way to make the corners when your site popped up.
This was a big help.
I spent 3 hours trying to do what this did in minutes.

Reply | Thread