Search code examples
algorithmdelphigraphicsfill

How do I do a iPhone button-like fill


I'd like to spruce up some of the user controls I use and thought some attractive fills should do the job (part of it perhaps). Like the fill in the background of iPhone buttons or the Office 2007 ribbon bar (perhaps you know a few more).

Edit: To clear things up, I don't need a simple gradient fill - there is a Windows API call for that. I am more interested in how the entire effect is achieved. Here is a link to an article that shows how to do it in PhotoShop, but I want to accomplish that in code.

Specifically, the glossy gradient at the top ends in a curve roughly in the middle of the button. I half expect that this will need to be rendered separately and blended somehow.

Any ideas?


Solution

  • The "glass" effect is made simply by creating a white ellipse around 4x larger than tall, placing it over the image to be "glassed" so that the bottom arc is centered on the image then alpha blending. I believe this sample delphi code will be some help in performing the final portion.