Пример #1
0
 public IHlsColor GetHlsColor(Color pColor)
 {
     try
     {
         if (pColor.IsEmpty)
         {
             return(null);
         }
         IHlsColor color = null;
         color = new HlsColorClass {
             Hue        = (int)pColor.GetHue(),
             Lightness  = ((int)pColor.GetBrightness()) * 100,
             Saturation = ((int)pColor.GetSaturation()) * 100
         };
         IColor color2 = null;
         color2 = color;
         color2.Transparency = pColor.A;
         return(color);
     }
     catch (Exception exception)
     {
         this.mErrOpt.ErrorOperate(this.mSubSysName, "FunFactory.ColorFun", "GetHlsColor", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", "");
         return(null);
     }
 }
Пример #2
0
 public IHlsColor GetHlsColor(int iHue, int iLightness, int iSaturation, bool bUseWinDithering)
 {
     try
     {
         IHlsColor color = null;
         color                     = new HlsColorClass();
         iHue                      = this.CheckNumValueRegion(iHue, 0, 360);
         iLightness                = this.CheckNumValueRegion(iLightness, 0, 100);
         iSaturation               = this.CheckNumValueRegion(iSaturation, 0, 100);
         color.Hue                 = iHue;
         color.Lightness           = iLightness;
         color.Saturation          = iSaturation;
         color.UseWindowsDithering = bUseWinDithering;
         return(color);
     }
     catch (Exception exception)
     {
         this.mErrOpt.ErrorOperate(this.mSubSysName, "FunFactory.ColorFun", "GetHlsColor", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", "");
         return(null);
     }
 }