Esempio n. 1
0
        /// <summary>
        /// Init
        /// </summary>
        public void Init(EpsInterpreter interpreter, ArrayOperand colorSpaceDetails)
        {
            this.interpreter       = interpreter;
            this.colorSpaceDetails = colorSpaceDetails;

            switch (colorSpaceDetails.Values[1].Operand)
            {
            case StringOperand stringOperand:
            case NameOperand nameOperand:
                numberOfValuesPerColor = 1;
                break;

            case ArrayOperand namesArray:
                numberOfValuesPerColor = namesArray.Values.Count;
                break;

            default:
                throw new Exception("illegal type");
            }

            // we only operate on the alternative color space
            var colorSpaceOp = colorSpaceDetails.Values[2].Operand;

            alternativeColorSpace = ColorSpaceActivator.CreateColorSpace(interpreter, colorSpaceOp);

            tintTransformationProcedure = (ArrayOperand)colorSpaceDetails.Values[3].Operand;
        }
Esempio n. 2
0
        /// <summary>
        /// Create a copy to decouple execution flags from the original object
        /// </summary>
        protected override Operand CreateCopy()
        {
            var copy = new ArrayOperand();

            copy.Values = Values;

            return(copy);
        }
Esempio n. 3
0
        /// <summary>
        /// Init
        /// </summary>
        public void Init(EpsInterpreter interpreter, ArrayOperand colorSpaceDetails)
        {
            this.interpreter       = interpreter;
            this.colorSpaceDetails = colorSpaceDetails;

            var colorSpaceOp = colorSpaceDetails.Values[1].Operand;

            baseColorSpace = ColorSpaceActivator.CreateColorSpace(interpreter, colorSpaceOp);
            hival          = ((IntegerOperand)colorSpaceDetails.Values[2].Operand).Value;

            switch (colorSpaceDetails.Values[3].Operand)
            {
            case StringOperand stringOperand:
                useProcedure = false;
                hexString    = stringOperand.Value;
                break;

            case ArrayOperand arrayOperand:
                useProcedure = true;
                tintTransformationProcedure = arrayOperand;
                break;
            }
        }
        /// <summary>
        /// Create a color space
        /// </summary>
        public static IColorSpace CreateColorSpace(EpsInterpreter interpreter, Operand colorSpaceOperand)
        {
            string       colorSpaceName    = null;
            ArrayOperand colorSpaceDetails = null;

            switch (colorSpaceOperand)
            {
            case NameOperand nameOperand:
            {
                colorSpaceName = nameOperand.Value;
                break;
            }

            case ArrayOperand arrayOperand:
            {
                colorSpaceName    = OperandHelper.GetStringValue(arrayOperand.Values[0].Operand);
                colorSpaceDetails = arrayOperand;
                break;
            }
            }

            return(CreateColorSpace(interpreter, colorSpaceName, colorSpaceDetails));
        }
Esempio n. 5
0
 /// <summary>
 /// Init
 /// </summary>
 public void Init(EpsInterpreter interpreter, ArrayOperand colorSpaceDetails)
 {
     this.colorSpaceDetails = colorSpaceDetails;
 }
Esempio n. 6
0
 /// <summary>
 /// Init
 /// </summary>
 public void Init(EpsInterpreter interpreter, ArrayOperand colorSpaceArray)
 {
 }
        /// <summary>
        /// Create a color space
        /// </summary>
        public static IColorSpace CreateColorSpace(EpsInterpreter interpreter, string colorSpaceName, ArrayOperand colorSpaceDetails = null)
        {
            IColorSpace colorSpace = null;

            switch (colorSpaceName)
            {
            case EpsKeys.DeviceRGB:
            {
                colorSpace = new RGBDeviceColorSpace();
                break;
            }

            case EpsKeys.DeviceCMYK:
            {
                colorSpace = new CMYKDeviceColorSpace();
                break;
            }

            case EpsKeys.DeviceGray:
            {
                colorSpace = new GrayDeviceColorSpace();
                break;
            }

            case EpsKeys.DevicePattern:
            {
                colorSpace = new PatternColorSpace();
                break;
            }

            case EpsKeys.Separation:
            case EpsKeys.DeviceN:
            {
                colorSpace = new DeviceNColorSpace();
                break;
            }

            case EpsKeys.Indexed:
            {
                colorSpace = new IndexedColorSpace();
                break;
            }

            case EpsKeys.CIEBasedABC:
            {
                colorSpace = new UnknownColorSpace(3);
                break;
            }

            case EpsKeys.CIEBasedA:
            {
                colorSpace = new UnknownColorSpace(1);
                break;
            }

            default:
            {
                colorSpace = new UnknownColorSpace(1);
                break;
            }
            }

            colorSpace.Init(interpreter, colorSpaceDetails);

            return(colorSpace);
        }