PDA

View Full Version : A Whiter Shade Of Pale?


binil
10-14-2004, 10:46 PM
Hi all,

I am experimenting with Laszlo the last couple of weeks in my freetime after work. I am essentially a Java/J2EE programmer, and have no experience using graphic-creation tools.

I need to create the effect of a shadow at places in my app, and I was wondering if there is some way of (say, an equation) finding a color which represents a draker shade of a given colour. Kindly let me know if there is some consistent way of finding it. If the process is too hard to explain here on the forum, please post a link to some resource where I can find the information and I will try to read it up.

I dont know if my question is absolutely stupid, so my appologies if it is. :)

Thanks,
Binil

thadsmith
11-02-2004, 01:30 PM
If you're looking for an api or some component to add a shadow to a resource or a view, then the answer is that there really isn't one. The laszlo components themselves aren't really made for doing complex drawing/graphic affects. The easy way to do this is simply using graphics. If you break apart most demos this is what they do.

PNG is the best format for images since it support alpha channels. Basically if you add a drop shadow to your image, you can save it with a transparent background and the shadow will be rendered correctly against any background you put behind the image.

If you still want to use components to do this you can use stack views and use the opacity attribute to simulate the shadow. Something like:

<view width="10" height="10" x="9" y="9" bgcolor="#000000" opacity=".25" />
<view width="10" height="10" x="8" y="8" bgcolor="#000000" opacity=".5" />
<view width="10" height="10" x="7" y="7" bgcolor="#000000" opacity=".75" />
<view width="10" height="10" x="6" y="6" bgcolor="#000000" />
<view width="10" height="10" x="5" y="5" bgcolor="#FFFFFF" />

Thad Smith

antun
11-05-2004, 03:13 PM
I need to create the effect of a shadow at places in my app, and I was wondering if there is some way of (say, an equation) finding a color which represents a draker shade of a given colour.

There's probably an algorithm that you can find that will get you from color A in hex RGB format to a darker color (B) by adjusting the Lightness or Saturation (using the HSL model).

If you can find the algorithm, I think it should certainly be possible to write it in JavaScript and have it all take place inside the Laszlo application.

-Antun