INTEGRATION: CWS canvas02 (1.10.2); FILE MERGED
2005/10/31 22:21:55 thb 1.10.2.9: #i48939# Of course, the middle actions don't get NO subset - they are fully included. 2005/10/29 23:29:49 thb 1.10.2.8: #i48939# Corrected STL loop over all subset actions for bounds query: of course, it's wrong to only get the subsetted bounds only for first and last action, and the unsubsetted bounds for the middle ones; no clipping the calculated unit bounds against the unit rect, to avoid pathological cases, where a metafile extends beyond the shape bounds 2005/10/28 13:55:56 thb 1.10.2.7: #i54035# Corrected wrong copy'n'paste from outdev3.cxx (black text actually changes the _text color_ not the relief color) 2005/10/17 15:49:20 thb 1.10.2.6: #i54035# Corrected emboss/relief mode (reversed semantics of emboss and relief, and painted relief shadow behing normal text now) 2005/10/17 12:36:41 thb 1.10.2.5: RESYNC: (1.12-1.13); FILE MERGED 2005/10/14 11:47:37 thb 1.10.2.4: #i51362# Misunderstood semantic of OutDev::DrawMask() - mask color is actually a uniform color that shows through the mask. Fixed. 2005/10/09 09:11:41 thb 1.10.2.3: RESYNC: (1.10-1.12); FILE MERGED 2005/08/19 11:11:21 thb 1.10.2.2: #i53538# Changed clip setting to use basegfx polygon (cppcanvas::PolyPolygon contains reference back to canvas); changed direct access to base class member to getter method, thus, providing the actual XCanvas clip polygon lazily. 2005/07/13 14:22:53 thb 1.10.2.1: #i51362# Implemented TEXTRECT action
This commit is contained in:
@@ -4,9 +4,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: implrenderer.cxx,v $
|
* $RCSfile: implrenderer.cxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.13 $
|
* $Revision: 1.14 $
|
||||||
*
|
*
|
||||||
* last change: $Author: obo $ $Date: 2005-10-11 09:03:07 $
|
* last change: $Author: kz $ $Date: 2005-11-02 13:40:15 $
|
||||||
*
|
*
|
||||||
* 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.
|
||||||
@@ -84,6 +84,7 @@
|
|||||||
#ifndef _VCL_CANVASTOOLS_HXX
|
#ifndef _VCL_CANVASTOOLS_HXX
|
||||||
#include <vcl/canvastools.hxx>
|
#include <vcl/canvastools.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
#include <vcl/salbtype.hxx>
|
||||||
|
|
||||||
#include <implrenderer.hxx>
|
#include <implrenderer.hxx>
|
||||||
#include <tools.hxx>
|
#include <tools.hxx>
|
||||||
@@ -103,8 +104,6 @@
|
|||||||
|
|
||||||
#include <boost/scoped_array.hpp>
|
#include <boost/scoped_array.hpp>
|
||||||
|
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
|
|
||||||
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
|
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
|
||||||
#include <com/sun/star/uno/Sequence.hxx>
|
#include <com/sun/star/uno/Sequence.hxx>
|
||||||
#endif
|
#endif
|
||||||
@@ -389,6 +388,26 @@ namespace
|
|||||||
rStates.pop_back();
|
rStates.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create masked BitmapEx, where the white areas of rBitmap are
|
||||||
|
transparent, and the other appear in rMaskColor.
|
||||||
|
*/
|
||||||
|
BitmapEx createMaskBmpEx( const Bitmap& rBitmap,
|
||||||
|
const ::Color& rMaskColor )
|
||||||
|
{
|
||||||
|
const ::Color aWhite( COL_WHITE );
|
||||||
|
BitmapPalette aBiLevelPalette(2);
|
||||||
|
aBiLevelPalette[0] = aWhite;
|
||||||
|
aBiLevelPalette[1] = rMaskColor;
|
||||||
|
|
||||||
|
Bitmap aMask( rBitmap.CreateMask( aWhite ));
|
||||||
|
Bitmap aSolid( rBitmap.GetSizePixel(),
|
||||||
|
1,
|
||||||
|
&aBiLevelPalette );
|
||||||
|
aSolid.Erase( rMaskColor );
|
||||||
|
|
||||||
|
return BitmapEx( aSolid, aMask );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -939,17 +958,17 @@ namespace cppcanvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create text effects such as shadow/relief/embossed
|
// create text effects such as shadow/relief/embossed
|
||||||
void ImplRenderer::createTextAction( const ::Point& rStartPoint,
|
void ImplRenderer::createTextAction( const ::Point& rStartPoint,
|
||||||
const String rString,
|
const String rString,
|
||||||
int nIndex,
|
int nIndex,
|
||||||
int nLength,
|
int nLength,
|
||||||
const sal_Int32* pCharWidths,
|
const sal_Int32* pCharWidths,
|
||||||
::VirtualDevice& rVDev,
|
::VirtualDevice& rVDev,
|
||||||
const CanvasSharedPtr& rCanvas,
|
const CanvasSharedPtr& rCanvas,
|
||||||
const VectorOfOutDevStates& rStates,
|
VectorOfOutDevStates& rStates,
|
||||||
const Parameters& rParms,
|
const Parameters& rParms,
|
||||||
bool bSubsettableActions,
|
bool bSubsettableActions,
|
||||||
sal_Int32& io_rCurrActionIndex )
|
sal_Int32& io_rCurrActionIndex )
|
||||||
{
|
{
|
||||||
ENSURE_AND_THROW( nIndex >= 0 && nLength <= rString.Len() + nIndex,
|
ENSURE_AND_THROW( nIndex >= 0 && nLength <= rString.Len() + nIndex,
|
||||||
"ImplRenderer::createTextWithEffectsAction(): Invalid text index" );
|
"ImplRenderer::createTextWithEffectsAction(): Invalid text index" );
|
||||||
@@ -996,7 +1015,7 @@ namespace cppcanvas
|
|||||||
if( nReliefOffset < 1 )
|
if( nReliefOffset < 1 )
|
||||||
nReliefOffset = 1;
|
nReliefOffset = 1;
|
||||||
|
|
||||||
if( rState.textReliefStyle == RELIEF_EMBOSSED )
|
if( rState.textReliefStyle == RELIEF_ENGRAVED )
|
||||||
nReliefOffset = -nReliefOffset;
|
nReliefOffset = -nReliefOffset;
|
||||||
|
|
||||||
aReliefOffset.setWidth( nReliefOffset );
|
aReliefOffset.setWidth( nReliefOffset );
|
||||||
@@ -1004,12 +1023,23 @@ namespace cppcanvas
|
|||||||
|
|
||||||
// determine relief color (from outdev3.cxx)
|
// determine relief color (from outdev3.cxx)
|
||||||
::Color aTextColor = ::vcl::unotools::sequenceToColor(
|
::Color aTextColor = ::vcl::unotools::sequenceToColor(
|
||||||
rCanvas->getUNOCanvas()->getDevice(), rState.textColor );
|
rCanvas->getUNOCanvas()->getDevice(),
|
||||||
|
rState.textColor );
|
||||||
|
|
||||||
aReliefColor = ::Color( COL_LIGHTGRAY );
|
aReliefColor = ::Color( COL_LIGHTGRAY );
|
||||||
|
|
||||||
|
// we don't have a automatic color, so black is always
|
||||||
|
// drawn on white (literally copied from
|
||||||
|
// vcl/source/gdi/outdev3.cxx)
|
||||||
if( aTextColor.GetColor() == COL_BLACK )
|
if( aTextColor.GetColor() == COL_BLACK )
|
||||||
aReliefColor = ::Color( COL_WHITE );
|
{
|
||||||
else if( aTextColor.GetColor() == COL_WHITE )
|
aTextColor = ::Color( COL_WHITE );
|
||||||
|
getState( rStates ).textColor =
|
||||||
|
::vcl::unotools::colorToDoubleSequence( rCanvas->getUNOCanvas()->getDevice(),
|
||||||
|
aTextColor );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( aTextColor.GetColor() == COL_WHITE )
|
||||||
aReliefColor = ::Color( COL_BLACK );
|
aReliefColor = ::Color( COL_BLACK );
|
||||||
aReliefColor.SetTransparency( aTextColor.GetTransparency() );
|
aReliefColor.SetTransparency( aTextColor.GetTransparency() );
|
||||||
}
|
}
|
||||||
@@ -2187,11 +2217,8 @@ namespace cppcanvas
|
|||||||
// create masked BitmapEx right here, as the
|
// create masked BitmapEx right here, as the
|
||||||
// canvas does not provide equivalent
|
// canvas does not provide equivalent
|
||||||
// functionality
|
// functionality
|
||||||
Bitmap aMask( pAct->GetBitmap().CreateMask( pAct->GetColor() ) );
|
BitmapEx aBmp( createMaskBmpEx( pAct->GetBitmap(),
|
||||||
aMask.Invert();
|
pAct->GetColor() ));
|
||||||
|
|
||||||
BitmapEx aBmp( pAct->GetBitmap(),
|
|
||||||
aMask );
|
|
||||||
|
|
||||||
ActionSharedPtr pBmpAction(
|
ActionSharedPtr pBmpAction(
|
||||||
internal::BitmapActionFactory::createBitmapAction(
|
internal::BitmapActionFactory::createBitmapAction(
|
||||||
@@ -2219,11 +2246,8 @@ namespace cppcanvas
|
|||||||
// create masked BitmapEx right here, as the
|
// create masked BitmapEx right here, as the
|
||||||
// canvas does not provide equivalent
|
// canvas does not provide equivalent
|
||||||
// functionality
|
// functionality
|
||||||
Bitmap aMask( pAct->GetBitmap().CreateMask( pAct->GetColor() ) );
|
BitmapEx aBmp( createMaskBmpEx( pAct->GetBitmap(),
|
||||||
aMask.Invert();
|
pAct->GetColor() ));
|
||||||
|
|
||||||
BitmapEx aBmp( pAct->GetBitmap(),
|
|
||||||
aMask );
|
|
||||||
|
|
||||||
ActionSharedPtr pBmpAction(
|
ActionSharedPtr pBmpAction(
|
||||||
internal::BitmapActionFactory::createBitmapAction(
|
internal::BitmapActionFactory::createBitmapAction(
|
||||||
@@ -2252,11 +2276,8 @@ namespace cppcanvas
|
|||||||
// create masked BitmapEx right here, as the
|
// create masked BitmapEx right here, as the
|
||||||
// canvas does not provide equivalent
|
// canvas does not provide equivalent
|
||||||
// functionality
|
// functionality
|
||||||
Bitmap aMask( pAct->GetBitmap().CreateMask( pAct->GetColor() ) );
|
BitmapEx aBmp( createMaskBmpEx( pAct->GetBitmap(),
|
||||||
aMask.Invert();
|
pAct->GetColor() ));
|
||||||
|
|
||||||
BitmapEx aBmp( pAct->GetBitmap(),
|
|
||||||
aMask );
|
|
||||||
|
|
||||||
// crop bitmap to given source rectangle (no
|
// crop bitmap to given source rectangle (no
|
||||||
// need to copy and convert the whole bitmap)
|
// need to copy and convert the whole bitmap)
|
||||||
@@ -2643,8 +2664,6 @@ namespace cppcanvas
|
|||||||
"ImplRenderer::forSubsetRange(): Invalid indices" );
|
"ImplRenderer::forSubsetRange(): Invalid indices" );
|
||||||
|
|
||||||
rFunctor( *aRangeBegin, aSubset );
|
rFunctor( *aRangeBegin, aSubset );
|
||||||
|
|
||||||
return rFunctor.result();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2662,18 +2681,12 @@ namespace cppcanvas
|
|||||||
|
|
||||||
rFunctor( *aRangeBegin, aSubset );
|
rFunctor( *aRangeBegin, aSubset );
|
||||||
|
|
||||||
if( !rFunctor.result() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// first action rendered, skip to next
|
// first action rendered, skip to next
|
||||||
++aRangeBegin;
|
++aRangeBegin;
|
||||||
|
|
||||||
// render full middle actions
|
// render full middle actions
|
||||||
rFunctor = ::std::for_each( aRangeBegin,
|
while( aRangeBegin != aRangeEnd )
|
||||||
aRangeEnd,
|
rFunctor( *aRangeBegin++ );
|
||||||
rFunctor );
|
|
||||||
if( !rFunctor.result() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( aRangeEnd == rEnd ||
|
if( aRangeEnd == rEnd ||
|
||||||
aRangeEnd->mnOrigIndex > nEndIndex )
|
aRangeEnd->mnOrigIndex > nEndIndex )
|
||||||
@@ -2686,7 +2699,7 @@ namespace cppcanvas
|
|||||||
// aRangeBegin, but _before_ aRangeEnd
|
// aRangeBegin, but _before_ aRangeEnd
|
||||||
//
|
//
|
||||||
// either way: no partial action left
|
// either way: no partial action left
|
||||||
return true;
|
return rFunctor.result();
|
||||||
}
|
}
|
||||||
|
|
||||||
aSubset.mnSubsetBegin = 0;
|
aSubset.mnSubsetBegin = 0;
|
||||||
@@ -2696,9 +2709,9 @@ namespace cppcanvas
|
|||||||
"ImplRenderer::forSubsetRange(): Invalid indices" );
|
"ImplRenderer::forSubsetRange(): Invalid indices" );
|
||||||
|
|
||||||
rFunctor( *aRangeEnd, aSubset );
|
rFunctor( *aRangeEnd, aSubset );
|
||||||
|
|
||||||
return rFunctor.result();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return rFunctor.result();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2935,7 +2948,8 @@ namespace cppcanvas
|
|||||||
// ========================
|
// ========================
|
||||||
|
|
||||||
::basegfx::B2DHomMatrix aMatrix;
|
::basegfx::B2DHomMatrix aMatrix;
|
||||||
::canvas::tools::getRenderStateTransform( aMatrix, maRenderState );
|
::canvas::tools::getRenderStateTransform( aMatrix,
|
||||||
|
getRenderState() );
|
||||||
|
|
||||||
ActionRenderer aRenderer( aMatrix );
|
ActionRenderer aRenderer( aMatrix );
|
||||||
|
|
||||||
@@ -2971,7 +2985,8 @@ namespace cppcanvas
|
|||||||
// ==================================
|
// ==================================
|
||||||
|
|
||||||
::basegfx::B2DHomMatrix aMatrix;
|
::basegfx::B2DHomMatrix aMatrix;
|
||||||
::canvas::tools::getRenderStateTransform( aMatrix, maRenderState );
|
::canvas::tools::getRenderStateTransform( aMatrix,
|
||||||
|
getRenderState() );
|
||||||
|
|
||||||
AreaQuery aQuery( aMatrix );
|
AreaQuery aQuery( aMatrix );
|
||||||
forSubsetRange( aQuery,
|
forSubsetRange( aQuery,
|
||||||
@@ -2981,7 +2996,23 @@ namespace cppcanvas
|
|||||||
nEndIndex,
|
nEndIndex,
|
||||||
maActions.end() );
|
maActions.end() );
|
||||||
|
|
||||||
return aQuery.getBounds();
|
::basegfx::B2DRange aBounds(
|
||||||
|
aQuery.getBounds() );
|
||||||
|
|
||||||
|
OSL_ENSURE( aBounds.getMinX() >= 0.0 &&
|
||||||
|
aBounds.getMinY() >= 0.0 &&
|
||||||
|
aBounds.getMaxX() <= 1.0 &&
|
||||||
|
aBounds.getMaxY() <= 1.0,
|
||||||
|
"ImplRenderer::getSubsetArea(): bounds larger than original shape - clipping!" );
|
||||||
|
|
||||||
|
// really make sure no shape appears larger than its
|
||||||
|
// original bounds (there _are_ some pathologic cases,
|
||||||
|
// especially when imported from PPT, that have
|
||||||
|
// e.g. obscenely large polygon bounds)
|
||||||
|
aBounds.intersect(
|
||||||
|
::basegfx::B2DRange( 0.0, 0.0,
|
||||||
|
1.0, 1.0 ));
|
||||||
|
return aBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImplRenderer::draw() const
|
bool ImplRenderer::draw() const
|
||||||
@@ -2989,7 +3020,8 @@ namespace cppcanvas
|
|||||||
RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::ImplRenderer::draw()" );
|
RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::ImplRenderer::draw()" );
|
||||||
|
|
||||||
::basegfx::B2DHomMatrix aMatrix;
|
::basegfx::B2DHomMatrix aMatrix;
|
||||||
::canvas::tools::getRenderStateTransform( aMatrix, maRenderState );
|
::canvas::tools::getRenderStateTransform( aMatrix,
|
||||||
|
getRenderState() );
|
||||||
|
|
||||||
return ::std::for_each( maActions.begin(), maActions.end(), ActionRenderer( aMatrix ) ).result();
|
return ::std::for_each( maActions.begin(), maActions.end(), ActionRenderer( aMatrix ) ).result();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user