~ubuntu-branches/ubuntu/natty/gnome-do/natty

« back to all changes in this revision

Viewing changes to Do.Interface.Linux/src/Do.Interface/Do.Interface.CairoUtils/CairoUtils.cs

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane
  • Date: 2009-03-22 22:44:39 UTC
  • mto: (1.1.7 upstream) (0.1.4 squeeze)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20090322224439-ztmk4tbq19s3safs
ImportĀ upstreamĀ versionĀ 0.8.1.3+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
306
306
                }
307
307
                
308
308
                /// <summary>
 
309
                /// Set a color to use a maximum value
 
310
                /// </summary>
 
311
                /// <param name="gdk_color">
 
312
                /// A <see cref="Gdk.Color"/>
 
313
                /// </param>
 
314
                /// <param name="max_value">
 
315
                /// A <see cref="System.Double"/>
 
316
                /// </param>
 
317
                /// <returns>
 
318
                /// A <see cref="Gdk.Color"/>
 
319
                /// </returns>
 
320
                public static Gdk.Color SetMinimumValue (this Gdk.Color gdk_color, double min_value)
 
321
                {
 
322
                        byte r, g, b; 
 
323
                        double h, s, v;
 
324
                        
 
325
                        r = (byte) ((gdk_color.Red)   >> 8);
 
326
                        g = (byte) ((gdk_color.Green) >> 8);
 
327
                        b = (byte) ((gdk_color.Blue)  >> 8);
 
328
                        
 
329
                        Util.Appearance.RGBToHSV (r, g, b, out h, out s, out v);
 
330
                        v = Math.Max (v, min_value);
 
331
                        Util.Appearance.HSVToRGB (h, s, v, out r, out g, out b);
 
332
                        
 
333
                        return new Gdk.Color (r, g, b);
 
334
                }
 
335
                
 
336
                /// <summary>
309
337
                /// Convert a Gdk.color to a hex string
310
338
                /// </summary>
311
339
                /// <param name="gdk_color">