/// <summary>
        /// Get a brush descriptor
        /// </summary>
        public IBrushDescriptor GetBrushDescriptor(CSequence operands, Matrix matrix, double alpha)
        {
            var gray  = (byte)(int)Math.Round(PdfUtilities.GetDouble(operands[0]) * 255.0);
            var color = Color.FromArgb((byte)(alpha * 255), gray, gray, gray);

            return(new GrayBrushDescriptor(color));
        }
Beispiel #2
0
        /// <summary>
        /// Convert a rendering mode number to an enum value
        /// </summary>
        public static FontRenderingMode GetRenderingMode(CObject number)
        {
            var mode = (int)PdfUtilities.GetDouble(number);
            FontRenderingMode fontRenderingMode = FontRenderingMode.Unknown;

            switch (mode)
            {
            case 0:
                fontRenderingMode = FontRenderingMode.Fill;
                break;

            case 1:
                fontRenderingMode = FontRenderingMode.Stroke;
                break;

            case 2:
                fontRenderingMode = FontRenderingMode.FillAndStroke;
                break;

            default:
                fontRenderingMode = FontRenderingMode.Fill;
                break;
            }

            return(fontRenderingMode);
        }
Beispiel #3
0
        /// <summary>
        /// Get a matrix out of a sequence fof operands
        /// </summary>
        public static Matrix GetMatrix(CSequence operands)
        {
            var matrix = new Matrix(PdfUtilities.GetDouble(operands[0]),
                                    PdfUtilities.GetDouble(operands[1]),
                                    PdfUtilities.GetDouble(operands[2]),
                                    PdfUtilities.GetDouble(operands[3]),
                                    PdfUtilities.GetDouble(operands[4]),
                                    PdfUtilities.GetDouble(operands[5]));

            return(matrix);
        }
Beispiel #4
0
        /// <summary>
        /// Get a brush descriptor
        /// </summary>
        public IBrushDescriptor GetBrushDescriptor(CSequence operands, Matrix matrix, double alpha)
        {
            float[] colorValues = new float[numberColorComponents];

            for (int i = 0; i < numberColorComponents; i++)
            {
                colorValues[i] = (float)PdfUtilities.GetDouble(operands[i]);
            }

            Color color = Color.FromAValues((float)alpha, colorValues, GetProfileUri());

            return(new ICCBasedBrushDescriptor(color));
        }