INTEGRATION: CWS presfixes03 (1.5.2); FILE MERGED

2005/04/01 16:09:44 thb 1.5.2.1: #i36190#, #i39245# Changed uno::Sequence::operator[] for nonconst sequences to use naked ptr; added support for true bezier polygons (and removed subdivision, where it was added because of that canvas deficiency); overhauled mtf renderer to provide faithful bounds also for subsetted meta files
This commit is contained in:
Oliver Bolte
2005-04-18 09:00:40 +00:00
parent 0bdca39b52
commit 3ef19d3e06
3 changed files with 153 additions and 6 deletions

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: mtftools.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: rt $ $Date: 2005-03-30 08:30:28 $
* last change: $Author: obo $ $Date: 2005-04-18 09:59:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -557,6 +557,21 @@ namespace cppcanvas
return aTextLinesPolyPoly;
}
::basegfx::B2DRange calcDevicePixelBounds( const ::basegfx::B2DRange& rBounds,
const rendering::ViewState& viewState,
const rendering::RenderState& renderState )
{
::basegfx::B2DHomMatrix aTransform;
::canvas::tools::mergeViewAndRenderTransform( aTransform,
viewState,
renderState );
::basegfx::B2DRange aTransformedBounds;
return ::canvas::tools::calcTransformedRectBounds( aTransformedBounds,
rBounds,
aTransform );
}
// create line actions for text such as underline and
// strikeout
::basegfx::B2DPolyPolygon createTextLinesPolyPolygon( const double& rStartOffset,

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: pointaction.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: rt $ $Date: 2005-03-30 08:31:08 $
* last change: $Author: obo $ $Date: 2005-04-18 10:00:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,6 +77,9 @@
#include <vcl/canvastools.hxx>
#endif
#ifndef _BGFX_RANGE_B2DRANGE_HXX
#include <basegfx/range/b2drange.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
@@ -112,6 +115,10 @@ namespace cppcanvas
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
const Subset& rSubset ) const;
virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const;
virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation,
const Subset& rSubset ) const;
virtual sal_Int32 getActionCount() const;
private:
@@ -175,6 +182,31 @@ namespace cppcanvas
return render( rTransformation );
}
::basegfx::B2DRange PointAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const
{
rendering::RenderState aLocalState( maState );
::canvas::tools::prependToRenderState(aLocalState, rTransformation);
return tools::calcDevicePixelBounds( ::basegfx::B2DRange( maPoint.X()-1,
maPoint.Y()-1,
maPoint.X()+1,
maPoint.Y()+1 ),
mpCanvas->getViewState(),
aLocalState );
}
::basegfx::B2DRange PointAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation,
const Subset& rSubset ) const
{
// point only contains a single action, empty bounds
// if subset requests different range
if( rSubset.mnSubsetBegin != 0 ||
rSubset.mnSubsetEnd != 1 )
return ::basegfx::B2DRange();
return getBounds( rTransformation );
}
sal_Int32 PointAction::getActionCount() const
{
return 1;

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: polypolyaction.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: rt $ $Date: 2005-03-30 08:31:32 $
* last change: $Author: obo $ $Date: 2005-04-18 10:00:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,6 +80,9 @@
#include <vcl/canvastools.hxx>
#endif
#ifndef _BGFX_RANGE_B2DRANGE_HXX
#include <basegfx/range/b2drange.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
@@ -119,10 +122,15 @@ namespace cppcanvas
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
const Subset& rSubset ) const;
virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const;
virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation,
const Subset& rSubset ) const;
virtual sal_Int32 getActionCount() const;
private:
const uno::Reference< rendering::XPolyPolygon2D > mxPolyPoly;
const ::Rectangle maBounds;
const CanvasSharedPtr mpCanvas;
// stroke color is now implicit: the maState.DeviceColor member
@@ -138,6 +146,7 @@ namespace cppcanvas
bool bStroke ) :
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
rPolyPoly ) ),
maBounds( rPolyPoly.GetBoundRect() ),
mpCanvas( rCanvas ),
maState(),
maFillColor()
@@ -159,6 +168,7 @@ namespace cppcanvas
int nTransparency ) :
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
rPolyPoly ) ),
maBounds( rPolyPoly.GetBoundRect() ),
mpCanvas( rCanvas ),
maState(),
maFillColor()
@@ -253,6 +263,32 @@ namespace cppcanvas
return render( rTransformation );
}
::basegfx::B2DRange PolyPolyAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const
{
rendering::RenderState aLocalState( maState );
::canvas::tools::prependToRenderState(aLocalState, rTransformation);
return tools::calcDevicePixelBounds(
::vcl::unotools::b2DRectangleFromRectangle( maBounds ),
mpCanvas->getViewState(),
aLocalState );
}
::basegfx::B2DRange PolyPolyAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation,
const Subset& rSubset ) const
{
// TODO(F1): Split up poly-polygon into polygons, or even
// line segments, when subsets are requested.
// polygon only contains a single action, empty bounds
// if subset requests different range
if( rSubset.mnSubsetBegin != 0 ||
rSubset.mnSubsetEnd != 1 )
return ::basegfx::B2DRange();
return getBounds( rTransformation );
}
sal_Int32 PolyPolyAction::getActionCount() const
{
// TODO(F1): Split up poly-polygon into polygons, or even
@@ -275,10 +311,15 @@ namespace cppcanvas
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
const Subset& rSubset ) const;
virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const;
virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation,
const Subset& rSubset ) const;
virtual sal_Int32 getActionCount() const;
private:
const uno::Reference< rendering::XPolyPolygon2D > mxPolyPoly;
const ::Rectangle maBounds;
const CanvasSharedPtr mpCanvas;
// stroke color is now implicit: the maState.DeviceColor member
@@ -292,6 +333,7 @@ namespace cppcanvas
const rendering::Texture& rTexture ) :
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
rPolyPoly ) ),
maBounds( rPolyPoly.GetBoundRect() ),
mpCanvas( rCanvas ),
maState(),
maTexture( rTexture )
@@ -332,6 +374,32 @@ namespace cppcanvas
return render( rTransformation );
}
::basegfx::B2DRange TexturedPolyPolyAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const
{
rendering::RenderState aLocalState( maState );
::canvas::tools::prependToRenderState(aLocalState, rTransformation);
return tools::calcDevicePixelBounds(
::vcl::unotools::b2DRectangleFromRectangle( maBounds ),
mpCanvas->getViewState(),
aLocalState );
}
::basegfx::B2DRange TexturedPolyPolyAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation,
const Subset& rSubset ) const
{
// TODO(F1): Split up poly-polygon into polygons, or even
// line segments, when subsets are requested.
// polygon only contains a single action, empty bounds
// if subset requests different range
if( rSubset.mnSubsetBegin != 0 ||
rSubset.mnSubsetEnd != 1 )
return ::basegfx::B2DRange();
return getBounds( rTransformation );
}
sal_Int32 TexturedPolyPolyAction::getActionCount() const
{
// TODO(F1): Split up poly-polygon into polygons, or even
@@ -353,10 +421,15 @@ namespace cppcanvas
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
const Subset& rSubset ) const;
virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const;
virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation,
const Subset& rSubset ) const;
virtual sal_Int32 getActionCount() const;
private:
const uno::Reference< rendering::XPolyPolygon2D > mxPolyPoly;
const ::Rectangle maBounds;
const CanvasSharedPtr mpCanvas;
rendering::RenderState maState;
const rendering::StrokeAttributes maStrokeAttributes;
@@ -368,6 +441,7 @@ namespace cppcanvas
const rendering::StrokeAttributes& rStrokeAttributes ) :
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
rPolyPoly ) ),
maBounds( rPolyPoly.GetBoundRect() ),
mpCanvas( rCanvas ),
maState(),
maStrokeAttributes( rStrokeAttributes )
@@ -406,6 +480,32 @@ namespace cppcanvas
return render( rTransformation );
}
::basegfx::B2DRange StrokedPolyPolyAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const
{
rendering::RenderState aLocalState( maState );
::canvas::tools::prependToRenderState(aLocalState, rTransformation);
return tools::calcDevicePixelBounds(
::vcl::unotools::b2DRectangleFromRectangle( maBounds ),
mpCanvas->getViewState(),
aLocalState );
}
::basegfx::B2DRange StrokedPolyPolyAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation,
const Subset& rSubset ) const
{
// TODO(F1): Split up poly-polygon into polygons, or even
// line segments, when subsets are requested.
// polygon only contains a single action, empty bounds
// if subset requests different range
if( rSubset.mnSubsetBegin != 0 ||
rSubset.mnSubsetEnd != 1 )
return ::basegfx::B2DRange();
return getBounds( rTransformation );
}
sal_Int32 StrokedPolyPolyAction::getActionCount() const
{
// TODO(F1): Split up poly-polygon into polygons, or even