Пример #1
0
        /// <summary>
        /// Converts the
        /// <see cref="Transform"/>
        /// instance, i.e. the list of
        /// <see cref="SingleTransform"/>
        /// instances,
        /// to the equivalent
        /// <see cref="iText.Kernel.Geom.AffineTransform"/>
        /// instance relatively to the available area,
        /// including resolving of percent values to point values.
        /// </summary>
        /// <param name="t">
        /// a
        /// <see cref="Transform"/>
        /// instance to convert
        /// </param>
        /// <param name="width">the width of available area, the point value of which is equivalent to 100% for percentage resolving
        ///     </param>
        /// <param name="height">the height of available area, the point value of which is equivalent to 100% for percentage resolving
        ///     </param>
        public static AffineTransform GetAffineTransform(iText.Layout.Properties.Transform t, float width, float height
                                                         )
        {
            IList <Transform.SingleTransform> multipleTransform = t.GetMultipleTransform();
            AffineTransform affineTransform = new AffineTransform();

            for (int k = multipleTransform.Count - 1; k >= 0; k--)
            {
                Transform.SingleTransform transform = multipleTransform[k];
                float[] floats = new float[6];
                for (int i = 0; i < 4; i++)
                {
                    floats[i] = transform.GetFloats()[i];
                }
                for (int i = 4; i < 6; i++)
                {
                    floats[i] = transform.GetUnitValues()[i - 4].GetUnitType() == UnitValue.POINT ? transform.GetUnitValues()[
                        i - 4].GetValue() : transform.GetUnitValues()[i - 4].GetValue() / 100 * (i == 4 ? width : height);
                }
                affineTransform.PreConcatenate(new AffineTransform(floats));
            }
            return(affineTransform);
        }
Пример #2
0
 public virtual void PreConcetenateTransform(AffineTransform modTransform)
 {
     Usr2dev.PreConcatenate(modTransform);
 }