2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 07:50:52 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:50:52 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:50:52 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:50:52 +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
|
|
|
*
|
2008-04-11 07:50:52 +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
|
|
|
*
|
2008-04-11 07:50:52 +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
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 11:07:42 +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>
|
2007-06-27 19:20:06 +00:00
|
|
|
#include <vcl/salgdi.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <tools/debug.hxx>
|
2007-07-24 09:13:08 +00:00
|
|
|
#include <vcl/outdev.h>
|
2007-06-27 19:20:06 +00:00
|
|
|
#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>
|
2007-07-24 09:13:08 +00:00
|
|
|
#include <vcl/wall2.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <com/sun/star/uno/Sequence.hxx>
|
|
|
|
|
2008-07-30 12:14:23 +00:00
|
|
|
#include <basegfx/vector/b2dvector.hxx>
|
2008-08-19 23:33:20 +00:00
|
|
|
#include <basegfx/polygon/b2dpolypolygon.hxx>
|
2008-07-30 12:14:23 +00:00
|
|
|
#include <basegfx/polygon/b2dpolygon.hxx>
|
|
|
|
#include <basegfx/matrix/b2dhommatrix.hxx>
|
2008-08-19 23:33:20 +00:00
|
|
|
#include <math.h>
|
2007-07-27 06:44:49 +00:00
|
|
|
#include <vcl/window.h>
|
2007-07-05 15:03:05 +00:00
|
|
|
#include <vcl/svdata.hxx>
|
2007-07-05 07:39:57 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// ========================================================================
|
|
|
|
|
2006-06-19 18:29:01 +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 );
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
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;
|
2003-11-24 16:33:45 +00:00
|
|
|
EnableMapMode( FALSE );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( nFlags & GRID_DOTS )
|
|
|
|
{
|
|
|
|
for( long i = 0L; i < nVertCount; i++ )
|
2006-06-19 18:29:01 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-24 16:33:45 +00:00
|
|
|
EnableMapMode( bOldMap );
|
|
|
|
|
|
|
|
if( mpAlphaVDev )
|
|
|
|
mpAlphaVDev->DrawGrid( rRect, rDist, nFlags );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2008-08-19 23:33:20 +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();
|
|
|
|
|
2009-07-27 16:24:52 +00:00
|
|
|
if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW)
|
|
|
|
&& mpGraphics->supportsOperation(OutDevSupport_B2DDraw)
|
2010-06-02 15:21:20 +02:00
|
|
|
&& ROP_OVERPAINT == GetRasterOp() )
|
2008-08-19 23:33:20 +00:00
|
|
|
{
|
|
|
|
// b2dpolygon support not implemented yet on non-UNX platforms
|
2008-11-19 14:05:59 +00:00
|
|
|
const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
|
2009-07-27 16:24:52 +00:00
|
|
|
basegfx::B2DPolyPolygon aB2DPolyPolygon(rB2DPolyPoly);
|
2008-08-19 23:33:20 +00:00
|
|
|
|
2010-06-02 15:21:20 +02:00
|
|
|
// 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 );
|
|
|
|
}
|
|
|
|
}
|
2009-07-27 16:24:52 +00:00
|
|
|
|
2010-06-02 15:21:20 +02:00
|
|
|
if( bDrawnOk )
|
2008-08-19 23:33:20 +00:00
|
|
|
{
|
|
|
|
#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 );
|
|
|
|
|
2008-07-30 12:14:23 +00:00
|
|
|
// short circuit for drawing an opaque polygon
|
|
|
|
if( (nTransparencePercent < 1) || ((mnDrawMode & DRAWMODE_NOTRANSPARENCY) != 0) )
|
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
DrawPolyPolygon( rPolyPoly );
|
2008-07-30 12:14:23 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// short circut for drawing an invisible polygon
|
|
|
|
if( !mbFillColor || (nTransparencePercent >= 100) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-07-30 12:14:23 +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();
|
2008-07-30 12:14:23 +00:00
|
|
|
return;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2008-07-30 12:14:23 +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() )
|
2006-11-14 14:23:21 +00:00
|
|
|
return;
|
|
|
|
|
2008-07-30 12:14:23 +00:00
|
|
|
// debug helper:
|
|
|
|
static const char* pDisableNative = getenv( "SAL_DISABLE_NATIVE_ALPHA");
|
|
|
|
|
2008-08-18 09:49:06 +00:00
|
|
|
// try hard to draw it directly, because the emulation layers are slower
|
2008-07-30 12:14:23 +00:00
|
|
|
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 )
|
2010-01-29 12:28:08 +00:00
|
|
|
#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
|
|
|
|
)
|
2008-07-30 12:14:23 +00:00
|
|
|
{
|
|
|
|
// prepare the graphics device
|
|
|
|
if( mbInitClipRegion )
|
|
|
|
ImplInitClipRegion();
|
|
|
|
if( mbOutputClipped )
|
2007-05-22 15:43:01 +00:00
|
|
|
return;
|
2008-07-30 12:14:23 +00:00
|
|
|
if( mbInitLineColor )
|
|
|
|
ImplInitLineColor();
|
|
|
|
if( mbInitFillColor )
|
|
|
|
ImplInitFillColor();
|
|
|
|
|
|
|
|
// get the polygon in device coordinates
|
2008-08-18 09:49:06 +00:00
|
|
|
basegfx::B2DPolyPolygon aB2DPolyPolygon( rPolyPoly.getB2DPolyPolygon() );
|
2008-07-30 12:14:23 +00:00
|
|
|
const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
|
|
|
|
aB2DPolyPolygon.transform( aTransform );
|
2007-05-22 15:43:01 +00:00
|
|
|
|
2010-06-02 15:21:20 +02:00
|
|
|
const double fTransparency = 0.01 * nTransparencePercent;
|
2010-06-08 15:14:30 +02:00
|
|
|
if( mbFillColor )
|
|
|
|
{
|
|
|
|
// draw the transparent polygon
|
2010-06-08 16:21:07 +02:00
|
|
|
// NOTE: filled polygons are assumed to be drawn as if they were always closed
|
2010-06-08 15:14:30 +02:00
|
|
|
bDrawn = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, fTransparency, this );
|
|
|
|
}
|
2008-07-30 12:14:23 +00:00
|
|
|
|
|
|
|
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 );
|
2010-06-08 16:21:07 +02:00
|
|
|
bDrawn = mpGraphics->DrawPolyLine( rPolygon, fTransparency, aLineWidths, ::basegfx::B2DLINEJOIN_NONE, this );
|
2008-07-30 12:14:23 +00:00
|
|
|
}
|
|
|
|
// prepare to restore the fill color
|
|
|
|
mbInitFillColor = mbFillColor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bDrawn )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( 1 )
|
|
|
|
{
|
2003-11-24 16:33:45 +00:00
|
|
|
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)
|
2010-07-14 18:50:58 +02:00
|
|
|
{
|
|
|
|
// #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;
|
2010-07-14 18:50:58 +02:00
|
|
|
|
|
|
|
// #i112959# very transparent (88 < nTransparencePercent <= 99)
|
|
|
|
case( 100 ): nMove = nBaseExtent * 8; break;
|
|
|
|
|
|
|
|
// #i112959# not transparent (nTransparencePercent < 13)
|
2004-09-08 14:07:09 +00:00
|
|
|
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;
|
2003-11-24 16:33:45 +00:00
|
|
|
EnableMapMode( FALSE );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-07-14 18:50:58 +02:00
|
|
|
if(nMove)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-07-14 18:50:58 +02: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
|
|
|
}
|
2010-07-14 18:50:58 +02:00
|
|
|
else
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-07-14 18:50:58 +02:00
|
|
|
// #i112959# if not transparent, draw full rectangle in clip region
|
|
|
|
DrawRect( aPolyRect );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2003-11-24 16:33:45 +00:00
|
|
|
EnableMapMode( bOldMap );
|
2000-09-18 16:07:07 +00:00
|
|
|
Pop();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-07-30 12:14:23 +00:00
|
|
|
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() )
|
|
|
|
{
|
2006-11-14 14:23:21 +00:00
|
|
|
// #i66849# Added fast path for exactly rectangular
|
|
|
|
// polygons
|
2008-01-29 07:04:33 +00:00
|
|
|
// #i83087# Naturally, system alpha blending cannot
|
|
|
|
// work with separate alpha VDev
|
|
|
|
if( !mpAlphaVDev && !pDisableNative && aPolyPoly.IsRect() )
|
2006-11-14 14:23:21 +00:00
|
|
|
{
|
|
|
|
// setup Graphics only here (other cases delegate
|
|
|
|
// to basic OutDev methods)
|
2008-07-30 12:14:23 +00:00
|
|
|
if( 1 )
|
2007-07-03 13:06:02 +00:00
|
|
|
{
|
|
|
|
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 );
|
|
|
|
}
|
2007-07-03 13:06:02 +00:00
|
|
|
else
|
|
|
|
bDrawn = true;
|
|
|
|
}
|
2006-11-14 14:23:21 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
if( !bDrawn )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-11-14 14:23:21 +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
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
if( aVDev.SetOutputSizePixel( aDstSz ) )
|
|
|
|
{
|
|
|
|
const BOOL bOldMap = mbMap;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
EnableMapMode( FALSE );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
aVDev.SetLineColor( COL_BLACK );
|
|
|
|
aVDev.SetFillColor( COL_BLACK );
|
|
|
|
aVDev.DrawPolyPolygon( aPolyPoly );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
Bitmap aPaint( GetBitmap( aDstRect.TopLeft(), aDstSz ) );
|
|
|
|
Bitmap aPolyMask( aVDev.GetBitmap( Point(), aDstSz ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
// #107766# check for non-empty bitmaps before accessing them
|
|
|
|
if( !!aPaint && !!aPolyMask )
|
2003-04-08 14:35:51 +00:00
|
|
|
{
|
2006-11-14 14:23:21 +00:00
|
|
|
BitmapWriteAccess* pW = aPaint.AcquireWriteAccess();
|
|
|
|
BitmapReadAccess* pR = aPolyMask.AcquireReadAccess();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 14:23:21 +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 )
|
2003-04-08 14:35:51 +00:00
|
|
|
{
|
2006-11-14 14:23:21 +00:00
|
|
|
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
|
|
|
|
2006-11-14 14:23:21 +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
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
if( pR->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL &&
|
|
|
|
pW->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-11-14 14:23:21 +00:00
|
|
|
const BYTE cBlack = aBlack.GetIndex();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
for( nY = 0; nY < nHeight; nY++ )
|
2003-04-08 14:35:51 +00:00
|
|
|
{
|
2006-11-14 14:23:21 +00:00
|
|
|
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++;
|
2003-04-08 14:35:51 +00:00
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
if( ( *pRScan & cBit ) == cBlack )
|
|
|
|
*pWScan = (BYTE) pMap[ *pWScan ].GetIndex();
|
|
|
|
}
|
2003-04-08 14:35:51 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2006-11-14 14:23:21 +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
|
|
|
}
|
2003-04-08 14:35:51 +00:00
|
|
|
else
|
|
|
|
{
|
2006-11-14 14:23:21 +00:00
|
|
|
if( pR->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL &&
|
|
|
|
pW->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-11-14 14:23:21 +00:00
|
|
|
const BYTE cBlack = aBlack.GetIndex();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
for( nY = 0; nY < nHeight; nY++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-11-14 14:23:21 +00:00
|
|
|
Scanline pWScan = pW->GetScanline( nY );
|
|
|
|
Scanline pRScan = pR->GetScanline( nY );
|
|
|
|
BYTE cBit = 128;
|
2003-04-08 14:35:51 +00:00
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan += 3 )
|
2003-04-08 14:35:51 +00:00
|
|
|
{
|
2006-11-14 14:23:21 +00:00
|
|
|
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 );
|
|
|
|
}
|
2003-04-08 14:35:51 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-14 14:23:21 +00:00
|
|
|
else
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-11-14 14:23:21 +00:00
|
|
|
for( nY = 0; nY < nHeight; nY++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-11-14 14:23:21 +00:00
|
|
|
for( nX = 0; nX < nWidth; nX++ )
|
2003-04-08 14:35:51 +00:00
|
|
|
{
|
2006-11-14 14:23:21 +00:00
|
|
|
if( pR->GetPixel( nY, nX ) == aBlack )
|
|
|
|
{
|
|
|
|
aPixCol = pW->GetColor( nY, nX );
|
|
|
|
pW->SetPixel( nY, nX, aPixCol.Merge( aFillCol, cTrans ) );
|
|
|
|
}
|
2003-04-08 14:35:51 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
aPolyMask.ReleaseAccess( pR );
|
|
|
|
aPaint.ReleaseAccess( pW );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
DrawBitmap( aDstRect.TopLeft(), aPaint );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
EnableMapMode( bOldMap );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-11-14 14:23:21 +00:00
|
|
|
if( mbLineColor )
|
|
|
|
{
|
|
|
|
Push( PUSH_FILLCOLOR );
|
|
|
|
SetFillColor();
|
|
|
|
DrawPolyPolygon( rPolyPoly );
|
|
|
|
Pop();
|
|
|
|
}
|
2003-04-08 14:35:51 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2006-11-14 14:23:21 +00:00
|
|
|
else
|
|
|
|
DrawPolyPolygon( rPolyPoly );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mpMetaFile = pOldMetaFile;
|
2003-11-24 16:33:45 +00:00
|
|
|
|
|
|
|
// #110958# Restore disabled alpha VDev
|
|
|
|
mpAlphaVDev = pOldAlphaVDev;
|
|
|
|
|
|
|
|
// #110958# Apply alpha value also to VDev alpha channel
|
|
|
|
if( mpAlphaVDev )
|
|
|
|
{
|
|
|
|
const Color aFillCol( mpAlphaVDev->GetFillColor() );
|
2006-06-19 18:29:01 +00:00
|
|
|
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)) );
|
2003-11-24 16:33:45 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2004-01-06 12:51:31 +00:00
|
|
|
((OutputDevice*)pVDev)->mnDPIX = mnDPIX;
|
|
|
|
((OutputDevice*)pVDev)->mnDPIY = mnDPIY;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( pVDev->SetOutputSizePixel( aDstRect.GetSize() ) )
|
|
|
|
{
|
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() );
|
2005-01-21 16:23:17 +00:00
|
|
|
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 );
|
2005-01-21 16:23:17 +00:00
|
|
|
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;
|
2003-11-24 16:33:45 +00:00
|
|
|
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();
|
2003-11-24 16:33:45 +00:00
|
|
|
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;
|
2004-09-09 15:19:54 +00:00
|
|
|
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;
|
2003-11-24 16:33:45 +00:00
|
|
|
EnableMapMode( FALSE );
|
2000-09-18 16:07:07 +00:00
|
|
|
Push( PUSH_CLIPREGION );
|
|
|
|
IntersectClipRegion( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ) );
|
|
|
|
|
2004-09-09 15:19:54 +00:00
|
|
|
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();
|
2003-11-24 16:33:45 +00:00
|
|
|
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 ) );
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
}
|
2003-11-24 16:33:45 +00:00
|
|
|
|
|
|
|
if( mpAlphaVDev )
|
|
|
|
mpAlphaVDev->DrawWallpaper( rRect, rWallpaper );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void OutputDevice::Erase()
|
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
|
2000-09-18 16:07:07 +00:00
|
|
|
return;
|
|
|
|
|
2007-07-05 07:39:57 +00:00
|
|
|
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;
|
2007-08-03 11:30:35 +00:00
|
|
|
Point aGcc3WorkaroundTemporary;
|
2010-07-05 11:20:24 +02:00
|
|
|
Rectangle aCtrlRegion( aGcc3WorkaroundTemporary, GetOutputSizePixel() );
|
2007-07-05 07:39:57 +00:00
|
|
|
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 );
|
|
|
|
}
|
2003-11-24 16:33:45 +00:00
|
|
|
|
|
|
|
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() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2009-11-23 12:30:29 +01:00
|
|
|
bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
|
2000-09-18 16:07:07 +00:00
|
|
|
const GfxLink& rGfxLink, GDIMetaFile* pSubst )
|
|
|
|
{
|
2009-11-23 12:30:29 +01:00
|
|
|
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 ) );
|
|
|
|
}
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
|
2009-11-23 12:30:29 +01:00
|
|
|
return bDrawn;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-05-17 15:00:10 +00:00
|
|
|
if( mbOutputClipped )
|
2009-11-23 12:30:29 +01:00
|
|
|
return bDrawn;
|
2004-05-17 15:00:10 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
Rectangle aRect( ImplLogicToDevicePixel( Rectangle( rPoint, rSize ) ) );
|
2009-11-23 12:30:29 +01:00
|
|
|
|
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() )
|
2009-11-23 12:30:29 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2003-11-24 16:33:45 +00:00
|
|
|
|
|
|
|
if( mpAlphaVDev )
|
|
|
|
mpAlphaVDev->DrawEPS( rPoint, rSize, rGfxLink, pSubst );
|
2009-11-23 12:30:29 +01:00
|
|
|
|
|
|
|
return bDrawn;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|