INTEGRATION: CWS thbpp6 (1.9.14); FILE MERGED

2006/12/21 17:20:54 thb 1.9.14.1: #121806# Now keeping full precision of the mtf logic coordinates across mtf->XCanvas conversion
This commit is contained in:
Oliver Bolte
2007-01-22 10:52:02 +00:00
parent ec9a6f8d94
commit 7eb13e2293
2 changed files with 53 additions and 50 deletions

View File

@@ -4,9 +4,9 @@
* *
* $RCSfile: pointaction.cxx,v $ * $RCSfile: pointaction.cxx,v $
* *
* $Revision: 1.9 $ * $Revision: 1.10 $
* *
* last change: $Author: obo $ $Date: 2006-09-17 12:49:51 $ * last change: $Author: obo $ $Date: 2007-01-22 11:51:02 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
@@ -43,6 +43,7 @@
#include <vcl/canvastools.hxx> #include <vcl/canvastools.hxx>
#include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2drange.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/tools/canvastools.hxx> #include <basegfx/tools/canvastools.hxx>
#include <canvas/canvastools.hxx> #include <canvas/canvastools.hxx>
@@ -65,10 +66,10 @@ namespace cppcanvas
class PointAction : public Action, private ::boost::noncopyable class PointAction : public Action, private ::boost::noncopyable
{ {
public: public:
PointAction( const ::Point&, PointAction( const ::basegfx::B2DPoint&,
const CanvasSharedPtr&, const CanvasSharedPtr&,
const OutDevState& ); const OutDevState& );
PointAction( const ::Point&, PointAction( const ::basegfx::B2DPoint&,
const CanvasSharedPtr&, const CanvasSharedPtr&,
const OutDevState&, const OutDevState&,
const ::Color& ); const ::Color& );
@@ -88,12 +89,12 @@ namespace cppcanvas
PointAction(const PointAction&); PointAction(const PointAction&);
PointAction& operator = ( const PointAction& ); PointAction& operator = ( const PointAction& );
::Point maPoint; ::basegfx::B2DPoint maPoint;
CanvasSharedPtr mpCanvas; CanvasSharedPtr mpCanvas;
::com::sun::star::rendering::RenderState maState; ::com::sun::star::rendering::RenderState maState;
}; };
PointAction::PointAction( const ::Point& rPoint, PointAction::PointAction( const ::basegfx::B2DPoint& rPoint,
const CanvasSharedPtr& rCanvas, const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) : const OutDevState& rState ) :
maPoint( rPoint ), maPoint( rPoint ),
@@ -104,7 +105,7 @@ namespace cppcanvas
maState.DeviceColor = rState.lineColor; maState.DeviceColor = rState.lineColor;
} }
PointAction::PointAction( const ::Point& rPoint, PointAction::PointAction( const ::basegfx::B2DPoint& rPoint,
const CanvasSharedPtr& rCanvas, const CanvasSharedPtr& rCanvas,
const OutDevState& rState, const OutDevState& rState,
const ::Color& rAltColor ) : const ::Color& rAltColor ) :
@@ -125,7 +126,7 @@ namespace cppcanvas
rendering::RenderState aLocalState( maState ); rendering::RenderState aLocalState( maState );
::canvas::tools::prependToRenderState(aLocalState, rTransformation); ::canvas::tools::prependToRenderState(aLocalState, rTransformation);
mpCanvas->getUNOCanvas()->drawPoint( ::vcl::unotools::point2DFromPoint(maPoint), mpCanvas->getUNOCanvas()->drawPoint( ::basegfx::unotools::point2DFromB2DPoint(maPoint),
mpCanvas->getViewState(), mpCanvas->getViewState(),
aLocalState ); aLocalState );
@@ -149,10 +150,10 @@ namespace cppcanvas
rendering::RenderState aLocalState( maState ); rendering::RenderState aLocalState( maState );
::canvas::tools::prependToRenderState(aLocalState, rTransformation); ::canvas::tools::prependToRenderState(aLocalState, rTransformation);
return tools::calcDevicePixelBounds( ::basegfx::B2DRange( maPoint.X()-1, return tools::calcDevicePixelBounds( ::basegfx::B2DRange( maPoint.getX()-1,
maPoint.Y()-1, maPoint.getY()-1,
maPoint.X()+1, maPoint.getX()+1,
maPoint.Y()+1 ), maPoint.getY()+1 ),
mpCanvas->getViewState(), mpCanvas->getViewState(),
aLocalState ); aLocalState );
} }
@@ -175,14 +176,14 @@ namespace cppcanvas
} }
} }
ActionSharedPtr PointActionFactory::createPointAction( const ::Point& rPoint, ActionSharedPtr PointActionFactory::createPointAction( const ::basegfx::B2DPoint& rPoint,
const CanvasSharedPtr& rCanvas, const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) const OutDevState& rState )
{ {
return ActionSharedPtr( new PointAction( rPoint, rCanvas, rState ) ); return ActionSharedPtr( new PointAction( rPoint, rCanvas, rState ) );
} }
ActionSharedPtr PointActionFactory::createPointAction( const ::Point& rPoint, ActionSharedPtr PointActionFactory::createPointAction( const ::basegfx::B2DPoint& rPoint,
const CanvasSharedPtr& rCanvas, const CanvasSharedPtr& rCanvas,
const OutDevState& rState, const OutDevState& rState,
const ::Color& rColor ) const ::Color& rColor )

