@@ -691,7 +691,7 @@ protected internal virtual bool ClipBackgroundArea(DrawContext drawContext, Rect
691691 public virtual void DrawChildren ( DrawContext drawContext ) {
692692 IList < IRenderer > waitingRenderers = new List < IRenderer > ( ) ;
693693 foreach ( IRenderer child in childRenderers ) {
694- if ( FloatingHelper . IsRendererFloating ( child ) || child . GetProperty ( Property . TRANSFORM ) != null ) {
694+ if ( FloatingHelper . IsRendererFloating ( child ) || child . GetProperty < String [ ] > ( Property . TRANSFORM ) != null ) {
695695 RootRenderer rootRenderer = GetRootRenderer ( ) ;
696696 if ( rootRenderer != null && ! rootRenderer . waitingDrawingElements . Contains ( child ) ) {
697697 rootRenderer . waitingDrawingElements . Add ( child ) ;
@@ -1509,7 +1509,7 @@ protected internal virtual Rectangle CalculateAbsolutePdfBBox() {
15091509 TransformPoints ( contentBoxPoints , rotationTransform ) ;
15101510 }
15111511 }
1512- float [ ] transform = renderer . GetProperty < float [ ] > ( Property . TRANSFORM ) ;
1512+ String [ ] transform = renderer . GetProperty < String [ ] > ( Property . TRANSFORM ) ;
15131513 if ( transform != null ) {
15141514 if ( renderer is BlockRenderer ) {
15151515 BlockRenderer blockRenderer = ( BlockRenderer ) renderer ;
@@ -1846,24 +1846,45 @@ protected internal virtual AffineTransform CreateTransformationInsideOccupiedAre
18461846 float width = backgroundArea . GetWidth ( ) ;
18471847 AffineTransform transform = AffineTransform . GetTranslateInstance ( - 1 * ( x + width / 2 ) , - 1 * ( y + height /
18481848 2 ) ) ;
1849- transform . PreConcatenate ( ( new AffineTransform ( ( float [ ] ) this . GetProperty ( Property . TRANSFORM ) ) ) ) ;
1849+ transform . PreConcatenate ( new AffineTransform ( this . GetCssTransformMatrix ( width , height ) ) ) ;
18501850 transform . PreConcatenate ( AffineTransform . GetTranslateInstance ( x + width / 2 , y + height / 2 ) ) ;
18511851 return transform ;
18521852 }
18531853
18541854 protected internal virtual void BeginTranformationIfApplied ( PdfCanvas canvas ) {
1855- if ( this . GetProperty ( Property . TRANSFORM ) != null ) {
1855+ if ( this . GetProperty < String [ ] > ( Property . TRANSFORM ) != null ) {
18561856 AffineTransform transform = CreateTransformationInsideOccupiedArea ( ) ;
18571857 canvas . SaveState ( ) . ConcatMatrix ( transform ) ;
18581858 }
18591859 }
18601860
18611861 protected internal virtual void EndTranformationIfApplied ( PdfCanvas canvas ) {
1862- if ( this . GetProperty ( Property . TRANSFORM ) != null ) {
1862+ if ( this . GetProperty < String [ ] > ( Property . TRANSFORM ) != null ) {
18631863 canvas . RestoreState ( ) ;
18641864 }
18651865 }
18661866
1867+ private float [ ] GetCssTransformMatrix ( float width , float height ) {
1868+ String [ ] strings = this . GetProperty < String [ ] > ( Property . TRANSFORM ) ;
1869+ float [ ] floats = new float [ 6 ] ;
1870+ for ( int i = 0 ; i < 6 ; i ++ ) {
1871+ if ( i == 4 || i == 5 ) {
1872+ int indexOfPercent = strings [ i ] . IndexOf ( '%' ) ;
1873+ if ( indexOfPercent > 0 ) {
1874+ floats [ i ] = float . Parse ( strings [ i ] . JSubstring ( 0 , indexOfPercent ) , System . Globalization . CultureInfo . InvariantCulture
1875+ ) / 100 * ( i == 4 ? width : height ) ;
1876+ }
1877+ else {
1878+ floats [ i ] = float . Parse ( strings [ i ] , System . Globalization . CultureInfo . InvariantCulture ) ;
1879+ }
1880+ }
1881+ else {
1882+ floats [ i ] = float . Parse ( strings [ i ] , System . Globalization . CultureInfo . InvariantCulture ) ;
1883+ }
1884+ }
1885+ return floats ;
1886+ }
1887+
18671888 public abstract IRenderer GetNextRenderer ( ) ;
18681889
18691890 public abstract LayoutResult Layout ( LayoutContext arg1 ) ;
0 commit comments