diff dwtx/jface/internal/text/revisions/Colors.d @ 150:5cf141e43417

...
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 23:05:26 +0200
parents 51e6e63f930e
children 25f1f92fa3df
line wrap: on
line diff
--- a/dwtx/jface/internal/text/revisions/Colors.d	Sun Aug 24 22:41:48 2008 +0200
+++ b/dwtx/jface/internal/text/revisions/Colors.d	Sun Aug 24 23:05:26 2008 +0200
@@ -30,7 +30,7 @@
 
 /**
  * Utility for color operations.
- * 
+ *
  * @since 3.3
  */
 public final class Colors {
@@ -43,7 +43,7 @@
     /**
      * Returns the human-perceived brightness of a color as float in [0.0, 1.0]. The used RGB
      * weights come from http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC9.
-     * 
+     *
      * @param rgb the color
      * @return the gray-scale value
      */
@@ -56,7 +56,7 @@
      * are lightened. Depending on the hue, the brightness range within the RGB gamut may be
      * different, outside values are clipped. Note that this is an approximation; the returned RGB
      * is not guaranteed to have the requested {@link #brightness(RGB) brightness}.
-     * 
+     *
      * @param color the color to normalize
      * @param brightness the requested brightness, in [0,&nbsp;1]
      * @return a normalized version of <code>color</code>
@@ -74,7 +74,7 @@
     /**
      * Converts an {@link RGB} to an <a href="http://en.wikipedia.org/wiki/HSL_color_space">HSI</a>
      * triplet.
-     * 
+     *
      * @param color the color to convert
      * @return the HSI float array of length 3
      */
@@ -95,7 +95,7 @@
                 hue = (g  - b) / delta;
             } else {
                 if (g is max) {
-                    hue = 2 + (b - r) / delta;  
+                    hue = 2 + (b - r) / delta;
                 } else {
                     hue = 4 + (r - g) / delta;
                 }
@@ -103,12 +103,12 @@
             hue *= 60;
             if (hue < 0) hue += 360;
         }
-        return new float[] {hue, saturation, intensity};
+        return [hue, saturation, intensity];
     }
 
     /**
      * Converts a <a href="http://en.wikipedia.org/wiki/HSL_color_space">HSI</a> triplet to an RGB.
-     * 
+     *
      * @param hsi the HSI values
      * @return the RGB corresponding to the HSI spec
      */
@@ -118,7 +118,7 @@
         float saturation= hsi[1];
         float intensity= hsi[2];
         if (saturation is 0) {
-            r = g = b = intensity; 
+            r = g = b = intensity;
         } else {
             float temp2= intensity < 0.5f ? intensity * (1.0f + saturation) : (intensity + saturation) - (intensity * saturation);
             float temp1= 2f * intensity - temp2;
@@ -132,7 +132,7 @@
 
         int red = cast(int)(r * 255 + 0.5);
         int green = cast(int)(g * 255 + 0.5);
-        int blue = cast(int)(b * 255 + 0.5);    
+        int blue = cast(int)(b * 255 + 0.5);
         return new RGB(red, green, blue);
     }
 
@@ -158,7 +158,7 @@
      * @param bg the background color
      * @param fg the foreground color
      * @param factor the mixing factor, must be in [0,&nbsp;1]
-     * 
+     *
      * @return the interpolated color
      */
     public static RGB blend(RGB bg, RGB fg, float factor) {
@@ -179,7 +179,7 @@
      * <p>
      * The returned array has size <code>steps</code>, and the color at index 0 is <code>start</code>, the color
      * at index <code>steps&nbsp;-&nbsp;1</code> is <code>end</code>.
-     * 
+     *
      * @param start the start color of the palette
      * @param end the end color of the palette
      * @param steps the requested size, must be &gt; 0
@@ -189,14 +189,14 @@
         Assert.isLegal(start !is null);
         Assert.isLegal(end !is null);
         Assert.isLegal(steps > 0);
-        
+
         if (steps is 1)
-            return new RGB[] { start };
+            return [ start ];
 
         float step= 1.0f / (steps - 1);
         RGB[] gradient= new RGB[steps];
         for (int i= 0; i < steps; i++)
-            gradient[i]= blend(start, end, step * i); 
+            gradient[i]= blend(start, end, step * i);
 
         return gradient;
     }
@@ -217,7 +217,7 @@
      * {@link DWT#COLOR_YELLOW yellow}, {@link DWT#COLOR_CYAN cyan},
      * {@link DWT#COLOR_MAGENTA magenta}.
      * </p>
-     * 
+     *
      * @param steps the requested size, must be &gt;= 2
      * @return an array of <code>steps</code> colors evenly distributed on the color wheel
      */
@@ -241,7 +241,7 @@
      * {@link DWT#COLOR_YELLOW yellow}, {@link DWT#COLOR_CYAN cyan},
      * {@link DWT#COLOR_MAGENTA magenta}.
      * </p>
-     * 
+     *
      * @param index the index of the color, must be &gt;= 0
      * @return a color hue in [0&#176;,&nbsp;360&#176;)
      * @see RGB#RGB(float, float, float)
@@ -252,7 +252,7 @@
          * Base 3 gives a nice partitioning for RGB colors with red, green, blue being the colors
          * 0,1,2, and yellow, cyan, magenta colors 3,4,5.
          */
-        final int base= 3; 
+        final int base= 3;
         final float range= 360f;
 
         // partition the baseRange by using the least significant bit to select one half of the