INTEGRATION: CWS presfixes03 (1.5.2); FILE MERGED
2005/04/12 03:21:23 thb 1.5.2.2: #i44807# Added preliminary version for VCL canvas transformed sprites (taking the slow Set/GetPixel affine transformater from impltools for the time being) 2005/04/01 15:48:09 thb 1.5.2.1: #i36190#, #i37793#, #i39245#, #i46023# Fixes for open/close polygon stroking; beefed up the canvas tools; moved try/catch block around configuration in cf_factory (to facilitate canvasdemo with broken/incomplete services.rdb; enhanced TextLayout to cope with new Action::getBounds() functionality in cppcanvas (needed for proper mtf bounds calculation); removed extra pixel right and bottom for filled polygons; avoiding uno::Sequence::operator[] for non-const cases, but using the naked mem ptr instead (performance)
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: impltools.cxx,v $
|
* $RCSfile: impltools.cxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.5 $
|
* $Revision: 1.6 $
|
||||||
*
|
*
|
||||||
* last change: $Author: rt $ $Date: 2005-03-30 07:37:42 $
|
* last change: $Author: obo $ $Date: 2005-04-18 09:11:25 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -158,25 +158,49 @@ namespace vclcanvas
|
|||||||
{
|
{
|
||||||
::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly )
|
::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly )
|
||||||
{
|
{
|
||||||
uno::Reference< lang::XServiceInfo > xRef( xPoly,
|
LinePolyPolygon* pPolyImpl = dynamic_cast< LinePolyPolygon* >( xPoly.get() );
|
||||||
uno::UNO_QUERY );
|
|
||||||
|
|
||||||
if( xRef.is() &&
|
if( pPolyImpl )
|
||||||
xRef->getImplementationName().equals( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(LINEPOLYPOLYGON_IMPLEMENTATION_NAME))) )
|
|
||||||
{
|
{
|
||||||
// TODO(Q1): Maybe use dynamic_cast here
|
return pPolyImpl->getPolyPolygon();
|
||||||
|
|
||||||
// TODO(F1): Provide true beziers here!
|
|
||||||
return static_cast<LinePolyPolygon*>(xPoly.get())->getPolyPolygon();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO(F1): extract points from polygon interface
|
const sal_Int32 nPolys( xPoly->getNumberOfPolygons() );
|
||||||
ENSURE_AND_THROW( false,
|
|
||||||
"polyPolygonFromXPolyPolygon2D(): could not extract points" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return ::basegfx::B2DPolyPolygon();
|
// not a known implementation object - try data source
|
||||||
|
// interfaces
|
||||||
|
uno::Reference< rendering::XBezierPolyPolygon2D > xBezierPoly(
|
||||||
|
xPoly,
|
||||||
|
uno::UNO_QUERY );
|
||||||
|
|
||||||
|
if( xBezierPoly.is() )
|
||||||
|
{
|
||||||
|
return ::basegfx::unotools::polyPolygonFromBezier2DSequenceSequence(
|
||||||
|
xBezierPoly->getBezierSegments( 0,
|
||||||
|
nPolys,
|
||||||
|
0,
|
||||||
|
-1 ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uno::Reference< rendering::XLinePolyPolygon2D > xLinePoly(
|
||||||
|
xPoly,
|
||||||
|
uno::UNO_QUERY );
|
||||||
|
|
||||||
|
// no implementation class and no data provider
|
||||||
|
// found - contract violation.
|
||||||
|
CHECK_AND_THROW( xLinePoly.is(),
|
||||||
|
"VCLCanvas::polyPolygonFromXPolyPolygon2D(): Invalid input "
|
||||||
|
"poly-polygon, cannot retrieve vertex data" );
|
||||||
|
|
||||||
|
return ::basegfx::unotools::polyPolygonFromPoint2DSequenceSequence(
|
||||||
|
xLinePoly->getPoints( 0,
|
||||||
|
nPolys,
|
||||||
|
0,
|
||||||
|
-1 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::BitmapEx bitmapExFromXBitmap( const uno::Reference< rendering::XBitmap >& xBitmap )
|
::BitmapEx bitmapExFromXBitmap( const uno::Reference< rendering::XBitmap >& xBitmap )
|
||||||
@@ -372,11 +396,11 @@ namespace vclcanvas
|
|||||||
bool bCopyBack( false );
|
bool bCopyBack( false );
|
||||||
|
|
||||||
// calc effective transformation for bitmap
|
// calc effective transformation for bitmap
|
||||||
|
const ::basegfx::B2DRectangle aSrcRect( 0, 0,
|
||||||
|
aBmpSize.Width(),
|
||||||
|
aBmpSize.Height() );
|
||||||
::canvas::tools::calcTransformedRectBounds( aDestRect,
|
::canvas::tools::calcTransformedRectBounds( aDestRect,
|
||||||
::basegfx::B2DRectangle(0,
|
aSrcRect,
|
||||||
0,
|
|
||||||
aBmpSize.Width(),
|
|
||||||
aBmpSize.Height()),
|
|
||||||
rTransform );
|
rTransform );
|
||||||
|
|
||||||
// re-center bitmap, such that it's left, top border is
|
// re-center bitmap, such that it's left, top border is
|
||||||
@@ -385,7 +409,7 @@ namespace vclcanvas
|
|||||||
// this rectangle unscaled to the origin.
|
// this rectangle unscaled to the origin.
|
||||||
::basegfx::B2DHomMatrix aLocalTransform;
|
::basegfx::B2DHomMatrix aLocalTransform;
|
||||||
::canvas::tools::calcRectToOriginTransform( aLocalTransform,
|
::canvas::tools::calcRectToOriginTransform( aLocalTransform,
|
||||||
aDestRect,
|
aSrcRect,
|
||||||
rTransform );
|
rTransform );
|
||||||
|
|
||||||
const bool bModulateColors( eModulationMode == MODULATE_WITH_DEVICECOLOR &&
|
const bool bModulateColors( eModulationMode == MODULATE_WITH_DEVICECOLOR &&
|
||||||
@@ -451,8 +475,8 @@ namespace vclcanvas
|
|||||||
}
|
}
|
||||||
// else: mapping table is not used
|
// else: mapping table is not used
|
||||||
|
|
||||||
const Size aDestBmpSize( ::basegfx::fround( aDestRect.getMaxX() ),
|
const Size aDestBmpSize( ::basegfx::fround( aDestRect.getWidth() ),
|
||||||
::basegfx::fround( aDestRect.getMaxY() ) );
|
::basegfx::fround( aDestRect.getHeight() ) );
|
||||||
|
|
||||||
if( aDestBmpSize.Width() == 0 || aDestBmpSize.Height() == 0 )
|
if( aDestBmpSize.Width() == 0 || aDestBmpSize.Height() == 0 )
|
||||||
return BitmapEx();
|
return BitmapEx();
|
||||||
@@ -479,7 +503,7 @@ namespace vclcanvas
|
|||||||
// we're doing inverse mapping here, i.e. mapping
|
// we're doing inverse mapping here, i.e. mapping
|
||||||
// points from the destination bitmap back to the
|
// points from the destination bitmap back to the
|
||||||
// source
|
// source
|
||||||
::basegfx::B2DHomMatrix aTransform( rTransform );
|
::basegfx::B2DHomMatrix aTransform( aLocalTransform );
|
||||||
aTransform.invert();
|
aTransform.invert();
|
||||||
|
|
||||||
// for the time being, always read as ARGB
|
// for the time being, always read as ARGB
|
||||||
|
Reference in New Issue
Block a user