Пример #1
0
 void Clamp(Ambertation.Geometry.Vector4 v)
 {
     v.X = Math.Max(0, Math.Min(1, v.X));
     v.Y = Math.Max(0, Math.Min(1, v.Y));
     v.Z = Math.Max(0, Math.Min(1, v.Z));
     v.W = Math.Max(0, Math.Min(1, v.W));
 }
Пример #2
0
 public System.Drawing.Color ToARGB()
 {
     if (this.ToFloat().Length < 4)
     {
         return(ToRGB());
     }
     Ambertation.Geometry.Vector4 v = ToVector4();
     Clamp(v);
     return(System.Drawing.Color.FromArgb((int)(v.W * 0xff), (int)(v.X * 0xff), (int)(v.Y * 0xff), (int)(v.Z * 0xff)));
 }
Пример #3
0
 public Ambertation.Geometry.Vector4 ToVector4()
 {
     double[] list = ToFloat();
     Ambertation.Geometry.Vector4 v = new Ambertation.Geometry.Vector4(0, 0, 0, 0);
     if (list.Length > 0)
     {
         v.X = list[0];
     }
     if (list.Length > 1)
     {
         v.Y = list[1];
     }
     if (list.Length > 2)
     {
         v.Z = list[2];
     }
     if (list.Length > 3)
     {
         v.W = list[3];
     }
     return(v);
 }