示例#1
0
        /// <summary>
        /// Return the color as gray components operands that define this brush
        /// Use formula according spec
        /// </summary>
        public List <Operand> GetGrayColorOperands()
        {
            List <Operand> operands = new List <Operand>();

            var realOp = new RealOperand(0.6);

            operands.Add(realOp);

            return(operands);
        }
示例#2
0
        /// <summary>
        /// Return the color as gray components operands that define this brush
        /// Use formula according spec
        /// </summary>
        public List <Operand> GetGrayColorOperands()
        {
            List <Operand> operands = new List <Operand>();

            double gray   = 0.3 * values[0] + 0.59 * values[1] + 0.11 * values[2];
            var    realOp = new RealOperand(gray);

            operands.Add(realOp);

            return(operands);
        }
示例#3
0
        /// <summary>
        /// Return the color components as operands that define this brush
        /// </summary>
        public List <Operand> GetColorOperands()
        {
            List <Operand> operands = new List <Operand>();

            foreach (var val in values)
            {
                var realOp = new RealOperand(val);
                operands.Add(realOp);
            }

            return(operands);
        }
        /// <summary>
        /// Return the color as RGB components as operands that define this brush
        /// </summary>
        public List <Operand> GetRGBColorOperands()
        {
            List <Operand> operands = new List <Operand>();

            for (int i = 0; i < 3; i++)
            {
                var realOp = new RealOperand(0);
                operands.Add(realOp);
            }

            return(operands);
        }
示例#5
0
        /// <summary>
        /// Return the color as RGB components operands that define this brush
        /// Here we don't use the formula from the spec, we use our formula that
        /// is needed to get a correct RGB value
        /// </summary>
        public List <Operand> GetRGBColorOperands()
        {
            var            color    = ColorSpaceConverter.ConvertCmykToRgb(values[0], values[1], values[2], values[3]);
            List <Operand> operands = new List <Operand>();

            var realOp = new RealOperand(color.R);

            operands.Add(realOp);
            realOp = new RealOperand(color.G);
            operands.Add(realOp);
            realOp = new RealOperand(color.B);
            operands.Add(realOp);

            return(operands);
        }
示例#6
0
        /// <summary>
        /// Return the color as CMYK components operands that define this brush
        /// Use formula according spec
        /// </summary>
        public List <Operand> GetCMYKColorOperands()
        {
            List <Operand> operands = new List <Operand>();

            var realOp = new RealOperand(0.4);

            operands.Add(realOp);
            realOp = new RealOperand(0.3);
            operands.Add(realOp);
            realOp = new RealOperand(0.3);
            operands.Add(realOp);
            realOp = new RealOperand(0.1);
            operands.Add(realOp);

            return(operands);
        }
示例#7
0
        /// <summary>
        /// Return the color as CMYK components operands that define this brush
        /// Use formula according spec
        /// </summary>
        public List <Operand> GetCMYKColorOperands()
        {
            List <Operand> operands = new List <Operand>();

            var c = 1.0 - values[0];
            var m = 1.0 - values[1];
            var y = 1.0 - values[2];
            var k = Math.Min(Math.Min(c, m), y);

            var realOp = new RealOperand(c);

            operands.Add(realOp);
            realOp = new RealOperand(m);
            operands.Add(realOp);
            realOp = new RealOperand(y);
            operands.Add(realOp);
            realOp = new RealOperand(k);
            operands.Add(realOp);

            return(operands);
        }
        /// <summary>
        /// Convert the given values to the destination color space values
        /// </summary>
        private List <double> ConvertValuesToAlternativeColorSpaceValues(List <double> values)
        {
            var operandStack = interpreter.OperandStack;

            foreach (var val in values)
            {
                var realOp = new RealOperand(val);
                operandStack.Push(realOp);
            }

            interpreter.Execute(tintTransformationProcedure);

            var newValues = new List <double>();

            for (int i = 0; i < alternativeColorSpace.GetNumberOfValuesPerColor(); i++)
            {
                var real = operandStack.PopRealValue();
                newValues.Add(real);
            }

            newValues.Reverse();

            return(values);
        }