View File

@@ -4,9 +4,9 @@
* *
* $RCSfile: transparencygroupaction.cxx,v $ * $RCSfile: transparencygroupaction.cxx,v $
* *
* $Revision: 1.9 $ * $Revision: 1.10 $
* *
* last change: $Author: obo $ $Date: 2006-09-17 12:50:33 $ * last change: $Author: obo $ $Date: 2007-01-22 11:52:02 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
@@ -61,6 +61,8 @@
#include <canvas/canvastools.hxx> #include <canvas/canvastools.hxx>
#include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2drange.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/vector/b2dsize.hxx>
#include <basegfx/numeric/ftools.hxx> #include <basegfx/numeric/ftools.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/tuple/b2dtuple.hxx> #include <basegfx/tuple/b2dtuple.hxx>
@@ -109,8 +111,8 @@ namespace cppcanvas
*/ */
TransparencyGroupAction( MtfAutoPtr& rGroupMtf, TransparencyGroupAction( MtfAutoPtr& rGroupMtf,
const Renderer::Parameters& rParms, const Renderer::Parameters& rParms,
const ::Point& rDstPoint, const ::basegfx::B2DPoint& rDstPoint,
const ::Size& rDstSize, const ::basegfx::B2DVector& rDstSize,
double nAlpha, double nAlpha,
const CanvasSharedPtr& rCanvas, const CanvasSharedPtr& rCanvas,
const OutDevState& rState ); const OutDevState& rState );
@@ -139,8 +141,8 @@ namespace cppcanvas
TransparencyGroupAction( MtfAutoPtr& rGroupMtf, TransparencyGroupAction( MtfAutoPtr& rGroupMtf,
GradientAutoPtr& rAlphaGradient, GradientAutoPtr& rAlphaGradient,
const Renderer::Parameters& rParms, const Renderer::Parameters& rParms,
const ::Point& rDstPoint, const ::basegfx::B2DPoint& rDstPoint,
const ::Size& rDstSize, const ::basegfx::B2DVector& rDstSize,
const CanvasSharedPtr& rCanvas, const CanvasSharedPtr& rCanvas,
const OutDevState& rState ); const OutDevState& rState );
@@ -160,7 +162,7 @@ namespace cppcanvas
const Renderer::Parameters maParms; const Renderer::Parameters maParms;
const ::Size maDstSize; const ::basegfx::B2DSize maDstSize;
mutable uno::Reference< rendering::XBitmap > mxBufferBitmap; // contains last rendered version mutable uno::Reference< rendering::XBitmap > mxBufferBitmap; // contains last rendered version
mutable ::basegfx::B2DHomMatrix maLastTransformation; // contains last active transformation mutable ::basegfx::B2DHomMatrix maLastTransformation; // contains last active transformation
@@ -179,20 +181,20 @@ namespace cppcanvas
given by src and dst size. given by src and dst size.
*/ */
void implSetupTransform( rendering::RenderState& rRenderState, void implSetupTransform( rendering::RenderState& rRenderState,
const Point& rDstPoint ) const ::basegfx::B2DPoint& rDstPoint )
{ {
::basegfx::B2DHomMatrix aLocalTransformation; ::basegfx::B2DHomMatrix aLocalTransformation;
aLocalTransformation.translate( rDstPoint.X(), aLocalTransformation.translate( rDstPoint.getX(),
rDstPoint.Y() ); rDstPoint.getY() );
::canvas::tools::appendToRenderState( rRenderState, ::canvas::tools::appendToRenderState( rRenderState,
aLocalTransformation ); aLocalTransformation );
} }
TransparencyGroupAction::TransparencyGroupAction( MtfAutoPtr& rGroupMtf, TransparencyGroupAction::TransparencyGroupAction( MtfAutoPtr& rGroupMtf,
const Renderer::Parameters& rParms, const Renderer::Parameters& rParms,
const ::Point& rDstPoint, const ::basegfx::B2DPoint& rDstPoint,
const ::Size& rDstSize, const ::basegfx::B2DVector& rDstSize,
double nAlpha, double nAlpha,
const CanvasSharedPtr& rCanvas, const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) : const OutDevState& rState ) :
@@ -224,8 +226,8 @@ namespace cppcanvas
TransparencyGroupAction::TransparencyGroupAction( MtfAutoPtr& rGroupMtf, TransparencyGroupAction::TransparencyGroupAction( MtfAutoPtr& rGroupMtf,
GradientAutoPtr& rAlphaGradient, GradientAutoPtr& rAlphaGradient,
const Renderer::Parameters& rParms, const Renderer::Parameters& rParms,
const ::Point& rDstPoint, const ::basegfx::B2DPoint& rDstPoint,
const ::Size& rDstSize, const ::basegfx::B2DVector& rDstSize,
const CanvasSharedPtr& rCanvas, const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) : const OutDevState& rState ) :
mpGroupMtf( rGroupMtf ), mpGroupMtf( rGroupMtf ),
@@ -309,12 +311,12 @@ namespace cppcanvas
} }
// output size of metafile // output size of metafile
::Size aOutputSizePixel( ::basegfx::fround( aScale.getX() * maDstSize.Width() ), ::Size aOutputSizePixel( ::basegfx::fround( aScale.getX() * maDstSize.getX() ),
::basegfx::fround( aScale.getY() * maDstSize.Height() ) ); ::basegfx::fround( aScale.getY() * maDstSize.getY() ) );
// pixel size of cache bitmap: round up to nearest int // pixel size of cache bitmap: round up to nearest int
::Size aBitmapSizePixel( static_cast<sal_Int32>( aScale.getX() * maDstSize.Width() )+1, ::Size aBitmapSizePixel( static_cast<sal_Int32>( aScale.getX() * maDstSize.getX() )+1,
static_cast<sal_Int32>( aScale.getY() * maDstSize.Height() )+1 ); static_cast<sal_Int32>( aScale.getY() * maDstSize.getY() )+1 );
::Point aEmptyPoint; ::Point aEmptyPoint;
@@ -459,8 +461,8 @@ namespace cppcanvas
::basegfx::unotools::b2ISizeFromIntegerSize2D( mxBufferBitmap->getSize() ) ); ::basegfx::unotools::b2ISizeFromIntegerSize2D( mxBufferBitmap->getSize() ) );
::basegfx::B2DHomMatrix aScaleCorrection; ::basegfx::B2DHomMatrix aScaleCorrection;
aScaleCorrection.scale( (double)maDstSize.Width() / aBmpSize.getX(), aScaleCorrection.scale( (double)maDstSize.getX() / aBmpSize.getX(),
(double)maDstSize.Height() / aBmpSize.getY() ); (double)maDstSize.getY() / aBmpSize.getY() );
aTransform = aTransform * aScaleCorrection; aTransform = aTransform * aScaleCorrection;
rendering::RenderState aLocalState( maState ); rendering::RenderState aLocalState( maState );
@@ -525,8 +527,8 @@ namespace cppcanvas
return tools::calcDevicePixelBounds( return tools::calcDevicePixelBounds(
::basegfx::B2DRange( 0,0, ::basegfx::B2DRange( 0,0,
maDstSize.Width(), maDstSize.getX(),
maDstSize.Height() ), maDstSize.getY() ),
mpCanvas->getViewState(), mpCanvas->getViewState(),
aLocalState ); aLocalState );
} }
@@ -557,8 +559,8 @@ namespace cppcanvas
ActionSharedPtr TransparencyGroupActionFactory::createTransparencyGroupAction( MtfAutoPtr& rGroupMtf, ActionSharedPtr TransparencyGroupActionFactory::createTransparencyGroupAction( MtfAutoPtr& rGroupMtf,
const Renderer::Parameters& rParms, const Renderer::Parameters& rParms,
const ::Point& rDstPoint, const ::basegfx::B2DPoint& rDstPoint,
const ::Size& rDstSize, const ::basegfx::B2DVector& rDstSize,
double nAlpha, double nAlpha,
const CanvasSharedPtr& rCanvas, const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) const OutDevState& rState )
@@ -575,8 +577,8 @@ namespace cppcanvas
ActionSharedPtr TransparencyGroupActionFactory::createTransparencyGroupAction( MtfAutoPtr& rGroupMtf, ActionSharedPtr TransparencyGroupActionFactory::createTransparencyGroupAction( MtfAutoPtr& rGroupMtf,
GradientAutoPtr& rAlphaGradient, GradientAutoPtr& rAlphaGradient,
const Renderer::Parameters& rParms, const Renderer::Parameters& rParms,
const ::Point& rDstPoint, const ::basegfx::B2DPoint& rDstPoint,
const ::Size& rDstSize, const ::basegfx::B2DVector& rDstSize,
const CanvasSharedPtr& rCanvas, const CanvasSharedPtr& rCanvas,
const OutDevState& rState ) const OutDevState& rState )
{ {