Mercurial > projects > dwt-addons
comparison dwtx/jface/internal/text/revisions/Colors.d @ 162:1a5b8f8129df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 08 Sep 2008 00:51:37 +0200 |
parents | 25f1f92fa3df |
children |
comparison
equal
deleted
inserted
replaced
161:f8d52b926852 | 162:1a5b8f8129df |
---|---|
60 * @param color the color to normalize | 60 * @param color the color to normalize |
61 * @param brightness the requested brightness, in [0, 1] | 61 * @param brightness the requested brightness, in [0, 1] |
62 * @return a normalized version of <code>color</code> | 62 * @return a normalized version of <code>color</code> |
63 * @see #brightness(RGB) | 63 * @see #brightness(RGB) |
64 */ | 64 */ |
65 public static RGB adjustBrightness(RGB color, float brightness) { | 65 public static RGB adjustBrightness(RGB color, float brightness_) { |
66 float[] hsi= toHSI(color); | 66 float[] hsi= toHSI(color); |
67 float psychoFactor= brightness - brightness(color); | 67 float psychoFactor= brightness_ - brightness(color); |
68 float weight= 0.5f; // found by trial and error | 68 float weight= 0.5f; // found by trial and error |
69 hsi[2]= Math.max(0, Math.min(1.0f, hsi[2] + psychoFactor * weight)); | 69 hsi[2]= Math.max(0, Math.min(1.0f, hsi[2] + psychoFactor * weight)); |
70 color= fromHSI(hsi); | 70 color= fromHSI(hsi); |
71 return color; | 71 return color; |
72 } | 72 } |