Gradient Textures

Richard Gaskin ambassador at fourthworld.com
Wed Aug 29 12:40:04 EDT 2007


David Bovill wrote:
> I've been taking a look at those gently beveled buttons / bars, and I'm
> wandering the best way to do this. It seems people often use gradient fill
> in images created in another program. My first take on this is that it is
> not the optimal way to do things - is it not better to use a small image and
> tile a button or a background of a group? For instance a 1 pixel wide image
> (in the shape of a vertical line) which fades slightly at the top and bottom
> - rather than an entire image in the form of a bar?

That's pretty much the approach I took when writing my Gradient tool in 
devolution.  It generates a vertical or horizontal gradient only 8 
pixels wide (I found 1-pixel widths to be problematic), and then 
stretches it to fill the space required.

This allows gradients to be generated very quickly, and they take up 
very little storage space.

The only downside to this approach is that it's only good for the 
gradient itself.  That is, if you also need text or other elements in 
the same image the stretching will hose that, and using a stretched 
image as a backgroundPattern causes the object using it to render with 
varied tiling results (there are some funky limits to tiled fills on 
Mac, and different limits on Windows).

-- 
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list