/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
if ( rLineInfo.IsDefault() )
{
DrawPolyLine( rPoly ); return;
}
if (IsDeviceOutputNecessary())
{ auto eLineStyle = rLineInfo.GetStyle(); switch (eLineStyle)
{ case LineStyle::NONE: case LineStyle::Dash: // use drawPolyLine for these break; case LineStyle::Solid: // #i101491# Try direct Fallback to B2D-Version of DrawPolyLine
DrawPolyLine(
rPoly.getB2DPolygon(),
rLineInfo.GetWidth(),
rLineInfo.GetLineJoin(),
rLineInfo.GetLineCap(),
basegfx::deg2rad(15.0) /* default fMiterMinimumAngle, value not available in LineInfo */); return; default:
SAL_WARN("vcl.gdi", "Unknown LineStyle: " << static_cast<int>(eLineStyle)); return;
}
}
if ( mpMetaFile )
mpMetaFile->AddAction( new MetaPolyLineAction( rPoly, rLineInfo ) );
// Do not paint empty PolyPolygons if(!rB2DPolygon.count() || !IsDeviceOutputNecessary()) return;
// we need a graphics if( !mpGraphics && !AcquireGraphics() ) return;
assert(mpGraphics);
if( mbInitClipRegion )
InitClipRegion();
if( mbOutputClipped ) return;
if( mbInitLineColor )
InitLineColor();
// use b2dpolygon drawing if possible if(DrawPolyLineDirectInternal(
basegfx::B2DHomMatrix(),
rB2DPolygon,
fLineWidth,
0.0,
nullptr, // MM01
eLineJoin,
eLineCap,
fMiterMinimumAngle))
{ return;
}
// #i101491# // no output yet; fallback to geometry decomposition and use filled polygon paint // when line is fat and not too complex. ImplDrawPolyPolygonWithB2DPolyPolygon // will do internal needed AA checks etc. if(fLineWidth >= 2.5 &&
rB2DPolygon.count() &&
rB2DPolygon.count() <= 1000)
{ constdouble fHalfLineWidth((fLineWidth * 0.5) + 0.5); const basegfx::B2DPolyPolygon aAreaPolyPolygon(
basegfx::utils::createAreaGeometry( rB2DPolygon,
fHalfLineWidth,
eLineJoin,
eLineCap,
fMiterMinimumAngle)); const Color aOldLineColor(maLineColor); const Color aOldFillColor(maFillColor);
// draw using a loop; else the topology will paint a PolyPolygon for(autoconst& rPolygon : aAreaPolyPolygon)
{
ImplDrawPolyPolygonWithB2DPolyPolygon(
basegfx::B2DPolyPolygon(rPolygon));
}
// when AA it is necessary to also paint the filled polygon's outline // to avoid optical gaps for(autoconst& rPolygon : aAreaPolyPolygon)
{
(void)DrawPolyLineDirectInternal(
basegfx::B2DHomMatrix(),
rPolygon);
}
} else
{ // fallback to old polygon drawing if needed const tools::Polygon aToolsPolygon( rB2DPolygon );
LineInfo aLineInfo; if( fLineWidth != 0.0 )
aLineInfo.SetWidth( fLineWidth );
// #100127# the subdivision HAS to be done here since only a pointer // to an array of points is given to the DrawPolyLine method, there is // NO way to find out there that it's a curve. if( aPoly.HasFlags() )
{
aPoly = tools::Polygon::SubdivideBezier( aPoly );
nPoints = aPoly.GetSize();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.