Exemple #1
0
        public void SetTransformationMatrix(PDFTransformationMatrix matrix, bool appliesToText, bool appliesToDrawing)
        {
            float[] all = matrix.Components;
            if (all.Length != Matrix2DTransformationLength)
            {
                throw new IndexOutOfRangeException("A 2D transformation matrix can only have 6 values");
            }

            if (appliesToDrawing)
            {
                for (int i = 0; i < Matrix2DTransformationLength; i++)
                {
                    this.Writer.WriteRealS(all[i]);
                }

                this.Writer.WriteOpCodeS(PDFOpCode.GraphTransformMatrix);
            }

            if (appliesToText)
            {
                for (int i = 0; i < Matrix2DTransformationLength; i++)
                {
                    this.Writer.WriteRealS(all[i]);
                }

                this.Writer.WriteOpCodeS(PDFOpCode.TxtTransformMatrix);
            }
        }
Exemple #2
0
        //
        // calculations
        //

        public static PDFTransformationMatrix Multiply(PDFTransformationMatrix one, PDFTransformationMatrix two)
        {
            if (null == one)
            {
                throw new ArgumentNullException("one");
            }
            if (null == two)
            {
                throw new ArgumentNullException("two");
            }

            one = new PDFTransformationMatrix(one._matrix.Clone());
            one._matrix.Multiply(two._matrix);

            return(one);
        }