public MainWindow() { InitializeComponent(); List <ColourRangeVo> colList = MockData.getColourList(); colourRange = new ColourRange(colList); /* * ColourRangeVo c = null; * * // test rgb to hsl to rgb * Colour col1 = Color.FromArgb(179, 101, 131); * Colour col12 = Colour.HslToRgb(col1.getHSL()); * c = colourRange.getColorMatch(col1); * Debug.WriteLine(c.colour.ToString()); * * // test colour match in colour range * Colour col2 = Color.FromArgb(151, 101, 179); * c = colourRange.getColorMatch(col2); * Debug.WriteLine(c.colour.ToString()); * * // test colour match in colour range * Colour col3 = Color.FromArgb(151, 101, 179); * c = colourRange.getColorMatch(col3); * Debug.WriteLine(c.colour.ToString()); */ }
/// <summary> /// Returns a random colour vector within the specified colour range. /// </summary> /// <param name="range">A colour range value defining the minimum and maximum values.</param> /// <returns>A random colour vector within the specified colour range.</returns> static public Vector3 NextColour(ColourRange range) { return new Vector3 { X = RandomUtil.NextSingle(range.Red), Y = RandomUtil.NextSingle(range.Green), Z = RandomUtil.NextSingle(range.Blue) }; }
public ReleaseParameters() { Quantity = 1; Speed = RangeF.Parse("[-1.0,1.0]"); Colour = new ColourRange(new Colour(0f, 0.5f, 0.5f), new Colour(360f, 0.5f, 0.5f)); Opacity = RangeF.Parse("[0.0,1.0]"); Scale = RangeF.Parse("[1.0,10.0]"); Rotation = RangeF.Parse("[-3.14159,3.14159]"); Mass = 1f; }
public ReleaseParameters() { Quantity = 1; Speed = RangeF.Parse("[-1.0,1.0]"); Colour = new ColourRange(new Colour(0f, 0.5f, 0.5f), new Colour(360f, 0.5f, 0.5f)); Opacity = RangeF.Parse("[0.0,1.0]"); Scale = RangeF.Parse("[1.0,10.0]"); Rotation = RangeF.Parse("[-3.14159,3.14159]"); Mass = 1f; }
/// <summary> /// Converts the given object to the type of this converter, using the specified context and culture information. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that provides a format context.</param> /// <param name="culture">The <see cref="T:System.Globalization.CultureInfo"/> to use as the current culture.</param> /// <param name="value">The <see cref="T:System.Object"/> to convert.</param> /// <returns> /// An <see cref="T:System.Object"/> that represents the converted value. /// </returns> /// <exception cref="T:System.NotSupportedException">The conversion cannot be performed. </exception> public override Object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) { culture = culture ?? CultureInfo.CurrentCulture; if (value is String) { return(ColourRange.Parse(value as String, culture)); } return(base.ConvertFrom(context, culture, value)); }
protected Emitter() { Particals = new List <Partical>(); Initial_Colour = new ColourRange(Color.White, Color.White); Initial_LifeTime = new FloatRange(1, 1); Initial_Velocity = new Vector2Range(new Vector2(5, 0), new Vector2(5, 0)); Initial_Rotaiton = new FloatRange(0, 0); Initial_Angulor_Velocity = new FloatRange(0, 0); Initial_Scale = new FloatRange(1, 1); Modifyers = new List <Modifyer>(); }
/// <summary> /// Converts the given value object to the specified type, using the specified context and culture information. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that provides a format context.</param> /// <param name="culture">A <see cref="T:System.Globalization.CultureInfo"/>. If null is passed, the current culture is assumed.</param> /// <param name="value">The <see cref="T:System.Object"/> to convert.</param> /// <param name="destinationType">The <see cref="T:System.Type"/> to convert the <paramref name="value"/> parameter to.</param> /// <returns> /// An <see cref="T:System.Object"/> that represents the converted value. /// </returns> /// <exception cref="T:System.ArgumentNullException">The <paramref name="destinationType"/> parameter is null. </exception> /// <exception cref="T:System.NotSupportedException">The conversion cannot be performed. </exception> public override Object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, Object value, Type destinationType) { culture = culture ?? CultureInfo.CurrentCulture; if (destinationType == typeof(String)) { if (value is ColourRange) { ColourRange range = (ColourRange)value; return(range.ToString(culture)); } } return(base.ConvertTo(context, culture, value, destinationType)); }
public static Color4 RandColor(ColourRange range) { return new Color4(RandomTool.RandFloat(range.Red), RandomTool.RandFloat(range.Green), RandomTool.RandFloat(range.Blue), 1f); }