Files
libreoffice/vcl/source/gdi/outdev6.cxx

1246 lines
47 KiB
C++
Raw Normal View History

2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 16:07:07 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:07:07 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 16:07:07 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 16:07:07 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
2000-09-18 16:07:07 +00:00
#include <svsys.h>
#include <vcl/salgdi.hxx>
2000-09-18 16:07:07 +00:00
#include <tools/debug.hxx>
#include <vcl/outdev.h>
#include <vcl/outdev.hxx>
#include <vcl/virdev.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/metaact.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/graph.hxx>
#include <vcl/wall2.hxx>
2000-09-18 16:07:07 +00:00
#include <com/sun/star/uno/Sequence.hxx>
#include <basegfx/vector/b2dvector.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <math.h>
#include <vcl/window.h>
2007-07-05 15:03:05 +00:00
#include <vcl/svdata.hxx>
2000-09-18 16:07:07 +00:00
// ========================================================================
DBG_NAMEEX( OutputDevice )
2000-09-18 16:07:07 +00:00
// ------------------------------------------------------------------------
void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, ULONG nFlags )
{
DBG_TRACE( "OutputDevice::DrawGrid()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() );
aDstRect.Intersection( rRect );
if( aDstRect.IsEmpty() || ImplIsRecordLayout() )
2000-09-18 16:07:07 +00:00
return;
if( !mpGraphics && !ImplGetGraphics() )
return;
if( mbInitClipRegion )
ImplInitClipRegion();
if( mbOutputClipped )
return;
const long nDistX = Max( rDist.Width(), 1L );
const long nDistY = Max( rDist.Height(), 1L );
long nX = ( rRect.Left() >= aDstRect.Left() ) ? rRect.Left() : ( rRect.Left() + ( ( aDstRect.Left() - rRect.Left() ) / nDistX ) * nDistX );
long nY = ( rRect.Top() >= aDstRect.Top() ) ? rRect.Top() : ( rRect.Top() + ( ( aDstRect.Top() - rRect.Top() ) / nDistY ) * nDistY );
const long nRight = aDstRect.Right();
const long nBottom = aDstRect.Bottom();
const long nStartX = ImplLogicXToDevicePixel( nX );
const long nEndX = ImplLogicXToDevicePixel( nRight );
const long nStartY = ImplLogicYToDevicePixel( nY );
const long nEndY = ImplLogicYToDevicePixel( nBottom );
long nHorzCount = 0L;
long nVertCount = 0L;
::com::sun::star::uno::Sequence< sal_Int32 > aVertBuf;
::com::sun::star::uno::Sequence< sal_Int32 > aHorzBuf;
if( ( nFlags & GRID_DOTS ) || ( nFlags & GRID_HORZLINES ) )
{
aVertBuf.realloc( aDstRect.GetHeight() / nDistY + 2L );
aVertBuf[ nVertCount++ ] = nStartY;
while( ( nY += nDistY ) <= nBottom )
aVertBuf[ nVertCount++ ] = ImplLogicYToDevicePixel( nY );
}
if( ( nFlags & GRID_DOTS ) || ( nFlags & GRID_VERTLINES ) )
{
aHorzBuf.realloc( aDstRect.GetWidth() / nDistX + 2L );
aHorzBuf[ nHorzCount++ ] = nStartX;
while( ( nX += nDistX ) <= nRight )
aHorzBuf[ nHorzCount++ ] = ImplLogicXToDevicePixel( nX );
}
if( mbInitLineColor )
ImplInitLineColor();
if( mbInitFillColor )
ImplInitFillColor();
const BOOL bOldMap = mbMap;
EnableMapMode( FALSE );
2000-09-18 16:07:07 +00:00
if( nFlags & GRID_DOTS )
{
for( long i = 0L; i < nVertCount; i++ )
for( long j = 0L, Y = aVertBuf[ i ]; j < nHorzCount; j++ )
mpGraphics->DrawPixel( aHorzBuf[ j ], Y, this );
2000-09-18 16:07:07 +00:00
}
else
{
if( nFlags & GRID_HORZLINES )
{
for( long i = 0L; i < nVertCount; i++ )
{
nY = aVertBuf[ i ];
2002-08-29 14:42:38 +00:00
mpGraphics->DrawLine( nStartX, nY, nEndX, nY, this );
2000-09-18 16:07:07 +00:00
}
}
if( nFlags & GRID_VERTLINES )
{
for( long i = 0L; i < nHorzCount; i++ )
{
nX = aHorzBuf[ i ];
2002-08-29 14:42:38 +00:00
mpGraphics->DrawLine( nX, nStartY, nX, nEndY, this );
2000-09-18 16:07:07 +00:00
}
}
}
EnableMapMode( bOldMap );
if( mpAlphaVDev )
mpAlphaVDev->DrawGrid( rRect, rDist, nFlags );
2000-09-18 16:07:07 +00:00
}
// ------------------------------------------------------------------------
// Caution: This method is nearly the same as
// void OutputDevice::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rB2DPolyPoly )
// so when changes are made here do not forget to make change sthere, too
void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency)
{
DBG_TRACE( "OutputDevice::DrawTransparent(B2D&,transparency)" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
// AW: Do NOT paint empty PolyPolygons
if(!rB2DPolyPoly.count())
return;
// we need a graphics
if( !mpGraphics )
if( !ImplGetGraphics() )
return;
if( mbInitClipRegion )
ImplInitClipRegion();
if( mbOutputClipped )
return;
if( mbInitLineColor )
ImplInitLineColor();
if( mbInitFillColor )
ImplInitFillColor();
CWS-TOOLING: integrate CWS aw073 2009-07-16 11:21:19 +0200 aw r274036 : corrections after resync 2009-07-15 13:34:18 +0200 aw r274009 : CWS-TOOLING: rebase CWS aw073 to trunk@273858 (milestone: DEV300:m52) 2009-07-01 20:04:27 +0200 aw r273613 : CWS-TOOLING: rebase CWS aw073 to trunk@273468 (milestone: DEV300:m51) 2009-06-24 11:51:03 +0200 aw r273324 : #i102062# added using statement for solaris compiler 2009-06-23 12:53:50 +0200 aw r273278 : #i100158# force filled polygons to closed state 2009-06-23 12:28:33 +0200 aw r273276 : #i100158#, #i102371# corrected all (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) shortcuts to support line/fill and to be not used when FillMode is not overpaint 2009-06-23 12:15:14 +0200 aw r273274 : #i100158# added PolyPolygon support for snapPointsOfHorizontalOrVerticalEdges helper 2009-06-22 17:28:33 +0200 aw r273244 : #i101508# added taking care of cell's distance-to-border values for cell text primitive creation 2009-06-22 12:59:10 +0200 aw r273218 : #i102253# applied patch from OD (see task) 2009-06-18 17:00:52 +0200 aw r273125 : #i102251# added EE_CNTRL_ONLINESPELLING switch off at DrawOutliner during GraphicExporter::GetGraphic 2009-06-18 14:35:57 +0200 aw r273120 : #i102241# added mergeToSinglePolyPolygon usage to SdrObject::ImpConvertToContourObj 2009-06-18 14:35:20 +0200 aw r273119 : #i102241# improved PolygonStrokePrimitive2D::createLocalDecomposition 2009-06-18 14:34:49 +0200 aw r273118 : #i102241# Made B2DCubicBezier::testAndSolveTrivialBezier() numerically more stable 2009-06-17 16:11:21 +0200 aw r273078 : #i102062# added compare support for OutlireParaObject's WrongList in an extra method; using in primitive comparators 2009-06-16 19:10:18 +0200 aw r273037 : #i101957# corrected: offset needs to be added before rotation and shear 2009-06-16 18:58:43 +0200 aw r273035 : #i101957# added needed offset by object width to SdrTextObj::impDecomposeStretchTextPrimitive for vertical texts 2009-06-16 18:35:55 +0200 aw r273034 : #i101941# corrected object initialisation for 3D Scenes on Clone operator 2009-06-16 16:07:30 +0200 aw r273024 : #i101811# extended renderChartPrimitive2D to create a correct embedding in a new MapMode 2009-06-12 19:38:07 +0200 aw r272940 : #i101734# added test code to experiment on demand with more complex transformations for virtual objects than only translations 2009-06-12 19:37:07 +0200 aw r272939 : #i101734# corrected SvtGraphicStroke preparation in MetaFile renderer (AFAP) 2009-06-12 16:31:55 +0200 aw r272931 : #i101648# re-enabled object creation with objecttype OBJ_NONE for SW Frame creation 2009-06-12 13:59:05 +0200 aw r272917 : #i101598# supported AAed single line paint in VCL 2009-06-12 11:34:25 +0200 aw r272907 : #i101598# adapted Graphic::GetBitmap() usage 2009-06-10 16:34:19 +0200 aw r272830 : #i101598# added VCL_DLLPUBLIC to parameter class 2009-06-10 16:30:27 +0200 aw r272829 : #i101598# extended calls to Graphic::GetBitmap/Ex where conversions to Bitmap objects is needed to user defined parameters like AntiAlisasing 2009-06-10 16:28:44 +0200 aw r272828 : #i101598# extended Graphic::GetBitmap/Ex interfaces to transport raster conversion parameters since these calls potentially need to rasterconvert a contained MetaFile 2009-06-09 16:26:40 +0200 aw r272781 : #i100945# checked in proposed patch for now 2009-06-08 18:01:42 +0200 aw r272742 : #i101239# teached BinTextObject to register at EditEngineItemPool sub-pool, not on given pool directly
2009-07-27 16:24:52 +00:00
if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
&& mpGraphics->supportsOperation(OutDevSupport_B2DDraw)
&& ROP_OVERPAINT == GetRasterOp() )
{
// b2dpolygon support not implemented yet on non-UNX platforms
CWS-TOOLING: integrate CWS aw058 2008-11-19 14:27:57 +0100 aw r263994 : #i95264# corrected line primitive range calculation for hairlines 2008-11-18 11:31:52 +0100 wg r263754 : i96156 2008-11-18 11:22:38 +0100 wg r263752 : i96156 2008-11-13 11:46:49 +0100 aw r263626 : #i93169# used flag the wrong way; true means that nothing was done yet 2008-11-12 15:33:41 +0100 wg r263601 : i96156 2008-11-12 13:22:38 +0100 wg r263592 : i95527 2008-11-12 13:18:51 +0100 wg r263591 : i95527 2008-10-29 13:22:02 +0100 aw r262794 : #i93485# identified reason and with PL's help changed problem accordingly with usage of an old fallback. This will need to be optimized again by HDU when he finds the time. 2008-10-28 18:23:04 +0100 aw r262763 : unxmacxi compiler warning fixed 2008-10-28 18:17:01 +0100 aw r262762 : unxmacxi compiler warning fixed 2008-10-28 17:55:18 +0100 aw r262761 : unxmacxi compiler warning fixed 2008-10-28 13:48:22 +0100 aw r262743 : #i93485# added UnifiedAlphaPrimitive2D to VclRenderer; corrected getB2DRange implementations for hairlines which are view-dependent 2008-10-28 12:40:55 +0100 aw r262735 : #i93485# had to move Pre/PostPaint to LocalPre/PostPaint since PrePaint is a virtual window method 2008-10-27 15:54:10 +0100 aw r262679 : #i19871# adapted the call order to parent implementations in some Nbc methods in SdrPathObj due to errors in SnapRect recalculation when GluePoints are involved 2008-10-24 18:31:48 +0200 aw r262661 : #i77187# disable all buttons in bezier toolbar when move and/or resize protected object is involved 2008-10-24 18:30:16 +0200 aw r262660 : #i77187# simplified and secured model changers, added toolbar update, disabled move drag start when polygon point is selected 2008-10-24 12:57:50 +0200 hdu r262635 : #i93485# use device transformation for SAL layer 2008-10-24 12:41:37 +0200 hdu r262634 : #i93485# use device transformation for SAL layer 2008-10-23 19:46:12 +0200 aw r262630 : mac compiler warning fixed 2008-10-23 18:15:02 +0200 aw r262628 : #i93485# modified dialog previews to use prerendering 2008-10-23 18:14:27 +0200 aw r262627 : #i93485# added assert when render helper uses Window as copy source 2008-10-22 18:07:30 +0200 aw r262610 : #i95264# fixes assertion 2008-10-22 14:31:51 +0200 aw r262606 : #i89661# also enabling DrawTransparent shortcut for VCL-Renderer 2008-10-22 14:10:31 +0200 aw r262604 : #i89661# new HitTest 2D primitive to support BoundRect and HitTest calculations/tests 2008-10-22 14:09:22 +0200 aw r262603 : #i89661# new HitTest tolerance, new TextFrame selection overlay, support for HitTest geometry 2008-10-22 14:08:16 +0200 aw r262602 : #i89661# correcting old HitTest tolerance expansion 2008-10-20 15:31:48 +0200 aw r262321 : #i89661# added patch to test it 2008-10-20 11:50:31 +0200 aw r262310 : #i87762# removed no longer used icons (aw053) 2008-10-17 15:41:48 +0200 aw r262288 : #i93169#, #i93180# FormControl corrections for Primitive handling 2008-10-17 15:40:54 +0200 aw r262287 : #i93169#, #i93180# FormControl corrections for Primitive handling 2008-10-16 11:12:44 +0200 aw r262253 : #i93595# removed superfluous grid interface 2008-10-16 11:11:20 +0200 aw r262252 : #i93595# changed grid display to sub-grid usage and new defaults 2008-10-15 15:09:40 +0200 aw r262234 : #i93597# moved flag for only vertical PageBorder, added reacting on it to primitive creation 2008-10-15 15:09:09 +0200 aw r262233 : #i93597# moved flag for only vertical PageBorder 2008-10-15 15:08:46 +0200 aw r262232 : #i93597# moved flag for only vertical PageBorder, added reacting on it to primitive creation 2008-10-14 16:27:07 +0200 aw r262207 : #i93648# (flushViewObjectContacts) and #i93318# (propertyChange) 2008-10-14 16:25:10 +0200 aw r262206 : #i93318# back to old state since detecting a change is not placed well at the primitive (which is a graphical information at the itme it was fetched). Instead i will add the needed check and flush at the FormControl's VOC 2008-10-14 13:47:38 +0200 aw r262201 : #i93318# added a change listener to the XControlModel and code to make the operator== at control primitive fail
2008-11-19 14:05:59 +00:00
const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
CWS-TOOLING: integrate CWS aw073 2009-07-16 11:21:19 +0200 aw r274036 : corrections after resync 2009-07-15 13:34:18 +0200 aw r274009 : CWS-TOOLING: rebase CWS aw073 to trunk@273858 (milestone: DEV300:m52) 2009-07-01 20:04:27 +0200 aw r273613 : CWS-TOOLING: rebase CWS aw073 to trunk@273468 (milestone: DEV300:m51) 2009-06-24 11:51:03 +0200 aw r273324 : #i102062# added using statement for solaris compiler 2009-06-23 12:53:50 +0200 aw r273278 : #i100158# force filled polygons to closed state 2009-06-23 12:28:33 +0200 aw r273276 : #i100158#, #i102371# corrected all (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) shortcuts to support line/fill and to be not used when FillMode is not overpaint 2009-06-23 12:15:14 +0200 aw r273274 : #i100158# added PolyPolygon support for snapPointsOfHorizontalOrVerticalEdges helper 2009-06-22 17:28:33 +0200 aw r273244 : #i101508# added taking care of cell's distance-to-border values for cell text primitive creation 2009-06-22 12:59:10 +0200 aw r273218 : #i102253# applied patch from OD (see task) 2009-06-18 17:00:52 +0200 aw r273125 : #i102251# added EE_CNTRL_ONLINESPELLING switch off at DrawOutliner during GraphicExporter::GetGraphic 2009-06-18 14:35:57 +0200 aw r273120 : #i102241# added mergeToSinglePolyPolygon usage to SdrObject::ImpConvertToContourObj 2009-06-18 14:35:20 +0200 aw r273119 : #i102241# improved PolygonStrokePrimitive2D::createLocalDecomposition 2009-06-18 14:34:49 +0200 aw r273118 : #i102241# Made B2DCubicBezier::testAndSolveTrivialBezier() numerically more stable 2009-06-17 16:11:21 +0200 aw r273078 : #i102062# added compare support for OutlireParaObject's WrongList in an extra method; using in primitive comparators 2009-06-16 19:10:18 +0200 aw r273037 : #i101957# corrected: offset needs to be added before rotation and shear 2009-06-16 18:58:43 +0200 aw r273035 : #i101957# added needed offset by object width to SdrTextObj::impDecomposeStretchTextPrimitive for vertical texts 2009-06-16 18:35:55 +0200 aw r273034 : #i101941# corrected object initialisation for 3D Scenes on Clone operator 2009-06-16 16:07:30 +0200 aw r273024 : #i101811# extended renderChartPrimitive2D to create a correct embedding in a new MapMode 2009-06-12 19:38:07 +0200 aw r272940 : #i101734# added test code to experiment on demand with more complex transformations for virtual objects than only translations 2009-06-12 19:37:07 +0200 aw r272939 : #i101734# corrected SvtGraphicStroke preparation in MetaFile renderer (AFAP) 2009-06-12 16:31:55 +0200 aw r272931 : #i101648# re-enabled object creation with objecttype OBJ_NONE for SW Frame creation 2009-06-12 13:59:05 +0200 aw r272917 : #i101598# supported AAed single line paint in VCL 2009-06-12 11:34:25 +0200 aw r272907 : #i101598# adapted Graphic::GetBitmap() usage 2009-06-10 16:34:19 +0200 aw r272830 : #i101598# added VCL_DLLPUBLIC to parameter class 2009-06-10 16:30:27 +0200 aw r272829 : #i101598# extended calls to Graphic::GetBitmap/Ex where conversions to Bitmap objects is needed to user defined parameters like AntiAlisasing 2009-06-10 16:28:44 +0200 aw r272828 : #i101598# extended Graphic::GetBitmap/Ex interfaces to transport raster conversion parameters since these calls potentially need to rasterconvert a contained MetaFile 2009-06-09 16:26:40 +0200 aw r272781 : #i100945# checked in proposed patch for now 2009-06-08 18:01:42 +0200 aw r272742 : #i101239# teached BinTextObject to register at EditEngineItemPool sub-pool, not on given pool directly
2009-07-27 16:24:52 +00:00
basegfx::B2DPolyPolygon aB2DPolyPolygon(rB2DPolyPoly);
// transform the polygon into device space and ensure it is closed
aB2DPolyPolygon.transform( aTransform );
aB2DPolyPolygon.setClosed( true );
bool bDrawnOk = true;
if( IsFillColor() )
bDrawnOk = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, fTransparency, this );
if( bDrawnOk && IsLineColor() )
{
const basegfx::B2DVector aHairlineWidth(1,1);
const int nPolyCount = aB2DPolyPolygon.count();
for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
{
const ::basegfx::B2DPolygon aOnePoly = aB2DPolyPolygon.getB2DPolygon( nPolyIdx );
mpGraphics->DrawPolyLine( aOnePoly, fTransparency, aHairlineWidth, ::basegfx::B2DLINEJOIN_NONE, this );
}
}
CWS-TOOLING: integrate CWS aw073 2009-07-16 11:21:19 +0200 aw r274036 : corrections after resync 2009-07-15 13:34:18 +0200 aw r274009 : CWS-TOOLING: rebase CWS aw073 to trunk@273858 (milestone: DEV300:m52) 2009-07-01 20:04:27 +0200 aw r273613 : CWS-TOOLING: rebase CWS aw073 to trunk@273468 (milestone: DEV300:m51) 2009-06-24 11:51:03 +0200 aw r273324 : #i102062# added using statement for solaris compiler 2009-06-23 12:53:50 +0200 aw r273278 : #i100158# force filled polygons to closed state 2009-06-23 12:28:33 +0200 aw r273276 : #i100158#, #i102371# corrected all (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) shortcuts to support line/fill and to be not used when FillMode is not overpaint 2009-06-23 12:15:14 +0200 aw r273274 : #i100158# added PolyPolygon support for snapPointsOfHorizontalOrVerticalEdges helper 2009-06-22 17:28:33 +0200 aw r273244 : #i101508# added taking care of cell's distance-to-border values for cell text primitive creation 2009-06-22 12:59:10 +0200 aw r273218 : #i102253# applied patch from OD (see task) 2009-06-18 17:00:52 +0200 aw r273125 : #i102251# added EE_CNTRL_ONLINESPELLING switch off at DrawOutliner during GraphicExporter::GetGraphic 2009-06-18 14:35:57 +0200 aw r273120 : #i102241# added mergeToSinglePolyPolygon usage to SdrObject::ImpConvertToContourObj 2009-06-18 14:35:20 +0200 aw r273119 : #i102241# improved PolygonStrokePrimitive2D::createLocalDecomposition 2009-06-18 14:34:49 +0200 aw r273118 : #i102241# Made B2DCubicBezier::testAndSolveTrivialBezier() numerically more stable 2009-06-17 16:11:21 +0200 aw r273078 : #i102062# added compare support for OutlireParaObject's WrongList in an extra method; using in primitive comparators 2009-06-16 19:10:18 +0200 aw r273037 : #i101957# corrected: offset needs to be added before rotation and shear 2009-06-16 18:58:43 +0200 aw r273035 : #i101957# added needed offset by object width to SdrTextObj::impDecomposeStretchTextPrimitive for vertical texts 2009-06-16 18:35:55 +0200 aw r273034 : #i101941# corrected object initialisation for 3D Scenes on Clone operator 2009-06-16 16:07:30 +0200 aw r273024 : #i101811# extended renderChartPrimitive2D to create a correct embedding in a new MapMode 2009-06-12 19:38:07 +0200 aw r272940 : #i101734# added test code to experiment on demand with more complex transformations for virtual objects than only translations 2009-06-12 19:37:07 +0200 aw r272939 : #i101734# corrected SvtGraphicStroke preparation in MetaFile renderer (AFAP) 2009-06-12 16:31:55 +0200 aw r272931 : #i101648# re-enabled object creation with objecttype OBJ_NONE for SW Frame creation 2009-06-12 13:59:05 +0200 aw r272917 : #i101598# supported AAed single line paint in VCL 2009-06-12 11:34:25 +0200 aw r272907 : #i101598# adapted Graphic::GetBitmap() usage 2009-06-10 16:34:19 +0200 aw r272830 : #i101598# added VCL_DLLPUBLIC to parameter class 2009-06-10 16:30:27 +0200 aw r272829 : #i101598# extended calls to Graphic::GetBitmap/Ex where conversions to Bitmap objects is needed to user defined parameters like AntiAlisasing 2009-06-10 16:28:44 +0200 aw r272828 : #i101598# extended Graphic::GetBitmap/Ex interfaces to transport raster conversion parameters since these calls potentially need to rasterconvert a contained MetaFile 2009-06-09 16:26:40 +0200 aw r272781 : #i100945# checked in proposed patch for now 2009-06-08 18:01:42 +0200 aw r272742 : #i101239# teached BinTextObject to register at EditEngineItemPool sub-pool, not on given pool directly
2009-07-27 16:24:52 +00:00
if( bDrawnOk )
{
#if 0
// MetaB2DPolyPolygonAction is not implemented yet:
// according to AW adding it is very dangerous since there is a lot
// of code that uses the metafile actions directly and unless every
// place that does this knows about the new action we need to fallback
if( mpMetaFile )
mpMetaFile->AddAction( new MetaB2DPolyPolygonAction( rB2DPolyPoly ) );
#else
if( mpMetaFile )
mpMetaFile->AddAction( new MetaTransparentAction( PolyPolygon( rB2DPolyPoly ), static_cast< sal_uInt16 >(fTransparency * 100.0)));
#endif
return;
}
}
// fallback to old polygon drawing if needed
const PolyPolygon aToolsPolyPolygon( rB2DPolyPoly );
DrawTransparent(PolyPolygon(rB2DPolyPoly), static_cast< sal_uInt16 >(fTransparency * 100.0));
}
2000-09-18 16:07:07 +00:00
// ------------------------------------------------------------------------
void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
USHORT nTransparencePercent )
{
DBG_TRACE( "OutputDevice::DrawTransparent()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
// short circuit for drawing an opaque polygon
if( (nTransparencePercent < 1) || ((mnDrawMode & DRAWMODE_NOTRANSPARENCY) != 0) )
{
2000-09-18 16:07:07 +00:00
DrawPolyPolygon( rPolyPoly );
return;
}
// short circut for drawing an invisible polygon
if( !mbFillColor || (nTransparencePercent >= 100) )
2000-09-18 16:07:07 +00:00
{
// short circuit if the polygon border is invisible too
if( !mbLineColor )
return;
// DrawTransparent() assumes that the border is NOT to be drawn transparently???
2000-09-18 16:07:07 +00:00
Push( PUSH_FILLCOLOR );
SetFillColor();
DrawPolyPolygon( rPolyPoly );
Pop();
return;
2000-09-18 16:07:07 +00:00
}
// handle metafile recording
if( mpMetaFile )
mpMetaFile->AddAction( new MetaTransparentAction( rPolyPoly, nTransparencePercent ) );
bool bDrawn = !IsDeviceOutputNecessary() || ImplIsRecordLayout();
if( bDrawn )
return;
// get the device graphics as drawing target
if( !mpGraphics )
if( !ImplGetGraphics() )
return;
// debug helper:
static const char* pDisableNative = getenv( "SAL_DISABLE_NATIVE_ALPHA");
// try hard to draw it directly, because the emulation layers are slower
if( !pDisableNative
CWS-TOOLING: integrate CWS aw059 2008-12-16 16:15:40 +0100 aw r265557 : #i95645# avoid expensive tries to stream in graphic data when stream is at end anyways 2008-12-15 16:49:58 +0100 wg r265512 : i97278 2008-12-12 16:02:15 +0100 aw r265427 : #i95645# new formulation was wrong in two places; thanks go to THB. Thanks! 2008-12-12 15:49:06 +0100 aw r265425 : #i95645# refined formulation of AA on/off constraints for VCLCanvas 2008-12-12 14:51:26 +0100 aw r265420 : #i95645# workaround for DrawTransparent of button hilighting when remote displayed; somehow GDI+ does bad dithering in that case 2008-12-12 13:23:00 +0100 aw r265414 : removed temporary build hack; it made it's way in using the rebase; with SVN the rebase is not based on pure checkouts, but uses local changes. 2008-12-11 19:35:59 +0100 aw r265352 : #i95645# need to switch off AA for WNT and UNX, the VCLCanvas is currently not able to handle AA correctly 2008-12-11 16:05:17 +0100 thb r265327 : #i95645# Changed defaults to on; as for the while svx dialog is not changed 2008-12-10 13:40:38 +0100 aw r265180 : #i95645# changed pixel snap to basegfx::fround 2008-12-10 13:25:45 +0100 aw r265177 : corrected linux warning 2008-12-10 12:28:02 +0100 aw r265167 : #i95645# added support for pixel snap/linux resp. no AA for mac (also pixel snap) when AA is switched off to the basegfx::B2DPolyPolygon painting VCL methods; needed for e.g. selection in SC and SW 2008-12-09 18:44:39 +0100 aw r265136 : #i95645# corrected filled path construction 2008-12-09 18:12:40 +0100 aw r265133 : #i95645# added support for non-AAd transparent paints 2008-12-09 18:11:58 +0100 aw r265132 : #i95645# forced selection without AA 2008-12-09 18:11:29 +0100 aw r265131 : #i88893# smoothed/corrected SW selection rects for transparent selection, forced selection without AA 2008-12-09 15:21:39 +0100 aw r265094 : #i95645# corrected FormControl full drag 2008-12-09 15:11:26 +0100 aw r265093 : #i95645# make gdiplus usages more safe when no line or fill color is selected 2008-12-09 14:30:09 +0100 aw r265085 : #i95645# added GDIPlus support 2008-12-09 13:41:06 +0100 aw r265081 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:40:46 +0100 aw r265080 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:40:29 +0100 aw r265079 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:33:16 +0100 aw r265078 : #i95645# changes to requirements, discussed with FPE 2008-12-08 14:11:39 +0100 aw r264995 : #i95646# added missing extra-wireframe for SdrDragObjOwn implementations when object has no border 2008-12-08 14:11:00 +0100 aw r264994 : #i95646# corrected RenderMarkerArrayPrimitive2D OutDev usage in VclProcessor2D 2008-12-08 12:15:10 +0100 ufi r264987 : aw059 2008-12-08 12:14:40 +0100 ufi r264986 : aw059 2008-12-05 13:16:18 +0100 aw r264905 : CWS-TOOLING: rebase CWS aw059 to trunk@264807 (milestone: DEV300:m37) 2008-12-04 11:29:48 +0100 aw r264827 : #i95645# corrected warning 2008-12-03 14:43:39 +0100 aw r264783 : #i95645# simplified overlay manager and objects to stl vector; added stuff to render some more overlay to primitive renderer to get AA support for WIN32 2008-12-03 14:42:43 +0100 aw r264782 : #i95645# added test for WIN32 for AA if cairo canvas is available 2008-12-03 14:42:13 +0100 aw r264781 : #i95645# removed unused options for writer selection overlay 2008-12-03 14:41:51 +0100 aw r264780 : #i95645# removed unused options for calc overlay 2008-12-03 14:41:21 +0100 aw r264779 : #i95645# small corrections in canvas renderer 2008-12-02 18:32:31 +0100 aw r264730 : #i95646# merged cairo version from THB's CWS cairosource01 2008-12-02 15:25:45 +0100 aw r264705 : #i95645# added helpers for the MarkerArrayPrimitive2D change which support buffered creation of the most used markers 2008-12-02 12:50:01 +0100 aw r264690 : #i95645# added a non-saved method IsAAPossibleOnThisSystem to SvtOptionsDrawinglayer to quickly test if AA can be offered on the system, added buffering of that check. 2008-12-02 12:48:51 +0100 aw r264689 : #i95645# unified MarkerArrayPrimitive2D to work bitmap-orientated, adapted usages. Added buffered preparation for needed markers. Minor adaptions for AA 2008-12-02 12:47:53 +0100 aw r264688 : #i95645# unified MarkerArrayPrimitive2D to no longer work on a enum and types of markers, but to use a BitmapEx (or any other Bitmap object) which will be displayed centerd and in discrete coordinates at positions. Adapted decomposition and all usages. Corrected minor stuff with grid primitive 2008-11-28 17:11:12 +0100 thb r264565 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 17:03:27 +0100 thb r264563 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 17:00:07 +0100 thb r264562 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 16:59:51 +0100 thb r264561 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-27 19:13:42 +0100 aw r264519 : #i95646# optimized getLength() a little bit 2008-11-27 19:12:50 +0100 aw r264518 : #i95646# corrected AA expansion of invalidate frame; buffered discrete distance at OM 2008-11-27 18:50:05 +0100 aw r264516 : #i95646# corrected fit to frame texts for WIN32 2008-11-27 15:32:15 +0100 aw r264496 : #i95646# helplines corrected 2008-11-27 15:32:05 +0100 aw r264495 : #i95646# helplines corrected 2008-11-27 15:01:30 +0100 aw r264492 : #i95646# enable AA support for old polygons, especially to get support for MetaFile output 2008-11-27 14:33:28 +0100 aw r264489 : #i95646# AA support for wireframe overlays 2008-11-27 13:40:54 +0100 aw r264485 : #i95646# added full repaint when AA option changes 2008-11-27 13:29:19 +0100 aw r264482 : #i95646# corrected handling of bSolidDragging config entries 2008-11-27 13:29:08 +0100 aw r264481 : #i95646# corrected handling of bSolidDragging config entries 2008-11-27 11:30:12 +0100 aw r264469 : #i95646# corrected IsAAPossibleOnThisSystem implementation 2008-11-26 16:33:04 +0100 aw r264420 : #i95646# adapted OfaViewTabPage to use disable mechanism for AA and HWAccel 2008-11-26 15:49:19 +0100 aw r264406 : #i95646# added DlgEdObj::getFullDragClone() to create specialized simple SdrUnoObj clones for solid dragging 2008-11-26 15:48:11 +0100 aw r264405 : #i95646# changed derivation of ViewObjectContactOfUnoControl to get a valid isPrimitiveVisible() implementation 2008-11-26 14:11:37 +0100 aw r264385 : #i88893# added new look for selection in sw 2008-11-26 11:32:33 +0100 aw r264360 : corrected compiler warning 2008-11-25 18:46:29 +0100 aw r264328 : #i95646# snapshot with FullDrag clones 2008-11-25 18:46:07 +0100 aw r264327 : #i95646# snapshot with FullDrag clones 2008-11-25 18:45:43 +0100 aw r264326 : #i95646# snapshot with FullDrag clones 2008-11-25 18:19:04 +0100 thb r264324 : #i96585# Added missing inline specifier 2008-11-25 13:16:25 +0100 aw r264285 : #i95646# next snapshot 2008-11-25 13:15:33 +0100 aw r264284 : #i95646# next snapshot 2008-11-25 13:15:12 +0100 aw r264283 : #i95646# next snapshot 2008-11-25 13:14:51 +0100 aw r264282 : #i95646# next snapshot 2008-11-20 13:40:49 +0100 aw r264045 : #i95646# stable snapshot 2008-11-20 13:40:29 +0100 aw r264044 : #i95646# stable snapshot 2008-11-20 13:40:06 +0100 aw r264043 : #i95646# stable snapshot 2008-11-20 13:39:45 +0100 aw r264042 : #i95646# stable snapshot 2008-11-18 11:53:39 +0100 aw r263758 : #i95646# snapshot for linux test build 2008-11-18 11:52:54 +0100 aw r263757 : #i95646# snapshot for linux test build 2008-11-18 11:52:02 +0100 aw r263756 : #i95646# snapshot for linux test build 2008-11-14 18:17:49 +0100 aw r263692 : #i95646# snapshot with most stuff working 2008-11-14 18:14:26 +0100 aw r263691 : #i95646# snapshot with most stuff working 2008-11-14 18:12:50 +0100 aw r263690 : #i95646# snapshot with most stuff working 2008-11-14 18:12:16 +0100 aw r263689 : #i95646# snapshot with most stuff working 2008-11-14 18:11:41 +0100 aw r263688 : #i95646# snapshot with most stuff working 2008-11-07 18:44:22 +0100 aw r263479 : #i95968# better support PrefMapMode; special for MAP_PIXEL was missing 2008-11-05 17:39:15 +0100 aw r263356 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment 2008-11-05 17:39:02 +0100 aw r263355 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment 2008-11-05 12:28:32 +0100 aw r263350 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:27:51 +0100 aw r263349 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:26:58 +0100 aw r263348 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:26:17 +0100 aw r263347 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:25:55 +0100 aw r263346 : #i95644# #i95645# #i95646# in-between state before bigger change
2009-01-05 13:44:12 +00:00
&& mpGraphics->supportsOperation( OutDevSupport_B2DDraw )
#if defined UNX && ! defined QUARTZ
&& GetBitCount() > 8
#endif
CWS-TOOLING: integrate CWS aw059 2008-12-16 16:15:40 +0100 aw r265557 : #i95645# avoid expensive tries to stream in graphic data when stream is at end anyways 2008-12-15 16:49:58 +0100 wg r265512 : i97278 2008-12-12 16:02:15 +0100 aw r265427 : #i95645# new formulation was wrong in two places; thanks go to THB. Thanks! 2008-12-12 15:49:06 +0100 aw r265425 : #i95645# refined formulation of AA on/off constraints for VCLCanvas 2008-12-12 14:51:26 +0100 aw r265420 : #i95645# workaround for DrawTransparent of button hilighting when remote displayed; somehow GDI+ does bad dithering in that case 2008-12-12 13:23:00 +0100 aw r265414 : removed temporary build hack; it made it's way in using the rebase; with SVN the rebase is not based on pure checkouts, but uses local changes. 2008-12-11 19:35:59 +0100 aw r265352 : #i95645# need to switch off AA for WNT and UNX, the VCLCanvas is currently not able to handle AA correctly 2008-12-11 16:05:17 +0100 thb r265327 : #i95645# Changed defaults to on; as for the while svx dialog is not changed 2008-12-10 13:40:38 +0100 aw r265180 : #i95645# changed pixel snap to basegfx::fround 2008-12-10 13:25:45 +0100 aw r265177 : corrected linux warning 2008-12-10 12:28:02 +0100 aw r265167 : #i95645# added support for pixel snap/linux resp. no AA for mac (also pixel snap) when AA is switched off to the basegfx::B2DPolyPolygon painting VCL methods; needed for e.g. selection in SC and SW 2008-12-09 18:44:39 +0100 aw r265136 : #i95645# corrected filled path construction 2008-12-09 18:12:40 +0100 aw r265133 : #i95645# added support for non-AAd transparent paints 2008-12-09 18:11:58 +0100 aw r265132 : #i95645# forced selection without AA 2008-12-09 18:11:29 +0100 aw r265131 : #i88893# smoothed/corrected SW selection rects for transparent selection, forced selection without AA 2008-12-09 15:21:39 +0100 aw r265094 : #i95645# corrected FormControl full drag 2008-12-09 15:11:26 +0100 aw r265093 : #i95645# make gdiplus usages more safe when no line or fill color is selected 2008-12-09 14:30:09 +0100 aw r265085 : #i95645# added GDIPlus support 2008-12-09 13:41:06 +0100 aw r265081 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:40:46 +0100 aw r265080 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:40:29 +0100 aw r265079 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:33:16 +0100 aw r265078 : #i95645# changes to requirements, discussed with FPE 2008-12-08 14:11:39 +0100 aw r264995 : #i95646# added missing extra-wireframe for SdrDragObjOwn implementations when object has no border 2008-12-08 14:11:00 +0100 aw r264994 : #i95646# corrected RenderMarkerArrayPrimitive2D OutDev usage in VclProcessor2D 2008-12-08 12:15:10 +0100 ufi r264987 : aw059 2008-12-08 12:14:40 +0100 ufi r264986 : aw059 2008-12-05 13:16:18 +0100 aw r264905 : CWS-TOOLING: rebase CWS aw059 to trunk@264807 (milestone: DEV300:m37) 2008-12-04 11:29:48 +0100 aw r264827 : #i95645# corrected warning 2008-12-03 14:43:39 +0100 aw r264783 : #i95645# simplified overlay manager and objects to stl vector; added stuff to render some more overlay to primitive renderer to get AA support for WIN32 2008-12-03 14:42:43 +0100 aw r264782 : #i95645# added test for WIN32 for AA if cairo canvas is available 2008-12-03 14:42:13 +0100 aw r264781 : #i95645# removed unused options for writer selection overlay 2008-12-03 14:41:51 +0100 aw r264780 : #i95645# removed unused options for calc overlay 2008-12-03 14:41:21 +0100 aw r264779 : #i95645# small corrections in canvas renderer 2008-12-02 18:32:31 +0100 aw r264730 : #i95646# merged cairo version from THB's CWS cairosource01 2008-12-02 15:25:45 +0100 aw r264705 : #i95645# added helpers for the MarkerArrayPrimitive2D change which support buffered creation of the most used markers 2008-12-02 12:50:01 +0100 aw r264690 : #i95645# added a non-saved method IsAAPossibleOnThisSystem to SvtOptionsDrawinglayer to quickly test if AA can be offered on the system, added buffering of that check. 2008-12-02 12:48:51 +0100 aw r264689 : #i95645# unified MarkerArrayPrimitive2D to work bitmap-orientated, adapted usages. Added buffered preparation for needed markers. Minor adaptions for AA 2008-12-02 12:47:53 +0100 aw r264688 : #i95645# unified MarkerArrayPrimitive2D to no longer work on a enum and types of markers, but to use a BitmapEx (or any other Bitmap object) which will be displayed centerd and in discrete coordinates at positions. Adapted decomposition and all usages. Corrected minor stuff with grid primitive 2008-11-28 17:11:12 +0100 thb r264565 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 17:03:27 +0100 thb r264563 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 17:00:07 +0100 thb r264562 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 16:59:51 +0100 thb r264561 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-27 19:13:42 +0100 aw r264519 : #i95646# optimized getLength() a little bit 2008-11-27 19:12:50 +0100 aw r264518 : #i95646# corrected AA expansion of invalidate frame; buffered discrete distance at OM 2008-11-27 18:50:05 +0100 aw r264516 : #i95646# corrected fit to frame texts for WIN32 2008-11-27 15:32:15 +0100 aw r264496 : #i95646# helplines corrected 2008-11-27 15:32:05 +0100 aw r264495 : #i95646# helplines corrected 2008-11-27 15:01:30 +0100 aw r264492 : #i95646# enable AA support for old polygons, especially to get support for MetaFile output 2008-11-27 14:33:28 +0100 aw r264489 : #i95646# AA support for wireframe overlays 2008-11-27 13:40:54 +0100 aw r264485 : #i95646# added full repaint when AA option changes 2008-11-27 13:29:19 +0100 aw r264482 : #i95646# corrected handling of bSolidDragging config entries 2008-11-27 13:29:08 +0100 aw r264481 : #i95646# corrected handling of bSolidDragging config entries 2008-11-27 11:30:12 +0100 aw r264469 : #i95646# corrected IsAAPossibleOnThisSystem implementation 2008-11-26 16:33:04 +0100 aw r264420 : #i95646# adapted OfaViewTabPage to use disable mechanism for AA and HWAccel 2008-11-26 15:49:19 +0100 aw r264406 : #i95646# added DlgEdObj::getFullDragClone() to create specialized simple SdrUnoObj clones for solid dragging 2008-11-26 15:48:11 +0100 aw r264405 : #i95646# changed derivation of ViewObjectContactOfUnoControl to get a valid isPrimitiveVisible() implementation 2008-11-26 14:11:37 +0100 aw r264385 : #i88893# added new look for selection in sw 2008-11-26 11:32:33 +0100 aw r264360 : corrected compiler warning 2008-11-25 18:46:29 +0100 aw r264328 : #i95646# snapshot with FullDrag clones 2008-11-25 18:46:07 +0100 aw r264327 : #i95646# snapshot with FullDrag clones 2008-11-25 18:45:43 +0100 aw r264326 : #i95646# snapshot with FullDrag clones 2008-11-25 18:19:04 +0100 thb r264324 : #i96585# Added missing inline specifier 2008-11-25 13:16:25 +0100 aw r264285 : #i95646# next snapshot 2008-11-25 13:15:33 +0100 aw r264284 : #i95646# next snapshot 2008-11-25 13:15:12 +0100 aw r264283 : #i95646# next snapshot 2008-11-25 13:14:51 +0100 aw r264282 : #i95646# next snapshot 2008-11-20 13:40:49 +0100 aw r264045 : #i95646# stable snapshot 2008-11-20 13:40:29 +0100 aw r264044 : #i95646# stable snapshot 2008-11-20 13:40:06 +0100 aw r264043 : #i95646# stable snapshot 2008-11-20 13:39:45 +0100 aw r264042 : #i95646# stable snapshot 2008-11-18 11:53:39 +0100 aw r263758 : #i95646# snapshot for linux test build 2008-11-18 11:52:54 +0100 aw r263757 : #i95646# snapshot for linux test build 2008-11-18 11:52:02 +0100 aw r263756 : #i95646# snapshot for linux test build 2008-11-14 18:17:49 +0100 aw r263692 : #i95646# snapshot with most stuff working 2008-11-14 18:14:26 +0100 aw r263691 : #i95646# snapshot with most stuff working 2008-11-14 18:12:50 +0100 aw r263690 : #i95646# snapshot with most stuff working 2008-11-14 18:12:16 +0100 aw r263689 : #i95646# snapshot with most stuff working 2008-11-14 18:11:41 +0100 aw r263688 : #i95646# snapshot with most stuff working 2008-11-07 18:44:22 +0100 aw r263479 : #i95968# better support PrefMapMode; special for MAP_PIXEL was missing 2008-11-05 17:39:15 +0100 aw r263356 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment 2008-11-05 17:39:02 +0100 aw r263355 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment 2008-11-05 12:28:32 +0100 aw r263350 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:27:51 +0100 aw r263349 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:26:58 +0100 aw r263348 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:26:17 +0100 aw r263347 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:25:55 +0100 aw r263346 : #i95644# #i95645# #i95646# in-between state before bigger change
2009-01-05 13:44:12 +00:00
#ifdef WIN32
// workaround bad dithering on remote displaying when using GDI+ with toolbar buttoin hilighting
&& !rPolyPoly.IsRect()
#endif
)
{
// prepare the graphics device
if( mbInitClipRegion )
ImplInitClipRegion();
if( mbOutputClipped )
return;
if( mbInitLineColor )
ImplInitLineColor();
if( mbInitFillColor )
ImplInitFillColor();
// get the polygon in device coordinates
basegfx::B2DPolyPolygon aB2DPolyPolygon( rPolyPoly.getB2DPolyPolygon() );
const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
aB2DPolyPolygon.transform( aTransform );
const double fTransparency = 0.01 * nTransparencePercent;
if( mbFillColor )
{
// draw the transparent polygon
// NOTE: filled polygons are assumed to be drawn as if they were always closed
bDrawn = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, fTransparency, this );
}
if( mbLineColor )
{
// disable the fill color for now
mpGraphics->SetFillColor();
// draw the border line
const basegfx::B2DVector aLineWidths( 1, 1 );
const int nPolyCount = aB2DPolyPolygon.count();
for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
{
const ::basegfx::B2DPolygon& rPolygon = aB2DPolyPolygon.getB2DPolygon( nPolyIdx );
bDrawn = mpGraphics->DrawPolyLine( rPolygon, fTransparency, aLineWidths, ::basegfx::B2DLINEJOIN_NONE, this );
}
// prepare to restore the fill color
mbInitFillColor = mbFillColor;
}
}
if( bDrawn )
return;
if( 1 )
{
VirtualDevice* pOldAlphaVDev = mpAlphaVDev;
// #110958# Disable alpha VDev, we perform the necessary
// operation explicitely further below.
if( mpAlphaVDev )
mpAlphaVDev = NULL;
2000-09-18 16:07:07 +00:00
GDIMetaFile* pOldMetaFile = mpMetaFile;
mpMetaFile = NULL;
if( OUTDEV_PRINTER == meOutDevType )
{
2010-07-15 13:43:18 +02:00
if(100 <= nTransparencePercent)
{
// #i112959# 100% transparent, draw nothing
return;
}
2000-09-18 16:07:07 +00:00
Rectangle aPolyRect( LogicToPixel( rPolyPoly ).GetBoundRect() );
const Size aDPISize( LogicToPixel( Size( 1, 1 ), MAP_INCH ) );
const long nBaseExtent = Max( FRound( aDPISize.Width() / 300. ), 1L );
long nMove;
const USHORT nTrans = ( nTransparencePercent < 13 ) ? 0 :
( nTransparencePercent < 38 ) ? 25 :
( nTransparencePercent < 63 ) ? 50 :
( nTransparencePercent < 88 ) ? 75 : 100;
switch( nTrans )
{
case( 25 ): nMove = nBaseExtent * 3; break;
case( 50 ): nMove = nBaseExtent * 4; break;
case( 75 ): nMove = nBaseExtent * 6; break;
// #i112959# very transparent (88 < nTransparencePercent <= 99)
case( 100 ): nMove = nBaseExtent * 8; break;
// #i112959# not transparent (nTransparencePercent < 13)
default: nMove = 0; break;
2000-09-18 16:07:07 +00:00
}
Push( PUSH_CLIPREGION | PUSH_LINECOLOR );
IntersectClipRegion( rPolyPoly );
SetLineColor( GetFillColor() );
const BOOL bOldMap = mbMap;
EnableMapMode( FALSE );
2000-09-18 16:07:07 +00:00
if(nMove)
2000-09-18 16:07:07 +00:00
{
Rectangle aRect( aPolyRect.TopLeft(), Size( aPolyRect.GetWidth(), nBaseExtent ) );
while( aRect.Top() <= aPolyRect.Bottom() )
{
DrawRect( aRect );
aRect.Move( 0, nMove );
}
aRect = Rectangle( aPolyRect.TopLeft(), Size( nBaseExtent, aPolyRect.GetHeight() ) );
while( aRect.Left() <= aPolyRect.Right() )
{
DrawRect( aRect );
aRect.Move( nMove, 0 );
}
2000-09-18 16:07:07 +00:00
}
else
2000-09-18 16:07:07 +00:00
{
// #i112959# if not transparent, draw full rectangle in clip region
DrawRect( aPolyRect );
2000-09-18 16:07:07 +00:00
}
EnableMapMode( bOldMap );
2000-09-18 16:07:07 +00:00
Pop();
}
else
{
PolyPolygon aPolyPoly( LogicToPixel( rPolyPoly ) );
2000-09-18 16:07:07 +00:00
Rectangle aPolyRect( aPolyPoly.GetBoundRect() );
Point aPoint;
Rectangle aDstRect( aPoint, GetOutputSizePixel() );
aDstRect.Intersection( aPolyRect );
if( OUTDEV_WINDOW == meOutDevType )
{
const Region aPaintRgn( ( (Window*) this )->GetPaintRegion() );
if( !aPaintRgn.IsNull() )
aDstRect.Intersection( LogicToPixel( aPaintRgn ).GetBoundRect() );
}
if( !aDstRect.IsEmpty() )
{
// #i66849# Added fast path for exactly rectangular
// polygons
// #i83087# Naturally, system alpha blending cannot
// work with separate alpha VDev
if( !mpAlphaVDev && !pDisableNative && aPolyPoly.IsRect() )
{
// setup Graphics only here (other cases delegate
// to basic OutDev methods)
if( 1 )
{
if ( mbInitClipRegion )
ImplInitClipRegion();
if ( mbInitLineColor )
ImplInitLineColor();
if ( mbInitFillColor )
ImplInitFillColor();
Rectangle aLogicPolyRect( rPolyPoly.GetBoundRect() );
Rectangle aPixelRect( ImplLogicToDevicePixel( aLogicPolyRect ) );
if( !mbOutputClipped )
CWS-TOOLING: integrate CWS aw063 2009-02-12 13:10:24 +0100 aw r267649 : #i99123# when a primitive is invisible, it is not sufficient to produce no output when decomposing, but to add invisible data using HitTestPrimitive2D. This is needed for the slideshow which relies on geometry data in MetaFiles when painting invisible objects 2009-02-12 13:08:39 +0100 aw r267648 : #i99123# do not ignore HitTestPrimitive2D, but draw empty rectangles instead. This is needed since Slideshow is based on getting MetaFile content when painting invisible objects 2009-02-11 16:04:28 +0100 aw r267620 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:04:10 +0100 aw r267619 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:03:56 +0100 aw r267618 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:03:39 +0100 aw r267617 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:03:21 +0100 aw r267615 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:02:48 +0100 aw r267614 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:02:24 +0100 aw r267613 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:02:01 +0100 aw r267612 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:01:32 +0100 aw r267611 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:01:05 +0100 aw r267610 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:00:15 +0100 aw r267608 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 11:27:33 +0100 aw r267585 : #i98788# added missing include for STL 2009-02-10 17:46:50 +0100 aw r267570 : #i98788# added reaction on pool destruction 2009-02-10 17:11:58 +0100 aw r267562 : #i98788# added messaging mechanism to register for pool destruction 2009-02-10 13:35:35 +0100 aw r267549 : #i98788# removing changes, too complicated and risky for 3.1 2009-02-10 12:13:48 +0100 aw r267546 : #i98788# 4th round 2009-02-10 12:13:37 +0100 aw r267545 : #i98788# 4th round 2009-02-10 12:13:26 +0100 aw r267544 : #i98788# 4th round 2009-02-10 12:13:14 +0100 aw r267543 : #i98788# 4th round 2009-02-10 12:13:03 +0100 aw r267542 : #i98788# 4th round 2009-02-10 12:12:50 +0100 aw r267541 : #i98788# 4th round 2009-02-10 12:12:37 +0100 aw r267540 : #i98788# 4th round 2009-02-08 14:38:22 +0100 aw r267495 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:38:06 +0100 aw r267494 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:37:48 +0100 aw r267493 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:37:17 +0100 aw r267492 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:56 +0100 aw r267491 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:44 +0100 aw r267490 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:29 +0100 aw r267489 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:16 +0100 aw r267488 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:02 +0100 aw r267487 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:35:46 +0100 aw r267486 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-05 12:20:39 +0100 aw r267415 : #i98788# 2nd batch of adaptions for SfxItemPoolHolder addition 2009-02-04 15:12:54 +0100 aw r267385 : #i98788# added newline at EOF 2009-02-04 13:26:04 +0100 aw r267379 : #i98788# make SfxItemPool holdable 2009-02-04 13:25:40 +0100 aw r267378 : #i98788# make SfxItemPool holdable 2009-02-04 13:25:08 +0100 aw r267377 : #i98788# make SfxItemPool holdable 2009-02-04 13:24:42 +0100 aw r267376 : #i98788# make SfxItemPool holdable 2009-02-04 13:23:14 +0100 aw r267375 : #i98788# make SfxItemPool holdable 2009-02-04 13:23:02 +0100 aw r267374 : #i98788# make SfxItemPool holdable 2009-01-29 17:08:31 +0100 aw r267159 : #i97628# completed the fix 2009-01-29 17:08:15 +0100 aw r267158 : #i97628# completed the fix 2009-01-29 14:09:07 +0100 aw r267132 : #i97628# Corrected usage of ParagraphData in headers 2009-01-29 14:06:58 +0100 iha r267131 : #i98344# incorrect font size in charts 2009-01-29 12:13:46 +0100 aw r267115 : #i97628# back to old state; triggers too many errors in other modules 2009-01-29 12:03:51 +0100 aw r267114 : #i97628# enabled exceptions due to STL vector include 2009-01-29 11:21:37 +0100 aw r267107 : #i97628# added needed include 2009-01-28 17:58:29 +0100 aw r267077 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-28 17:58:12 +0100 aw r267076 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-28 17:57:51 +0100 aw r267074 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-28 17:57:21 +0100 aw r267073 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-27 17:07:33 +0100 aw r267011 : #i98402# added support for ViewRange when exporting MetaFiles in ObjectContactOfPageView::DoProcessDisplay to avoid to paint too much 2009-01-27 11:45:48 +0100 aw r266973 : #i98404# Added a warning to a place where a conversion to rectangle should not be copied from 2009-01-26 21:44:36 +0100 iha r266949 : #i98497# 3D charts are rendered with wrong size 2009-01-26 20:47:07 +0100 aw r266947 : #i98404# handle BackgroundColorPrimitive2D directly in PixelRenderers and avoid AA under all circumstances 2009-01-26 14:50:36 +0100 aw r266926 : #i98386# secured cloning of SdrObject in IMapUserData by boost::shared_prt usage 2009-01-26 12:51:30 +0100 aw r266916 : #i96581# added separated FontStretching and fallback for small X!=Y scale differences 2009-01-23 16:14:55 +0100 aw r266834 : #i96475# added missing implementation of TextDecoratedPortionPrimitive2D::getB2DRange 2009-01-23 15:24:34 +0100 aw r266826 : #i98405# fixed fallback to DrawAlphaRect to use the correctly sized rectangle 2009-01-23 13:34:43 +0100 aw r266813 : #i96474# fixed impSplitSingleWords for an unexpected case 2009-01-23 10:47:31 +0100 aw r266786 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:47:20 +0100 aw r266785 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:47:09 +0100 aw r266783 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:46:58 +0100 aw r266782 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:46:48 +0100 aw r266781 : #i98289#,#i96474# tooling and new flags for tasks
2009-03-04 14:16:02 +00:00
{
bDrawn = mpGraphics->DrawAlphaRect(
aPixelRect.Left(), aPixelRect.Top(),
// #i98405# use methods with small g, else one pixel too much will be painted.
// This is because the source is a polygon which when painted would not paint
// the rightmost and lowest pixel line(s), so use one pixel less for the
// rectangle, too.
aPixelRect.getWidth(), aPixelRect.getHeight(),
sal::static_int_cast<sal_uInt8>(nTransparencePercent),
this );
}
else
bDrawn = true;
}
}
2000-09-18 16:07:07 +00:00
if( !bDrawn )
2000-09-18 16:07:07 +00:00
{
VirtualDevice aVDev( *this, 1 );
const Size aDstSz( aDstRect.GetSize() );
const BYTE cTrans = (BYTE) MinMax( FRound( nTransparencePercent * 2.55 ), 0, 255 );
if( aDstRect.Left() || aDstRect.Top() )
aPolyPoly.Move( -aDstRect.Left(), -aDstRect.Top() );
2000-09-18 16:07:07 +00:00
if( aVDev.SetOutputSizePixel( aDstSz ) )
{
const BOOL bOldMap = mbMap;
2000-09-18 16:07:07 +00:00
EnableMapMode( FALSE );
2000-09-18 16:07:07 +00:00
aVDev.SetLineColor( COL_BLACK );
aVDev.SetFillColor( COL_BLACK );
aVDev.DrawPolyPolygon( aPolyPoly );
2000-09-18 16:07:07 +00:00
Bitmap aPaint( GetBitmap( aDstRect.TopLeft(), aDstSz ) );
Bitmap aPolyMask( aVDev.GetBitmap( Point(), aDstSz ) );
2000-09-18 16:07:07 +00:00
// #107766# check for non-empty bitmaps before accessing them
if( !!aPaint && !!aPolyMask )
{
BitmapWriteAccess* pW = aPaint.AcquireWriteAccess();
BitmapReadAccess* pR = aPolyMask.AcquireReadAccess();
2000-09-18 16:07:07 +00:00
if( pW && pR )
{
BitmapColor aPixCol;
const BitmapColor aFillCol( GetFillColor() );
const BitmapColor aWhite( pR->GetBestMatchingColor( Color( COL_WHITE ) ) );
const BitmapColor aBlack( pR->GetBestMatchingColor( Color( COL_BLACK ) ) );
const long nWidth = pW->Width(), nHeight = pW->Height();
const long nR = aFillCol.GetRed(), nG = aFillCol.GetGreen(), nB = aFillCol.GetBlue();
long nX, nY;
if( aPaint.GetBitCount() <= 8 )
{
const BitmapPalette& rPal = pW->GetPalette();
const USHORT nCount = rPal.GetEntryCount();
BitmapColor* pMap = (BitmapColor*) new BYTE[ nCount * sizeof( BitmapColor ) ];
2000-09-18 16:07:07 +00:00
for( USHORT i = 0; i < nCount; i++ )
{
BitmapColor aCol( rPal[ i ] );
pMap[ i ] = BitmapColor( (BYTE) rPal.GetBestIndex( aCol.Merge( aFillCol, cTrans ) ) );
}
2000-09-18 16:07:07 +00:00
if( pR->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL &&
pW->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL )
2000-09-18 16:07:07 +00:00
{
const BYTE cBlack = aBlack.GetIndex();
2000-09-18 16:07:07 +00:00
for( nY = 0; nY < nHeight; nY++ )
{
Scanline pWScan = pW->GetScanline( nY );
Scanline pRScan = pR->GetScanline( nY );
BYTE cBit = 128;
for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan++ )
{
if( !cBit )
cBit = 128, pRScan++;
if( ( *pRScan & cBit ) == cBlack )
*pWScan = (BYTE) pMap[ *pWScan ].GetIndex();
}
}
2000-09-18 16:07:07 +00:00
}
else
{
for( nY = 0; nY < nHeight; nY++ )
for( nX = 0; nX < nWidth; nX++ )
if( pR->GetPixel( nY, nX ) == aBlack )
pW->SetPixel( nY, nX, pMap[ pW->GetPixel( nY, nX ).GetIndex() ] );
}
delete[] (BYTE*) pMap;
2000-09-18 16:07:07 +00:00
}
else
{
if( pR->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL &&
pW->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR )
2000-09-18 16:07:07 +00:00
{
const BYTE cBlack = aBlack.GetIndex();
2000-09-18 16:07:07 +00:00
for( nY = 0; nY < nHeight; nY++ )
2000-09-18 16:07:07 +00:00
{
Scanline pWScan = pW->GetScanline( nY );
Scanline pRScan = pR->GetScanline( nY );
BYTE cBit = 128;
for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan += 3 )
{
if( !cBit )
cBit = 128, pRScan++;
if( ( *pRScan & cBit ) == cBlack )
{
pWScan[ 0 ] = COLOR_CHANNEL_MERGE( pWScan[ 0 ], nB, cTrans );
pWScan[ 1 ] = COLOR_CHANNEL_MERGE( pWScan[ 1 ], nG, cTrans );
pWScan[ 2 ] = COLOR_CHANNEL_MERGE( pWScan[ 2 ], nR, cTrans );
}
}
2000-09-18 16:07:07 +00:00
}
}
else
2000-09-18 16:07:07 +00:00
{
for( nY = 0; nY < nHeight; nY++ )
2000-09-18 16:07:07 +00:00
{
for( nX = 0; nX < nWidth; nX++ )
{
if( pR->GetPixel( nY, nX ) == aBlack )
{
aPixCol = pW->GetColor( nY, nX );
pW->SetPixel( nY, nX, aPixCol.Merge( aFillCol, cTrans ) );
}
}
2000-09-18 16:07:07 +00:00
}
}
}
}
aPolyMask.ReleaseAccess( pR );
aPaint.ReleaseAccess( pW );
2000-09-18 16:07:07 +00:00
DrawBitmap( aDstRect.TopLeft(), aPaint );
2000-09-18 16:07:07 +00:00
EnableMapMode( bOldMap );
2000-09-18 16:07:07 +00:00
if( mbLineColor )
{
Push( PUSH_FILLCOLOR );
SetFillColor();
DrawPolyPolygon( rPolyPoly );
Pop();
}
}
2000-09-18 16:07:07 +00:00
}
else
DrawPolyPolygon( rPolyPoly );
2000-09-18 16:07:07 +00:00
}
}
}
mpMetaFile = pOldMetaFile;
// #110958# Restore disabled alpha VDev
mpAlphaVDev = pOldAlphaVDev;
// #110958# Apply alpha value also to VDev alpha channel
if( mpAlphaVDev )
{
const Color aFillCol( mpAlphaVDev->GetFillColor() );
mpAlphaVDev->SetFillColor( Color(sal::static_int_cast<UINT8>(255*nTransparencePercent/100),
sal::static_int_cast<UINT8>(255*nTransparencePercent/100),
sal::static_int_cast<UINT8>(255*nTransparencePercent/100)) );
mpAlphaVDev->DrawTransparent( rPolyPoly, nTransparencePercent );
mpAlphaVDev->SetFillColor( aFillCol );
}
2000-09-18 16:07:07 +00:00
}
}
// -----------------------------------------------------------------------
void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
const Size& rSize, const Gradient& rTransparenceGradient )
{
DBG_TRACE( "OutputDevice::DrawTransparent()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
const Color aBlack( COL_BLACK );
if( mpMetaFile )
mpMetaFile->AddAction( new MetaFloatTransparentAction( rMtf, rPos, rSize, rTransparenceGradient ) );
2001-05-07 09:35:52 +00:00
if( ( rTransparenceGradient.GetStartColor() == aBlack && rTransparenceGradient.GetEndColor() == aBlack ) ||
( mnDrawMode & ( DRAWMODE_NOTRANSPARENCY ) ) )
2000-09-18 16:07:07 +00:00
{
( (GDIMetaFile&) rMtf ).WindStart();
( (GDIMetaFile&) rMtf ).Play( this, rPos, rSize );
( (GDIMetaFile&) rMtf ).WindStart();
}
else
{
GDIMetaFile* pOldMetaFile = mpMetaFile;
Rectangle aOutRect( LogicToPixel( rPos ), LogicToPixel( rSize ) );
Point aPoint;
Rectangle aDstRect( aPoint, GetOutputSizePixel() );
mpMetaFile = NULL;
aDstRect.Intersection( aOutRect );
if( OUTDEV_WINDOW == meOutDevType )
{
const Region aPaintRgn( ( (Window*) this )->GetPaintRegion() );
if( !aPaintRgn.IsNull() )
aDstRect.Intersection( LogicToPixel( aPaintRgn.GetBoundRect() ) );
}
if( !aDstRect.IsEmpty() )
{
VirtualDevice* pVDev = new VirtualDevice;
((OutputDevice*)pVDev)->mnDPIX = mnDPIX;
((OutputDevice*)pVDev)->mnDPIY = mnDPIY;
2000-09-18 16:07:07 +00:00
if( pVDev->SetOutputSizePixel( aDstRect.GetSize() ) )
{
CWS-TOOLING: integrate CWS aw075 2009-08-12 18:26:05 +0200 aw r274912 : #i97672# use SelectionMaximumLuminancePercent to limit the hilight color to be not too invisible 2009-08-12 18:25:53 +0200 aw r274911 : #i97672# use SelectionMaximumLuminancePercent to limit the hilight color to be not too invisible 2009-08-12 18:25:20 +0200 aw r274910 : #i97672# Added SelectionMaximumLuminancePercent to decide which maximum luminance for the selection color to accept from the system 2009-08-12 18:00:17 +0200 aw r274908 : #i97672# added SelectionMaximumLuminancePercent which limits the luminance of the system's selection color to a maximum luminance (default is 70) 2009-08-11 14:01:07 +0200 aw r274859 : #i104150# take over values from transparence percent field even when disabled 2009-08-11 13:59:33 +0200 aw r274858 : #i103500# corrected the transparent SC overlay pixel alignment 2009-08-11 12:42:46 +0200 jsk r274854 : #i103937# Added two new controls to options/view page for transparency and opacity 2009-08-10 16:20:02 +0200 aw r274823 : #i97672# Adapting MF_SELECTION to #i35956# 2009-08-04 17:50:42 +0200 aw r274626 : #i102109# need to use AlphaMask instead of Bitmap 2009-08-04 17:03:25 +0200 aw r274624 : #i103982# corrected OutlinerParaObject owvership in GetBackgroundTextForwarder() 2009-08-04 12:18:11 +0200 aw r274614 : #i97672# corrected warning due to member initialisation 2009-08-03 11:54:16 +0200 aw r274571 : #i99268# corrected SdrExchangeView::GetObjGraphic 2009-07-31 14:22:57 +0200 aw r274529 : #i101520# added support for not correct 3d polygons for 3D polygon object which is used over API from chart directly 2009-07-31 13:25:20 +0200 aw r274527 : #i97672# added disabling selection options when system does not support them; slightly corrected positions 2009-07-31 13:20:32 +0200 aw r274526 : #i102706# Do not merge closed polygons when converting MetaFiles to SdrObjects 2009-07-30 18:03:07 +0200 aw r274499 : #i102175# corrected 1870 degree rotation situation for MetaFile paints 2009-07-30 17:06:31 +0200 aw r274496 : #i103709# corrected HitTest for callouts and DrawingLayer text objects 2009-07-29 18:55:22 +0200 aw r274465 : #i102956# corrected CutFindProcessor to back-transform all found cuts to the starting 3D coordinate system 2009-07-29 13:38:40 +0200 aw r274448 : #i103720# corrected mpAsynchLoadEvent usage 2009-07-29 12:48:12 +0200 aw r274447 : #i96762# cleanup: spaces 2009-07-28 19:11:31 +0200 aw r274427 : #97672# first version of reworked selection with changeable transparency and frame 2009-07-28 19:09:39 +0200 aw r274425 : #97672# first version of reworked selection with changeable transparency and frame 2009-07-28 19:09:27 +0200 aw r274424 : #97672# first version of reworked selection with changeable transparency and frame 2009-07-28 19:09:14 +0200 aw r274423 : #97672# first version of reworked selection with changeable transparency and frame 2009-07-28 19:08:59 +0200 aw r274422 : #97672# first version of reworked selection with changeable transparency and frame 2009-07-28 19:08:47 +0200 aw r274421 : #97672# first version of reworked selection with changeable transparency and frame 2009-07-28 15:44:50 +0200 aw r274411 : #i102556# corrected TextLayouterDevice::getTextBoundRect implementation and usage; empty Rectangles were not handled correctly 2009-07-23 17:48:36 +0200 aw r274277 : #i102063# implemented in-between OLE content holder (SdrOleContentPrimitive2D) and it's decomposition. Cleaned up diverse OLE graphic preparations 2009-07-22 12:55:12 +0200 aw r274227 : #i102109# extended OutputDevice::DrawTransparent (the version with TransparenceGradient) to work correctly with AntiAliased content 2009-07-21 13:31:12 +0200 aw r274191 : #i102611# changed scaling of Z-Range for Z-Buffer for ZBufferProcessor3D 2009-07-20 20:06:46 +0200 aw r274155 : #i103500# moved OverlayObjectCell back to use discrete coordinates for rectangle list 2009-07-16 17:33:26 +0200 aw r274065 : #i103530# corrected parameter preparation for MetaFile::Rotate call
2009-08-26 14:41:39 +00:00
if(GetAntialiasing())
{
// #i102109#
// For MetaFile replay (see task) it may now be neccessary to take
// into account that the content is AntiAlialised and needs to be masked
// like that. Instead of masking, i will use a copy-modify-paste cycle
// here (as i already use in the VclPrimiziveRenderer with successs)
pVDev->SetAntialiasing(GetAntialiasing());
// create MapMode for buffer (offset needed) and set
MapMode aMap(GetMapMode());
const Point aOutPos(PixelToLogic(aDstRect.TopLeft()));
aMap.SetOrigin(Point(-aOutPos.X(), -aOutPos.Y()));
pVDev->SetMapMode(aMap);
// copy MapMode state and disable for target
const bool bOrigMapModeEnabled(IsMapModeEnabled());
EnableMapMode(false);
// copy MapMode state and disable for buffer
const bool bBufferMapModeEnabled(pVDev->IsMapModeEnabled());
pVDev->EnableMapMode(false);
// copy content from original to buffer
pVDev->DrawOutDev(
aPoint, pVDev->GetOutputSizePixel(), // dest
aDstRect.TopLeft(), pVDev->GetOutputSizePixel(), // source
*this);
// draw MetaFile to buffer
pVDev->EnableMapMode(bBufferMapModeEnabled);
((GDIMetaFile&)rMtf).WindStart();
((GDIMetaFile&)rMtf).Play(pVDev, rPos, rSize);
((GDIMetaFile&)rMtf).WindStart();
// get content bitmap from buffer
pVDev->EnableMapMode(false);
const Bitmap aPaint(pVDev->GetBitmap(aPoint, pVDev->GetOutputSizePixel()));
// create alpha mask from gradient and get as Bitmap
pVDev->EnableMapMode(bBufferMapModeEnabled);
pVDev->SetDrawMode(DRAWMODE_GRAYGRADIENT);
pVDev->DrawGradient(Rectangle(rPos, rSize), rTransparenceGradient);
pVDev->SetDrawMode(DRAWMODE_DEFAULT);
pVDev->EnableMapMode(false);
const AlphaMask aAlpha(pVDev->GetBitmap(aPoint, pVDev->GetOutputSizePixel()));
// draw masked content to target and restore MapMode
DrawBitmapEx(aDstRect.TopLeft(), BitmapEx(aPaint, aAlpha));
EnableMapMode(bOrigMapModeEnabled);
}
else
{
Bitmap aPaint, aMask;
AlphaMask aAlpha;
MapMode aMap( GetMapMode() );
Point aOutPos( PixelToLogic( aDstRect.TopLeft() ) );
const BOOL bOldMap = mbMap;
aMap.SetOrigin( Point( -aOutPos.X(), -aOutPos.Y() ) );
pVDev->SetMapMode( aMap );
const BOOL bVDevOldMap = pVDev->IsMapModeEnabled();
// create paint bitmap
( (GDIMetaFile&) rMtf ).WindStart();
( (GDIMetaFile&) rMtf ).Play( pVDev, rPos, rSize );
( (GDIMetaFile&) rMtf ).WindStart();
pVDev->EnableMapMode( FALSE );
aPaint = pVDev->GetBitmap( Point(), pVDev->GetOutputSizePixel() );
pVDev->EnableMapMode( bVDevOldMap ); // #i35331#: MUST NOT use EnableMapMode( TRUE ) here!
// create mask bitmap
pVDev->SetLineColor( COL_BLACK );
pVDev->SetFillColor( COL_BLACK );
pVDev->DrawRect( Rectangle( pVDev->PixelToLogic( Point() ), pVDev->GetOutputSize() ) );
pVDev->SetDrawMode( DRAWMODE_WHITELINE | DRAWMODE_WHITEFILL | DRAWMODE_WHITETEXT |
DRAWMODE_WHITEBITMAP | DRAWMODE_WHITEGRADIENT );
( (GDIMetaFile&) rMtf ).WindStart();
( (GDIMetaFile&) rMtf ).Play( pVDev, rPos, rSize );
( (GDIMetaFile&) rMtf ).WindStart();
pVDev->EnableMapMode( FALSE );
aMask = pVDev->GetBitmap( Point(), pVDev->GetOutputSizePixel() );
pVDev->EnableMapMode( bVDevOldMap ); // #i35331#: MUST NOT use EnableMapMode( TRUE ) here!
// create alpha mask from gradient
pVDev->SetDrawMode( DRAWMODE_GRAYGRADIENT );
pVDev->DrawGradient( Rectangle( rPos, rSize ), rTransparenceGradient );
pVDev->SetDrawMode( DRAWMODE_DEFAULT );
pVDev->EnableMapMode( FALSE );
pVDev->DrawMask( Point(), pVDev->GetOutputSizePixel(), aMask, Color( COL_WHITE ) );
aAlpha = pVDev->GetBitmap( Point(), pVDev->GetOutputSizePixel() );
delete pVDev;
EnableMapMode( FALSE );
DrawBitmapEx( aDstRect.TopLeft(), BitmapEx( aPaint, aAlpha ) );
EnableMapMode( bOldMap );
}
2000-09-18 16:07:07 +00:00
}
else
delete pVDev;
}
mpMetaFile = pOldMetaFile;
}
}
// -----------------------------------------------------------------------
void OutputDevice::ImplDrawColorWallpaper( long nX, long nY,
long nWidth, long nHeight,
const Wallpaper& rWallpaper )
{
// Wallpaper ohne Umrandung zeichnen
Color aOldLineColor = GetLineColor();
Color aOldFillColor = GetFillColor();
SetLineColor();
SetFillColor( rWallpaper.GetColor() );
BOOL bMap = mbMap;
EnableMapMode( FALSE );
DrawRect( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ) );
2000-09-18 16:07:07 +00:00
SetLineColor( aOldLineColor );
SetFillColor( aOldFillColor );
EnableMapMode( bMap );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void OutputDevice::ImplDrawBitmapWallpaper( long nX, long nY,
long nWidth, long nHeight,
const Wallpaper& rWallpaper )
{
BitmapEx aBmpEx;
const BitmapEx* pCached = rWallpaper.ImplGetImpWallpaper()->ImplGetCachedBitmap();
Point aPos;
Size aSize;
GDIMetaFile* pOldMetaFile = mpMetaFile;
const WallpaperStyle eStyle = rWallpaper.GetStyle();
const BOOL bOldMap = mbMap;
BOOL bDrawn = FALSE;
BOOL bDrawGradientBackground = FALSE;
BOOL bDrawColorBackground = FALSE;
if( pCached )
aBmpEx = *pCached;
else
aBmpEx = rWallpaper.GetBitmap();
const long nBmpWidth = aBmpEx.GetSizePixel().Width();
const long nBmpHeight = aBmpEx.GetSizePixel().Height();
const BOOL bTransparent = aBmpEx.IsTransparent();
// draw background
if( bTransparent )
{
if( rWallpaper.IsGradient() )
bDrawGradientBackground = TRUE;
else
{
if( !pCached && !rWallpaper.GetColor().GetTransparency() )
{
VirtualDevice aVDev( *this );
aVDev.SetBackground( rWallpaper.GetColor() );
aVDev.SetOutputSizePixel( Size( nBmpWidth, nBmpHeight ) );
aVDev.DrawBitmapEx( Point(), aBmpEx );
aBmpEx = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() );
}
bDrawColorBackground = TRUE;
}
}
else if( eStyle != WALLPAPER_TILE && eStyle != WALLPAPER_SCALE )
{
if( rWallpaper.IsGradient() )
bDrawGradientBackground = TRUE;
else
bDrawColorBackground = TRUE;
}
// background of bitmap?
if( bDrawGradientBackground )
ImplDrawGradientWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
else if( bDrawColorBackground && bTransparent )
{
ImplDrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
bDrawColorBackground = FALSE;
}
// calc pos and size
if( rWallpaper.IsRect() )
{
const Rectangle aBound( LogicToPixel( rWallpaper.GetRect() ) );
aPos = aBound.TopLeft();
aSize = aBound.GetSize();
}
else
{
aPos = Point( nX, nY );
aSize = Size( nWidth, nHeight );
}
mpMetaFile = NULL;
EnableMapMode( FALSE );
2000-09-18 16:07:07 +00:00
Push( PUSH_CLIPREGION );
IntersectClipRegion( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ) );
switch( eStyle )
{
case( WALLPAPER_SCALE ):
{
if( !pCached || ( pCached->GetSizePixel() != aSize ) )
{
if( pCached )
rWallpaper.ImplGetImpWallpaper()->ImplReleaseCachedBitmap();
aBmpEx = rWallpaper.GetBitmap();
aBmpEx.Scale( aSize );
aBmpEx = BitmapEx( aBmpEx.GetBitmap().CreateDisplayBitmap( this ), aBmpEx.GetMask() );
}
}
break;
case( WALLPAPER_TOPLEFT ):
break;
case( WALLPAPER_TOP ):
aPos.X() += ( aSize.Width() - nBmpWidth ) >> 1;
break;
case( WALLPAPER_TOPRIGHT ):
aPos.X() += ( aSize.Width() - nBmpWidth );
break;
case( WALLPAPER_LEFT ):
aPos.Y() += ( aSize.Height() - nBmpHeight ) >> 1;
break;
case( WALLPAPER_CENTER ):
{
aPos.X() += ( aSize.Width() - nBmpWidth ) >> 1;
aPos.Y() += ( aSize.Height() - nBmpHeight ) >> 1;
}
break;
case( WALLPAPER_RIGHT ):
{
aPos.X() += ( aSize.Width() - nBmpWidth );
aPos.Y() += ( aSize.Height() - nBmpHeight ) >> 1;
}
break;
case( WALLPAPER_BOTTOMLEFT ):
aPos.Y() += ( aSize.Height() - nBmpHeight );
break;
case( WALLPAPER_BOTTOM ):
{
aPos.X() += ( aSize.Width() - nBmpWidth ) >> 1;
aPos.Y() += ( aSize.Height() - nBmpHeight );
}
break;
case( WALLPAPER_BOTTOMRIGHT ):
{
aPos.X() += ( aSize.Width() - nBmpWidth );
aPos.Y() += ( aSize.Height() - nBmpHeight );
}
break;
default:
{
const long nRight = nX + nWidth - 1L;
const long nBottom = nY + nHeight - 1L;
long nFirstX;
long nFirstY;
if( eStyle == WALLPAPER_TILE )
{
nFirstX = aPos.X();
nFirstY = aPos.Y();
}
else
{
nFirstX = aPos.X() + ( ( aSize.Width() - nBmpWidth ) >> 1 );
nFirstY = aPos.Y() + ( ( aSize.Height() - nBmpHeight ) >> 1 );
}
const long nOffX = ( nFirstX - nX ) % nBmpWidth;
const long nOffY = ( nFirstY - nY ) % nBmpHeight;
long nStartX = nX + nOffX;
long nStartY = nY + nOffY;
if( nOffX > 0L )
nStartX -= nBmpWidth;
if( nOffY > 0L )
nStartY -= nBmpHeight;
for( long nBmpY = nStartY; nBmpY <= nBottom; nBmpY += nBmpHeight )
for( long nBmpX = nStartX; nBmpX <= nRight; nBmpX += nBmpWidth )
DrawBitmapEx( Point( nBmpX, nBmpY ), aBmpEx );
bDrawn = TRUE;
}
break;
}
if( !bDrawn )
{
// optimized for non-transparent bitmaps
if( bDrawColorBackground )
{
const Size aBmpSize( aBmpEx.GetSizePixel() );
const Point aTmpPoint;
const Rectangle aOutRect( aTmpPoint, GetOutputSizePixel() );
const Rectangle aColRect( Point( nX, nY ), Size( nWidth, nHeight ) );
Rectangle aWorkRect;
aWorkRect = Rectangle( 0, 0, aOutRect.Right(), aPos.Y() - 1L );
aWorkRect.Justify();
aWorkRect.Intersection( aColRect );
if( !aWorkRect.IsEmpty() )
{
ImplDrawColorWallpaper( aWorkRect.Left(), aWorkRect.Top(),
aWorkRect.GetWidth(), aWorkRect.GetHeight(),
rWallpaper );
}
aWorkRect = Rectangle( 0, aPos.Y(), aPos.X() - 1L, aPos.Y() + aBmpSize.Height() - 1L );
aWorkRect.Justify();
aWorkRect.Intersection( aColRect );
if( !aWorkRect.IsEmpty() )
{
ImplDrawColorWallpaper( aWorkRect.Left(), aWorkRect.Top(),
aWorkRect.GetWidth(), aWorkRect.GetHeight(),
rWallpaper );
}
aWorkRect = Rectangle( aPos.X() + aBmpSize.Width(), aPos.Y(), aOutRect.Right(), aPos.Y() + aBmpSize.Height() - 1L );
aWorkRect.Justify();
aWorkRect.Intersection( aColRect );
if( !aWorkRect.IsEmpty() )
{
ImplDrawColorWallpaper( aWorkRect.Left(), aWorkRect.Top(),
aWorkRect.GetWidth(), aWorkRect.GetHeight(),
rWallpaper );
}
aWorkRect = Rectangle( 0, aPos.Y() + aBmpSize.Height(), aOutRect.Right(), aOutRect.Bottom() );
aWorkRect.Justify();
aWorkRect.Intersection( aColRect );
if( !aWorkRect.IsEmpty() )
{
ImplDrawColorWallpaper( aWorkRect.Left(), aWorkRect.Top(),
aWorkRect.GetWidth(), aWorkRect.GetHeight(),
rWallpaper );
}
}
DrawBitmapEx( aPos, aBmpEx );
}
rWallpaper.ImplGetImpWallpaper()->ImplSetCachedBitmap( aBmpEx );
Pop();
EnableMapMode( bOldMap );
2000-09-18 16:07:07 +00:00
mpMetaFile = pOldMetaFile;
}
// -----------------------------------------------------------------------
void OutputDevice::ImplDrawGradientWallpaper( long nX, long nY,
long nWidth, long nHeight,
const Wallpaper& rWallpaper )
{
Rectangle aBound;
GDIMetaFile* pOldMetaFile = mpMetaFile;
const BOOL bOldMap = mbMap;
BOOL bNeedGradient = TRUE;
2000-09-18 16:07:07 +00:00
/*
if ( rWallpaper.IsRect() )
aBound = LogicToPixel( rWallpaper.GetRect() );
else
*/
aBound = Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) );
mpMetaFile = NULL;
EnableMapMode( FALSE );
2000-09-18 16:07:07 +00:00
Push( PUSH_CLIPREGION );
IntersectClipRegion( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ) );
if( OUTDEV_WINDOW == meOutDevType && rWallpaper.GetStyle() == WALLPAPER_APPLICATIONGRADIENT )
{
Window *pWin = dynamic_cast< Window* >( this );
if( pWin )
{
// limit gradient to useful size, so that it still can be noticed
// in maximized windows
long gradientWidth = pWin->GetDesktopRectPixel().GetSize().Width();
if( gradientWidth > 1024 )
gradientWidth = 1024;
if( mnOutOffX+nWidth > gradientWidth )
ImplDrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper.GetGradient().GetEndColor() );
if( mnOutOffX > gradientWidth )
bNeedGradient = FALSE;
else
aBound = Rectangle( Point( -mnOutOffX, nY ), Size( gradientWidth, nHeight ) );
}
}
if( bNeedGradient )
DrawGradient( aBound, rWallpaper.GetGradient() );
2000-09-18 16:07:07 +00:00
Pop();
EnableMapMode( bOldMap );
2000-09-18 16:07:07 +00:00
mpMetaFile = pOldMetaFile;
}
// -----------------------------------------------------------------------
void OutputDevice::ImplDrawWallpaper( long nX, long nY,
long nWidth, long nHeight,
const Wallpaper& rWallpaper )
{
if( rWallpaper.IsBitmap() )
ImplDrawBitmapWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
else if( rWallpaper.IsGradient() )
ImplDrawGradientWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
else
ImplDrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
}
// -----------------------------------------------------------------------
void OutputDevice::DrawWallpaper( const Rectangle& rRect,
const Wallpaper& rWallpaper )
{
if ( mpMetaFile )
mpMetaFile->AddAction( new MetaWallpaperAction( rRect, rWallpaper ) );
if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
2000-09-18 16:07:07 +00:00
return;
if ( rWallpaper.GetStyle() != WALLPAPER_NULL )
{
Rectangle aRect = LogicToPixel( rRect );
aRect.Justify();
if ( !aRect.IsEmpty() )
{
ImplDrawWallpaper( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(),
rWallpaper );
}
}
if( mpAlphaVDev )
mpAlphaVDev->DrawWallpaper( rRect, rWallpaper );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void OutputDevice::Erase()
{
if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
2000-09-18 16:07:07 +00:00
return;
BOOL bNativeOK = FALSE;
if( meOutDevType == OUTDEV_WINDOW )
{
Window* pWindow = static_cast<Window*>(this);
ControlPart aCtrlPart = pWindow->ImplGetWindowImpl()->mnNativeBackground;
if( aCtrlPart != 0 && ! pWindow->IsControlBackground() )
{
ImplControlValue aControlValue;
Point aGcc3WorkaroundTemporary;
Rectangle aCtrlRegion( aGcc3WorkaroundTemporary, GetOutputSizePixel() );
ControlState nState = 0;
if( pWindow->IsEnabled() ) nState |= CTRL_STATE_ENABLED;
bNativeOK = pWindow->DrawNativeControl( CTRL_WINDOW_BACKGROUND, aCtrlPart, aCtrlRegion,
nState, aControlValue, rtl::OUString() );
}
}
if ( mbBackground && ! bNativeOK )
2000-09-18 16:07:07 +00:00
{
RasterOp eRasterOp = GetRasterOp();
if ( eRasterOp != ROP_OVERPAINT )
SetRasterOp( ROP_OVERPAINT );
ImplDrawWallpaper( 0, 0, mnOutWidth, mnOutHeight, maBackground );
if ( eRasterOp != ROP_OVERPAINT )
SetRasterOp( eRasterOp );
}
if( mpAlphaVDev )
mpAlphaVDev->Erase();
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void OutputDevice::ImplDraw2ColorFrame( const Rectangle& rRect,
const Color& rLeftTopColor,
const Color& rRightBottomColor )
{
SetFillColor( rLeftTopColor );
DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Left(), rRect.Bottom()-1 ) ) );
DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Right()-1, rRect.Top() ) ) );
SetFillColor( rRightBottomColor );
DrawRect( Rectangle( rRect.BottomLeft(), rRect.BottomRight() ) );
DrawRect( Rectangle( rRect.TopRight(), rRect.BottomRight() ) );
}
// -----------------------------------------------------------------------
bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
2000-09-18 16:07:07 +00:00
const GfxLink& rGfxLink, GDIMetaFile* pSubst )
{
bool bDrawn(true);
2000-09-18 16:07:07 +00:00
if ( mpMetaFile )
{
GDIMetaFile aSubst;
if( pSubst )
aSubst = *pSubst;
mpMetaFile->AddAction( new MetaEPSAction( rPoint, rSize, rGfxLink, aSubst ) );
}
if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
return bDrawn;
2000-09-18 16:07:07 +00:00
if( mbOutputClipped )
return bDrawn;
2000-09-18 16:07:07 +00:00
Rectangle aRect( ImplLogicToDevicePixel( Rectangle( rPoint, rSize ) ) );
2000-09-18 16:07:07 +00:00
if( !aRect.IsEmpty() )
{
2008-10-01 13:46:45 +00:00
// draw the real EPS graphics
if( rGfxLink.GetData() && rGfxLink.GetDataSize() )
2000-09-18 16:07:07 +00:00
{
if( !mpGraphics && !ImplGetGraphics() )
return bDrawn;
2000-09-18 16:07:07 +00:00
if( mbInitClipRegion )
ImplInitClipRegion();
2008-10-01 13:46:45 +00:00
aRect.Justify();
bDrawn = mpGraphics->DrawEPS( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(),
(BYTE*) rGfxLink.GetData(), rGfxLink.GetDataSize(), this );
2000-09-18 16:07:07 +00:00
}
2008-10-01 13:46:45 +00:00
// else draw the substitution graphics
2000-09-18 16:07:07 +00:00
if( !bDrawn && pSubst )
{
GDIMetaFile* pOldMetaFile = mpMetaFile;
mpMetaFile = NULL;
Graphic( *pSubst ).Draw( this, rPoint, rSize );
mpMetaFile = pOldMetaFile;
}
}
if( mpAlphaVDev )
mpAlphaVDev->DrawEPS( rPoint, rSize, rGfxLink, pSubst );
return bDrawn;
2000-09-18 16:07:07 +00:00
}