Esempio n. 1
0
        private void DuaICCProfile_Data_Data(ILGenerator CMIL, ICCProfile profile1, ICCProfile profile2)
        {
            if (profile1.PCS == profile2.PCS)
            {
                TempColor1 = profile1.GetPCSColor(true);
                var c1 = new ConversionCreator_ICC(CMIL, Data, InColor, TempColor1, false);
                c1.SetConversionMethod();
                var c2 = new ConversionCreator_ICC(c1, TempColor1, OutColor, true);
                c1.SetConversionMethod();
            }
            else
            {
                TempColor1 = profile1.GetPCSColor(true);
                TempColor2 = profile2.GetPCSColor(true);

                var c1 = new ConversionCreator_ICC(CMIL, Data, InColor, TempColor1, false);
                c1.SetConversionMethod();

                var c2 = new ConversionCreator_Color(c1, TempColor1, TempColor2, false);
                c2.SetConversionMethod();

                var c3 = new ConversionCreator_ICC(c2, TempColor2, OutColor, true);
                c3.SetConversionMethod();
            }
        }
Esempio n. 2
0
        private void SingleICCProfile(ILGenerator CMIL, ICCProfile profile)
        {
            var inType  = InColor.GetType();
            var outType = OutColor.GetType();

            if (profile.Class == ProfileClassName.Abstract)
            {
                if (inType == profile.PCSType && outType == profile.PCSType)
                {
                    var c = new ConversionCreator_ICC(CMIL, Data, InColor, OutColor);
                    c.SetConversionMethod();
                }
                else
                {
                    throw new ConversionSetupException();
                }
            }
            else if (profile.Class == ProfileClassName.DeviceLink)
            {
                if (inType == profile.DataColorspaceType && outType == profile.PCSType)
                {
                    var c = new ConversionCreator_ICC(CMIL, Data, InColor, OutColor);
                    c.SetConversionMethod();
                }
                else
                {
                    throw new ConversionSetupException();
                }
            }
            else
            {
                if (inType == profile.PCSType)
                {
                    if (outType == profile.DataColorspaceType)
                    {
                        var c = new ConversionCreator_ICC(CMIL, Data, InColor, OutColor);
                        c.SetConversionMethod();
                    }
                    else
                    {
                        var c = new ConversionCreator_Color(CMIL, Data, InColor, OutColor);
                        c.SetConversionMethod();
                    }
                }
                else if (inType == profile.DataColorspaceType)
                {
                    if (outType == profile.PCSType)
                    {
                        var c = new ConversionCreator_ICC(CMIL, Data, InColor, OutColor);
                        c.SetConversionMethod();
                    }
                    else
                    {
                        TempColor1 = profile.GetPCSColor(true);
                        var c1 = new ConversionCreator_ICC(CMIL, Data, InColor, TempColor1, false);
                        c1.SetConversionMethod();
                        var c2 = new ConversionCreator_Color(c1, TempColor1, OutColor, true);
                        c2.SetConversionMethod();
                    }
                }
                else
                {
                    if (outType == profile.DataColorspaceType)
                    {
                        TempColor1 = profile.GetPCSColor(true);
                        var c1 = new ConversionCreator_Color(CMIL, Data, InColor, TempColor1, false);
                        c1.SetConversionMethod();
                        var c2 = new ConversionCreator_ICC(c1, TempColor1, OutColor, true);
                        c2.SetConversionMethod();
                    }
                    else
                    {
                        var c = new ConversionCreator_Color(CMIL, Data, InColor, OutColor);
                        c.SetConversionMethod();
                    }
                }
            }
        }
Esempio n. 3
0
        private void DuaICCProfile(ILGenerator CMIL, ICCProfile profile1, ICCProfile profile2)
        {
            var inType  = InColor.GetType();
            var outType = OutColor.GetType();

            const ProfileClassName abst = ProfileClassName.Abstract;
            const ProfileClassName devl = ProfileClassName.DeviceLink;

            if (profile1.Class == abst || profile2.Class == abst)
            {
                if (profile1.Class != profile2.Class || profile1.PCS != profile2.PCS)
                {
                    throw new ConversionSetupException();
                }

                if (inType == profile1.PCSType && outType == profile1.PCSType)
                {
                    var c = new ConversionCreator_ICC(CMIL, Data, InColor, OutColor);
                    c.SetConversionMethod();
                }
                else
                {
                    throw new ConversionSetupException();
                }
            }
            else if (profile1.Class == devl || profile2.Class == devl)
            {
                if (profile1.Class != profile2.Class || profile1.PCS != profile2.PCS ||
                    profile1.DataColorspace != profile2.DataColorspace)
                {
                    throw new ConversionSetupException();
                }

                if (inType == profile1.DataColorspaceType && outType == profile1.PCSType)
                {
                    var c = new ConversionCreator_ICC(CMIL, Data, InColor, OutColor);
                    c.SetConversionMethod();
                }
                else
                {
                    throw new ConversionSetupException();
                }
            }
            else
            {
                if (inType == profile1.DataColorspaceType)
                {
                    if (outType == profile2.DataColorspaceType)
                    {
                        DuaICCProfile_Data_Data(CMIL, profile1, profile2);
                    }
                    else if (outType == profile2.PCSType)
                    {
                        DuaICCProfile_Data_PCS(CMIL, profile1, profile2);
                    }
                    else
                    {
                        throw new ConversionSetupException();  //Should never happen because of Color checks
                    }
                }
                else if (inType == profile1.PCSType)
                {
                    if (outType == profile2.DataColorspaceType)
                    {
                        DuaICCProfile_PCS_Data(CMIL, profile1, profile2);
                    }
                    else if (outType == profile2.PCSType)
                    {
                        DuaICCProfile_PCS_PCS(CMIL, profile1, profile2);
                    }
                    else
                    {
                        throw new ConversionSetupException();  //Should never happen because of Color checks
                    }
                }
                else
                {
                    throw new ConversionSetupException();  //Should never happen because of Color checks
                }
            }
        }