public static void ToColorSpace(IRgb color, ICmyk item, Uri cmykProfile)
        {
            if (cmykProfile == null)
            {
                CmykConverter.ToColorSpace(color, item);
                return;
            }

            var cmyk = CmykProfileConverter.TranslateColor(color, cmykProfile);

            item.C = cmyk.C;
            item.M = cmyk.M;
            item.Y = cmyk.Y;
            item.K = cmyk.K;
        }
Пример #2
0
 public static T To <T>(this IColorSpaceWithProfile color) where T : class, IColorSpace, new()
 {
     if (color.Color is ICmyk)
     {
         var rgb = CmykConverter.ToColor(color.Color as ICmyk, color.Profile);
         return(rgb.To <T>());
     }
     if (typeof(ICmyk).IsAssignableFrom(typeof(T)))
     {
         var rgb  = color.Color.To <Rgb>();
         var item = new Cmyk();
         CmykConverter.ToColorSpace(rgb, item, color.Profile);
         return(item as T);
     }
     throw new ArgumentException("Profiles require that you are converting to or from Cmyk.");
 }
Пример #3
0
 public override void Initialize(IRgb color)
 {
     CmykConverter.ToColorSpace(color, this);
 }