21 #include <osl/diagnose.h>
22 #include <rtl/math.hxx>
25 #include <officecfg/Office/Common.hxx>
41 #define MAX_TILE_WIDTH 1024
42 #define MAX_TILE_HEIGHT 1024
55 if (0.0 < fW && 0.0 < fH && (fW <= 1.0 || fH <= 1.0))
60 double nW = std::max<double>(1.0, rtl::math::round(fW));
61 double nH = std::max<double>(1.0, rtl::math::round(fH));
65 aTarget.Insert(1,
Point(nX+nW, nY));
66 aTarget.Insert(2,
Point(nX+nW, nY+nH));
67 aTarget.Insert(3,
Point(nX, nY+nH));
68 aTarget.Insert(4,
Point(nX, nY));
77 for (
auto const& rB2DPolygon : rPolyPoly)
78 aTarget.
Insert(toPolygon(rB2DPolygon));
96 if(!rB2DPolyPoly.
count())
133 const double fAdjustedTransparency =
mpAlphaVDev ? 0 : fTransparency;
141 fAdjustedTransparency,
149 for(
auto const& rPolygon : std::as_const(aB2DPolyPolygon))
154 fAdjustedTransparency,
158 css::drawing::LineCap_BUTT,
171 aB2DPolyPoly.
transform(rObjectTransform);
175 static_cast< sal_uInt16 >(fTransparency * 100.0)));
188 aB2DPolyPoly.
transform(rObjectTransform);
190 toPolyPolygon(aB2DPolyPoly),
191 static_cast<sal_uInt16>(fTransparency * 100.0));
195 sal_uInt16 nTransparencePercent )
202 #if defined UNX && ! defined MACOSX && ! defined IOS
228 const double fTransparency = 0.01 * nTransparencePercent;
255 for(
auto const& rPolygon : std::as_const(aB2DPolyPolygon))
264 css::drawing::LineCap_BUTT,
279 sal_uInt16 nTransparencePercent )
295 aDstRect.Intersection( aPolyRect );
299 if( !aDstRect.IsEmpty() )
330 aPixelRect.getWidth(), aPixelRect.getHeight(),
331 sal::static_int_cast<
sal_uInt8>(nTransparencePercent),
343 const Size aDstSz( aDstRect.GetSize() );
346 if( aDstRect.Left() || aDstRect.Top() )
347 aPolyPoly.
Move( -aDstRect.Left(), -aDstRect.Top() );
349 if( aVDev->SetOutputSizePixel( aDstSz ) )
351 const bool bOldMap =
mbMap;
357 aVDev->DrawPolyPolygon( aPolyPoly );
360 Bitmap aPolyMask( aVDev->GetBitmap(
Point(), aDstSz ) );
363 if( !aPaint.
IsEmpty() && !aPolyMask.IsEmpty() )
387 for( sal_uInt16
i = 0;
i < nCount;
i++ )
390 aCol.
Merge( aFillCol, cTrans );
397 const sal_uInt8 cBlack = aBlack.GetIndex();
399 for( nY = 0; nY < nHeight; nY++ )
401 Scanline pWScan = pW->GetScanline( nY );
405 for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan++ )
412 if( ( *pRScan & cBit ) == cBlack )
414 *pWScan = pMap[ *pWScan ].
GetIndex();
421 for( nY = 0; nY < nHeight; nY++ )
423 Scanline pScanline = pW->GetScanline(nY);
425 for( nX = 0; nX < nWidth; nX++ )
429 pW->SetPixelOnData( pScanline, nX, pMap[ pW->GetIndexFromData( pScanline, nX ) ] );
440 const sal_uInt8 cBlack = aBlack.GetIndex();
442 for( nY = 0; nY < nHeight; nY++ )
444 Scanline pWScan = pW->GetScanline( nY );
448 for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan += 3 )
455 if( ( *pRScan & cBit ) == cBlack )
466 for( nY = 0; nY < nHeight; nY++ )
468 Scanline pScanline = pW->GetScanline(nY);
470 for( nX = 0; nX < nWidth; nX++ )
474 aPixCol = pW->GetColor( nY, nX );
475 aPixCol.
Merge(aFillCol, cTrans);
476 pW->SetPixelOnData(pScanline, nX, aPixCol);
514 sal_uInt16 nTransparencePercent )
553 sal::static_int_cast<sal_uInt8>(255*nTransparencePercent/100),
554 sal::static_int_cast<sal_uInt8>(255*nTransparencePercent/100)) );
563 const Size& rSize,
const Gradient& rTransparenceGradient )
605 if( xVDev->SetOutputSizePixel( aDstRect.
GetSize() ) )
620 xVDev->SetMapMode(aMap);
627 const bool bBufferMapModeEnabled(xVDev->IsMapModeEnabled());
628 xVDev->EnableMapMode(
false);
631 xVDev->DrawOutDev( aPoint, xVDev->GetOutputSizePixel(),
632 aDstRect.
TopLeft(), xVDev->GetOutputSizePixel(),
636 xVDev->EnableMapMode(bBufferMapModeEnabled);
642 xVDev->EnableMapMode(
false);
644 const Bitmap aPaint(xVDev->GetBitmap(aPoint, xVDev->GetOutputSizePixel()));
647 xVDev->EnableMapMode(bBufferMapModeEnabled);
651 xVDev->EnableMapMode(
false);
653 const AlphaMask aAlpha(xVDev->GetBitmap(aPoint, xVDev->GetOutputSizePixel()));
665 const bool bOldMap =
mbMap;
668 xVDev->SetMapMode( aMap );
669 const bool bVDevOldMap = xVDev->IsMapModeEnabled();
675 xVDev->EnableMapMode(
false );
676 BitmapEx aPaint = xVDev->GetBitmapEx(
Point(), xVDev->GetOutputSizePixel());
677 xVDev->EnableMapMode( bVDevOldMap );
681 xVDev->DrawGradient(
tools::Rectangle( rPos, rSize ), rTransparenceGradient );
683 xVDev->EnableMapMode(
false );
685 AlphaMask aAlpha(xVDev->GetBitmap(
Point(), xVDev->GetOutputSizePixel()));
706 struct ConnectedComponents
708 ConnectedComponents() :
713 bIsFullyTransparent(
false)
716 ::std::list< Component > aComponentList;
720 bool bIsFullyTransparent;
731 bool DoesActionHandleTransparency(
const MetaAction& rAct )
753 bool doesRectCoverWithUniformColor(
760 return (rMapModeVDev.
LogicToPixel(rCurrRect).Contains(rPrevRect) &&
772 bool bRet = doesRectCoverWithUniformColor(io_rPrevRect, rCurrRect, rMapModeVDev);
776 io_rPrevRect = rCurrRect;
790 void ImplConvertTransparentAction(
GDIMetaFile& o_rMtf,
807 aLineColor.
SetRed(static_cast<sal_uInt8>((255*nTransparency + (100 - nTransparency) * aLineColor.GetRed()) / 100));
808 aLineColor.SetGreen(static_cast<sal_uInt8>((255*nTransparency + (100 - nTransparency) * aLineColor.GetGreen()) / 100));
809 aLineColor.SetBlue(static_cast<sal_uInt8>((255*nTransparency + (100 - nTransparency) * aLineColor.GetBlue()) / 100));
813 aFillColor.
SetRed(static_cast<sal_uInt8>((255*nTransparency + (100 - nTransparency)*aFillColor.GetRed()) / 100));
814 aFillColor.SetGreen(static_cast<sal_uInt8>((255*nTransparency + (100 - nTransparency)*aFillColor.GetGreen()) / 100));
815 aFillColor.SetBlue(static_cast<sal_uInt8>((255*nTransparency + (100 - nTransparency)*aFillColor.GetBlue()) / 100));
845 OSL_FAIL(
"Printer::GetPreparedMetafile impossible state reached");
854 aBmp.Blend(aBmpEx.
GetAlpha(), aBgColor);
862 static_cast<const MetaBmpExAction&>(rAct).GetPoint(),
867 static_cast<const MetaBmpExScaleAction&>(rAct).GetPoint(),
868 static_cast<const MetaBmpExScaleAction&>(rAct).GetSize(),
872 o_rMtf.
AddAction(
new MetaBmpScalePartAction(
873 static_cast<const MetaBmpExScalePartAction&>(rAct).GetDestPoint(),
874 static_cast<const MetaBmpExScalePartAction&>(rAct).GetDestSize(),
875 static_cast<const MetaBmpExScalePartAction&>(rAct).GetSrcPoint(),
876 static_cast<const MetaBmpExScalePartAction&>(rAct).GetSrcSize(),
880 OSL_FAIL(
"Unexpected case");
897 if( !bLineTransparency )
902 if( !bLineTransparency )
907 if( !bLineTransparency || !bFillTransparency )
912 if( !bLineTransparency || !bFillTransparency )
917 if( !bLineTransparency || !bFillTransparency )
922 if( !bLineTransparency || !bFillTransparency )
927 if( !bLineTransparency || !bFillTransparency )
932 if( !bLineTransparency || !bFillTransparency )
937 if( !bLineTransparency )
942 if( !bLineTransparency || !bFillTransparency )
947 if( !bLineTransparency || !bFillTransparency )
955 if (!aString.isEmpty())
962 const MetaTextArrayAction& rTextAct =
static_cast<const MetaTextArrayAction&
>(rAct);
963 const OUString aString( rTextAct.GetText().copy(rTextAct.GetIndex(), rTextAct.GetLen()) );
964 if (!aString.isEmpty())
1008 aActionBounds =
tools::Rectangle( static_cast<const MetaPixelAction&>(rAct).GetPoint(),
Size( 1, 1 ) );
1012 aActionBounds =
tools::Rectangle( static_cast<const MetaPointAction&>(rAct).GetPoint(),
Size( 1, 1 ) );
1023 const tools::Long nHalfLineWidth((nLineWidth + 1) / 2);
1025 aActionBounds.
AdjustTop( -nHalfLineWidth );
1033 aActionBounds =
static_cast<const MetaRectAction&
>(rAct).GetRect();
1037 aActionBounds =
tools::Polygon( static_cast<const MetaRoundRectAction&>(rAct).GetRect(),
1038 static_cast<const MetaRoundRectAction&>(rAct).GetHorzRound(),
1039 static_cast<const MetaRoundRectAction&>(rAct).GetVertRound() ).
GetBoundRect();
1047 rRect.
GetHeight() >> 1 ).GetBoundRect();
1052 aActionBounds =
tools::Polygon( static_cast<const MetaArcAction&>(rAct).GetRect(),
1053 static_cast<const MetaArcAction&>(rAct).GetStartPoint(),
1054 static_cast<const MetaArcAction&>(rAct).GetEndPoint(), PolyStyle::Arc ).
GetBoundRect();
1058 aActionBounds =
tools::Polygon( static_cast<const MetaPieAction&>(rAct).GetRect(),
1059 static_cast<const MetaPieAction&>(rAct).GetStartPoint(),
1060 static_cast<const MetaPieAction&>(rAct).GetEndPoint(), PolyStyle::Pie ).
GetBoundRect();
1064 aActionBounds =
tools::Polygon( static_cast<const MetaChordAction&>(rAct).GetRect(),
1065 static_cast<const MetaChordAction&>(rAct).GetStartPoint(),
1066 static_cast<const MetaChordAction&>(rAct).GetEndPoint(), PolyStyle::Chord ).
GetBoundRect();
1076 const tools::Long nHalfLineWidth((nLineWidth + 1) / 2);
1078 aActionBounds.
AdjustTop( -nHalfLineWidth );
1086 aActionBounds =
static_cast<const MetaPolygonAction&
>(rAct).GetPolygon().GetBoundRect();
1094 aActionBounds =
tools::Rectangle( static_cast<const MetaBmpAction&>(rAct).GetPoint(),
1095 rOut.
PixelToLogic( static_cast<const MetaBmpAction&>(rAct).GetBitmap().GetSizePixel() ) );
1099 aActionBounds =
tools::Rectangle( static_cast<const MetaBmpScaleAction&>(rAct).GetPoint(),
1100 static_cast<const MetaBmpScaleAction&>(rAct).GetSize() );
1104 aActionBounds =
tools::Rectangle( static_cast<const MetaBmpScalePartAction&>(rAct).GetDestPoint(),
1105 static_cast<const MetaBmpScalePartAction&>(rAct).GetDestSize() );
1109 aActionBounds =
tools::Rectangle( static_cast<const MetaBmpExAction&>(rAct).GetPoint(),
1110 rOut.
PixelToLogic( static_cast<const MetaBmpExAction&>(rAct).GetBitmapEx().GetSizePixel() ) );
1114 aActionBounds =
tools::Rectangle( static_cast<const MetaBmpExScaleAction&>(rAct).GetPoint(),
1115 static_cast<const MetaBmpExScaleAction&>(rAct).GetSize() );
1119 aActionBounds =
tools::Rectangle( static_cast<const MetaBmpExScalePartAction&>(rAct).GetDestPoint(),
1120 static_cast<const MetaBmpExScalePartAction&>(rAct).GetDestSize() );
1124 aActionBounds =
tools::Rectangle( static_cast<const MetaMaskAction&>(rAct).GetPoint(),
1125 rOut.
PixelToLogic( static_cast<const MetaMaskAction&>(rAct).GetBitmap().GetSizePixel() ) );
1129 aActionBounds =
tools::Rectangle( static_cast<const MetaMaskScaleAction&>(rAct).GetPoint(),
1130 static_cast<const MetaMaskScaleAction&>(rAct).GetSize() );
1134 aActionBounds =
tools::Rectangle( static_cast<const MetaMaskScalePartAction&>(rAct).GetDestPoint(),
1135 static_cast<const MetaMaskScalePartAction&>(rAct).GetDestSize() );
1143 aActionBounds =
static_cast<const MetaGradientExAction&
>(rAct).GetPolyPolygon().GetBoundRect();
1147 aActionBounds =
static_cast<const MetaHatchAction&
>(rAct).GetPolyPolygon().GetBoundRect();
1151 aActionBounds =
static_cast<const MetaWallpaperAction&
>(rAct).GetRect();
1159 aActionBounds =
tools::Rectangle( static_cast<const MetaFloatTransparentAction&>(rAct).GetPoint(),
1160 static_cast<const MetaFloatTransparentAction&>(rAct).GetSize() );
1164 aActionBounds =
tools::Rectangle( static_cast<const MetaEPSAction&>(rAct).GetPoint(),
1165 static_cast<const MetaEPSAction&>(rAct).GetSize() );
1173 if (!aString.isEmpty())
1181 aActionBounds.
Move( aPtLog.X(), aPtLog.Y() );
1188 const MetaTextArrayAction& rTextAct =
static_cast<const MetaTextArrayAction&
>(rAct);
1189 const OUString aString( rTextAct.GetText().copy(rTextAct.GetIndex(), rTextAct.GetLen()) );
1191 if( !aString.isEmpty() )
1194 std::unique_ptr<SalLayout> pSalLayout = rOut.
ImplLayout( rTextAct.GetText(), rTextAct.GetIndex(),
1195 rTextAct.GetLen(), rTextAct.GetPoint(),
1196 0, rTextAct.GetDXArray());
1220 if( !aString.isEmpty() )
1236 OSL_FAIL(
"MetaActionType::TEXTLINE not supported");
1243 if( !aActionBounds.
IsEmpty() )
1262 bool bReduceTransparency,
bool bTransparencyAutoMode,
1263 bool bDownsampleBitmaps,
1264 const Color& rBackground
1268 bool bTransparent(
false );
1272 if(!bReduceTransparency || bTransparencyAutoMode)
1313 ConnectedComponents aBackgroundComponent;
1316 double fReduceTransparencyMinArea = officecfg::Office::Common::VCL::ReduceTransparencyMinArea::get() / 100.0;
1317 SAL_WARN_IF(fReduceTransparencyMinArea > 1.0,
"vcl",
1318 "Value of ReduceTransparencyMinArea config option is too high");
1319 SAL_WARN_IF(fReduceTransparencyMinArea < 0.0,
"vcl",
1320 "Value of ReduceTransparencyMinArea config option is too low");
1321 fReduceTransparencyMinArea = std::clamp(fReduceTransparencyMinArea, 0.0, 1.0);
1325 aMapModeVDev->mnDPIX =
mnDPIX;
1326 aMapModeVDev->mnDPIY =
mnDPIY;
1327 aMapModeVDev->EnableOutput(
false);
1333 bool bStillBackground=
true;
1334 int nActionNum = 0, nLastBgAction = -1;
1335 pCurrAct=
const_cast<GDIMetaFile&
>(rInMtf).FirstAction();
1338 aBackgroundComponent.aBgColor = rBackground;
1341 while( pCurrAct && bStillBackground )
1348 aBackgroundComponent.aBounds,
1349 aBackgroundComponent.aBgColor,
1350 static_cast<const MetaRectAction*>(pCurrAct)->GetRect(),
1352 bStillBackground=
false;
1354 nLastBgAction=nActionNum;
1360 static_cast<const MetaPolygonAction*>(pCurrAct)->GetPolygon());
1364 aBackgroundComponent.aBounds,
1365 aBackgroundComponent.aBgColor,
1368 bStillBackground=
false;
1370 nLastBgAction=nActionNum;
1376 static_cast<const MetaPolyPolygonAction*>(pCurrAct)->GetPolyPolygon());
1377 if( aPoly.
Count() != 1 ||
1379 aPoly[0].getB2DPolygon()) ||
1381 aBackgroundComponent.aBounds,
1382 aBackgroundComponent.aBgColor,
1385 bStillBackground=
false;
1387 nLastBgAction=nActionNum;
1393 aBackgroundComponent.aBounds,
1394 aBackgroundComponent.aBgColor,
1395 static_cast<const MetaWallpaperAction*>(pCurrAct)->GetRect(),
1397 bStillBackground=
false;
1399 nLastBgAction=nActionNum;
1404 if( ImplIsNotTransparent( *pCurrAct,
1406 bStillBackground=
false;
1411 aBackgroundComponent.aBounds.Union(
1412 ImplCalcActionBounds(*pCurrAct, *aMapModeVDev) );
1420 pCurrAct=
const_cast<GDIMetaFile&
>(rInMtf).NextAction();
1424 if (nLastBgAction != -1)
1428 for (
size_t nPostLastBgAction = nLastBgAction + 1; nPostLastBgAction < nActionSize; ++nPostLastBgAction)
1432 nLastBgAction = nPostLastBgAction;
1436 aMapModeVDev->ClearStack();
1441 pCurrAct=
const_cast<GDIMetaFile&
>(rInMtf).FirstAction();
1442 while( pCurrAct && nActionNum<=nLastBgAction )
1446 aBackgroundComponent.aComponentList.emplace_back(
1447 pCurrAct, nActionNum );
1451 pCurrAct=
const_cast<GDIMetaFile&
>(rInMtf).NextAction();
1457 ::std::vector<ConnectedComponents> aCCList;
1463 pCurrAct=
const_cast<GDIMetaFile&
>(rInMtf).NextAction(), ++nActionNum )
1469 const tools::Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, *aMapModeVDev) );
1474 bool bTreatSpecial(
false );
1475 ConnectedComponents aTotalComponents;
1490 aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, *aMapModeVDev);
1493 !aTotalComponents.bIsFullyTransparent )
1495 if( !aBackgroundComponent.aComponentList.empty() &&
1496 !aBackgroundComponent.aBounds.Contains(aTotalBounds) )
1500 aTotalBounds.
Union( aBackgroundComponent.aBounds );
1503 aTotalComponents.aComponentList.splice( aTotalComponents.aComponentList.end(),
1504 aBackgroundComponent.aComponentList );
1506 if( aBackgroundComponent.bIsSpecial )
1507 bTreatSpecial =
true;
1510 bool bSomeComponentsChanged;
1522 bSomeComponentsChanged =
false;
1525 for(
auto aCurrCC=aCCList.begin(); aCurrCC != aCCList.end(); )
1536 if( !aCurrCC->aBounds.IsEmpty() &&
1537 !aCurrCC->bIsFullyTransparent &&
1538 aCurrCC->aBounds.Overlaps( aTotalBounds ) )
1543 aTotalBounds.
Union( aCurrCC->aBounds );
1546 aTotalComponents.aComponentList.splice( aTotalComponents.aComponentList.end(),
1547 aCurrCC->aComponentList );
1549 if( aCurrCC->bIsSpecial )
1550 bTreatSpecial =
true;
1553 aCurrCC = aCCList.erase( aCurrCC );
1556 bSomeComponentsChanged =
true;
1564 while( bSomeComponentsChanged );
1586 aTotalComponents.bIsSpecial =
true;
1592 aTotalComponents.bIsSpecial =
false;
1602 if( !DoesActionHandleTransparency( *pCurrAct ) )
1606 aTotalComponents.bIsSpecial =
true;
1612 if( aTotalComponents.aComponentList.empty() )
1616 aTotalComponents.bIsSpecial =
false;
1629 aTotalComponents.bIsSpecial =
true;
1637 aTotalComponents.aBounds = aTotalBounds;
1638 aTotalComponents.aComponentList.emplace_back(
1639 pCurrAct, nActionNum );
1642 aCCList.push_back( aTotalComponents );
1644 SAL_WARN_IF( aTotalComponents.aComponentList.empty(),
"vcl",
1645 "Printer::GetPreparedMetaFile empty component" );
1646 SAL_WARN_IF( aTotalComponents.aBounds.IsEmpty() && (aTotalComponents.aComponentList.size() != 1),
"vcl",
1647 "Printer::GetPreparedMetaFile non-output generating actions must be solitary");
1648 SAL_WARN_IF( aTotalComponents.bIsFullyTransparent && (aTotalComponents.aComponentList.size() != 1),
"vcl",
1649 "Printer::GetPreparedMetaFile fully transparent actions must be solitary");
1662 ::std::vector< const ConnectedComponents* > aCCList_MemberMap( rInMtf.
GetActionSize() );
1665 for (
auto const& currentItem : aCCList)
1667 for (
auto const& currentAction : currentItem.aComponentList)
1670 aCCList_MemberMap[ currentAction.second ] = ¤tItem;
1676 for (
auto & component : aBackgroundComponent.aComponentList)
1700 aPageOffset =
Point( 0, 0 ) - aPageOffset;
1704 bool bTiling =
dynamic_cast<Printer*
>(
this) !=
nullptr;
1707 for (
auto & currentItem : aCCList)
1709 if( currentItem.bIsSpecial )
1714 const double fBmpArea( static_cast<double>(aBoundRect.
GetWidth()) * aBoundRect.
GetHeight() );
1715 const double fOutArea( static_cast<double>(aOutputRect.
GetWidth()) * aOutputRect.
GetHeight() );
1718 if( bReduceTransparency && bTransparencyAutoMode && ( fBmpArea > ( fReduceTransparencyMinArea * fOutArea ) ) )
1723 currentItem.bIsSpecial =
false;
1734 aMapVDev->EnableOutput(
false);
1737 aPaintVDev->SetBackground( aBackgroundComponent.aBgColor );
1744 while( aDstPtPix.Y() <= aBoundRect.
Bottom() )
1746 aDstPtPix.setX( aBoundRect.
Left() );
1749 if( ( aDstPtPix.Y() + aDstSzPix.Height() - 1 ) > aBoundRect.
Bottom() )
1752 while( aDstPtPix.X() <= aBoundRect.
Right() )
1754 if( ( aDstPtPix.X() + aDstSzPix.Width() - 1 ) > aBoundRect.
Right() )
1755 aDstSzPix.setWidth( aBoundRect.
Right() - aDstPtPix.X() + 1 );
1758 aPaintVDev->SetOutputSizePixel( aDstSzPix ) )
1763 aMapVDev->mnDPIX = aPaintVDev->mnDPIX =
mnDPIX;
1764 aMapVDev->mnDPIY = aPaintVDev->mnDPIY =
mnDPIY;
1766 aPaintVDev->EnableOutput(
false);
1769 for( pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction(), nActionNum=0;
1771 pCurrAct=
const_cast<GDIMetaFile&
>(rInMtf).NextAction(), ++nActionNum )
1777 if( aCCList_MemberMap[nActionNum] == ¤tItem )
1778 aPaintVDev->EnableOutput();
1787 MapMode aMtfMap( aMapVDev->GetMapMode() );
1788 const Point aNewOrg( aMapVDev->PixelToLogic( aDstPtPix ) );
1790 aMtfMap.SetOrigin(
Point( -aNewOrg.X(), -aNewOrg.Y() ) );
1791 aPaintVDev->SetMapMode( aMtfMap );
1815 const bool bOldMap =
mbMap;
1816 mbMap = aPaintVDev->mbMap =
false;
1818 Bitmap aBandBmp( aPaintVDev->GetBitmap(
Point(), aDstSzPix ) );
1821 if( bDownsampleBitmaps )
1823 Point(), aBandBmp.GetSizePixel(),
1824 aBandBmp, nMaxBmpDPIX, nMaxBmpDPIY);
1830 aPaintVDev->mbMap =
true;
1837 aDstPtPix.AdjustX(aDstSzPix.Width() );
1841 aDstPtPix.AdjustY(aDstSzPix.Height() );
1850 aMapModeVDev->ClearStack();
1856 for( pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction(), nActionNum=0;
1858 pCurrAct=
const_cast<GDIMetaFile&
>(rInMtf).NextAction(), ++nActionNum )
1860 const ConnectedComponents* pCurrAssociatedComponent = aCCList_MemberMap[nActionNum];
1866 if( pCurrAssociatedComponent &&
1867 (pCurrAssociatedComponent->aBounds.IsEmpty() ||
1868 !pCurrAssociatedComponent->bIsSpecial) )
1874 if( DoesActionHandleTransparency( *pCurrAct ) &&
1875 pCurrAssociatedComponent->aComponentList.begin()->first == pCurrAct )
1879 ImplConvertTransparentAction(rOutMtf,
1882 aBackgroundComponent.aBgColor);
1897 #if OSL_DEBUG_LEVEL > 1
1900 for(
auto const& aCurr:aCCList)
1902 if( aCurr.bIsSpecial )
1911 return bTransparent;
BitmapEx GetBitmapEx(BitmapEx const &rBitmapEx, DrawModeFlags nDrawMode)
vcl::Region GetClipRegion() const
sal_uInt8 GetIndex() const
SAL_DLLPRIVATE bool ImplIsRecordLayout() const
virtual void ClipToPaintRegion(tools::Rectangle &rDstRect)
void Merge(const Color &rMergeColor, sal_uInt8 cTransparency)
tools::Rectangle ImplGetTextBoundRect(const SalLayout &) const
void setClosed(bool bNew)
constexpr bool isPalettePixelFormat(PixelFormat ePixelFormat)
Is it a pixel format that forces creation of a palette.
constexpr double deg2rad(double v)
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
virtual bool supportsOperation(OutDevSupportType) const =0
constexpr::Color COL_RED(0x80, 0x00, 0x00)
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
std::enable_if< std::is_signed< T >::value||std::is_floating_point< T >::value, long >::type MinMax(T nVal, tools::Long nMin, tools::Long nMax)
bool IsMapModeEnabled() const
void DrawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point **pPtAry, const OutputDevice &rOutDev)
SAL_DLLPRIVATE bool is_double_buffered_window() const
const MapMode & GetMapMode() const
bool DrawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency, const OutputDevice &rOutDev)
Bitmap GetDownsampledBitmap(Size const &rDstSizeTwip, Point const &rSrcPt, Size const &rSrcSz, Bitmap const &rBmp, tools::Long nMaxBmpDPIX, tools::Long nMaxBmpDPIY)
Retrieve downsampled and cropped bitmap.
const OUString & GetText() const
This template handles BitmapAccess the RAII way.
void EnableMapMode(bool bEnable=true)
tools::Rectangle GetBoundRect() const
AntialiasingFlags GetAntialiasing() const
HashMap_OWString_Interface aMap
SAL_DLLPRIVATE void InitLineColor()
const OUString & GetText() const
Scanline GetScanline(tools::Long nY) const
AntialiasingFlags mnAntialiasing
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const
const Size & GetPaperSizePixel() const
bool GetTextBoundRect(tools::Rectangle &rRect, const OUString &rStr, sal_Int32 nBase=0, sal_Int32 nIndex=0, sal_Int32 nLen=-1, sal_uLong nLayoutWidth=0, o3tl::span< const sal_Int32 > pDXArray={}, const SalLayoutGlyphs *pGlyphs=nullptr) const
Return the exact bounding rectangle of rStr.
void DrawGradientEx(OutputDevice *pOut, const tools::Rectangle &rRect, const Gradient &rGradient)
BitmapColor GetBestMatchingColor(const BitmapColor &rBitmapColor) const
sal_uInt8 GetBlue() const
::std::pair< MetaAction *, int > Component
SalGraphics * mpGraphics
Graphics context to draw on.
SAL_DLLPRIVATE bool DrawTransparentNatively(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent)
SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const
Get device transformation.
virtual void SetFillColor()=0
void BlendWith(const Bitmap &rOther)
sal_uInt16 GetEntryCount() const
virtual void EmulateDrawTransparent(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent)
SAL_DLLPRIVATE void InitFillColor()
vcl::PixelFormat getPixelFormat() const
static bool Reschedule(bool bHandleAllCurrentEvents=false)
Attempt to process current pending event(s)
virtual tools::Rectangle GetBackgroundComponentBounds() const
bool IsClipRegion() const
ScanlineFormat GetScanlineFormat() const
const Point & GetPoint() const
tools::Long FRound(double fVal)
virtual bool AcquireGraphics() const =0
Acquire a graphics device that the output device uses to draw on.
void DrawTransparent(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent)
void SetOrigin(const Point &rOrigin)
sal_uInt32 GetWidth() const
const OutDevType meOutDevType
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
const Color & GetLineColor() const
void SetRed(sal_uInt8 nRed)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void DrawPolyLine(sal_uInt32 nPoints, Point const *pPtAry, const OutputDevice &rOutDev)
bool IsFullyTransparent() const
Size GetOutputSizePixel() const
virtual sal_uInt16 GetBitCount() const
DrawModeFlags GetDrawMode() const
void DrawBitmap(const Point &rDestPt, const Bitmap &rBitmap)
sal_uInt16 GetBestIndex(const BitmapColor &rCol) const
const Color & GetStartColor() const
Bitmap GetBitmap(Color aTransparentReplaceColor) const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
const Point & GetPoint() const
sal_uInt8 GetGreen() const
B2DRange const & getB2DRange() const
VclPtr< VirtualDevice > mpAlphaVDev
const Point & GetPageOffsetPixel() const
AlphaMask GetAlpha() const
#define SAL_WARN_IF(condition, area, stream)
bool RemoveTransparenciesFromMetaFile(const GDIMetaFile &rInMtf, GDIMetaFile &rOutMtf, tools::Long nMaxBmpDPIX, tools::Long nMaxBmpDPIY, bool bReduceTransparency, bool bTransparencyAutoMode, bool bDownsampleBitmaps, const Color &rBackground=COL_TRANSPARENT)
helper method removing transparencies from a metafile (e.g.
bool Convert(BmpConversion eConversion)
Convert bitmap format.
constexpr sal_uInt8 ColorChannelMerge(sal_uInt8 nDst, sal_uInt8 nSrc, sal_uInt8 nSrcTrans)
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
const Color & GetEndColor() const
void DrawPolyPolygon(const tools::PolyPolygon &rPolyPoly)
Render the given poly-polygon.
virtual void InitClipRegion()
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
RasterOp GetRasterOp() const
BitmapColor GetPixelFromData(const sal_uInt8 *pData, tools::Long nX) const
SAL_DLLPRIVATE tools::Rectangle ImplLogicToDevicePixel(const tools::Rectangle &rLogicRect) const
Convert a logical rectangle to a rectangle in physical device pixel units.
void setHeight(tools::Long nHeight)
reference_type * get() const
Get the body.
std::unique_ptr< SalLayout > ImplLayout(const OUString &, sal_Int32 nIndex, sal_Int32 nLen, const Point &rLogicPos=Point(0, 0), tools::Long nLogicWidth=0, o3tl::span< const sal_Int32 > pLogicDXArray={}, SalLayoutFlags flags=SalLayoutFlags::NONE, vcl::text::TextLayoutCache const *=nullptr, const SalLayoutGlyphs *pGlyphs=nullptr) const
constexpr::Color COL_BLUE(0x00, 0x00, 0x80)
bool IsDeviceOutputNecessary() const
void DrawGradient(const tools::Rectangle &rRect, const Gradient &rGradient)
sal_Int32 GetIndex() const
bool isRectangle(const B2DPolygon &rPoly)
sal_Int32 GetIndex() const
const Color & GetFillColor() const