2017-06-12 8 views
0

したがって、PDF出力で画像操作を行うためにTCPDFを使用しています。TCPDF同じ変換内でRectポリゴンを使用して回転およびクリップする

私は画像(回転する必要があります)とRectポリゴンに基づくクリッピングマスクです。

私が直面している問題は、画像を回転する変換を行うと、クリッピングを行うために使用しているRectポリゴンも回転していることです。

ローテーションの最初のStopTransformが実行された後で、イメージを回転してからクリッピングする方法はありますか?

はここにいくつかのサンプルコードです:

上記で今
PDF::setXY($x, $y); 
PDF::StartTransform(); 
PDF::Rotate($objectImageRotation * -1); 
PDF::Rect($rectx, $recty, $rectwidth, $rectheight, 'CNZ'); 
PDF::Image($objectImageSrc, $x, $y, $width, $height, '', '', '', true, 300, '', false, false, ($objectBorderWidth > 0 ? 1 : 0), false, false, false); 
PDF::StopTransform(); 

、$ rectx、$ recty、$ rectwidthと私は彼らがなりたい場所を正確にある$ rectheight。

答えて

0

多くの実験の後、実際の回転を行う前に 'Rect'を投稿することが私の要件の鍵であることが分かりました。

は、したがって、上記の与えられた、以下の変更が私の仕事:

' Translate to a new XY coordinate in preparation for the placement of the image 
PDF::setXY($x, $y); 

    ' Start the transformation including the clipping according to the given shape and then rotating as per the rotation parameter 
PDF::StartTransform(); 

    ' Clipping Rectangle 
PDF::Rect($rectx, $recty, $rectwidth, $rectheight, 'CNZ'); 

    ' Rotate 
PDF::Rotate($objectImageRotation * -1); 

    ' Place the image at the set rotation 
PDF::Image($objectImageSrc, $x, $y, $width, $height, '', '', '', true, 300, '', false, false, ($objectBorderWidth > 0 ? 1 : 0), false, false, false); 

    ' Stop the transformation (reset) 
PDF::StopTransform(); 
関連する問題