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.
Super cool!
from: anonymous
date: Nov. 1st, 2006 07:22 pm (UTC)
Link
Reply | Thread
(no subject)
from:
batkins_
date: Nov. 1st, 2006 07:35 pm (UTC)
Link
Reply | Thread
Interesting
from: anonymous
date: Nov. 1st, 2006 07:55 pm (UTC)
Link
Reply | Thread
Re: Interesting
from:
xach
date: Nov. 1st, 2006 08:00 pm (UTC)
Link
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
:)
from:
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
Reply | Thread
Re: Fighing the good fight
from:
xach
date: Feb. 27th, 2008 03:06 pm (UTC)
Link
Reply | Parent | Thread
Wow
from: anonymous
date: Apr. 4th, 2008 06:35 pm (UTC)
Link
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