1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using System;
- using System.Drawing;
- namespace Microsoft.Windows.Forms
- {
-
-
-
- public class RandomColor
- {
-
-
-
- private const float GOLDEN_RATIO = 0.618033988749895f;
-
-
-
- private float? m_Hue;
-
-
-
-
-
-
- public Color Next(float saturation, float brightness)
- {
- if (this.m_Hue == null)
- {
- Random random = new Random(unchecked((int)DateTime.Now.Ticks));
- this.m_Hue = (float)random.NextDouble();
- }
- float hue = this.m_Hue.Value;
- hue += GOLDEN_RATIO;
- hue %= 1;
- this.m_Hue = hue;
- return RenderEngine.FromHsv(hue, saturation, brightness);
- }
-
-
-
-
- public Color Next()
- {
- return this.Next(0.5f, 0.99f);
- }
- }
- }
|