Kaydet (Commit) f64ef727 authored tarafından Thorsten Behrens's avatar Thorsten Behrens

Better shading algo for customshapes, better gradients

Some custom shapes can have shaded parts, like for example 3d can,
the bevelled buttons etc. Those shaded colors are calculated
internally, and have been way off at times. Now using HSV color
space & the originally documented luminance modifications in steps
of 10 percent. Compared to MSO, still no 100 percent match, but
that seems due to gamma correction there.
Additionally, starting with MSO12, gradients on those shaded surfaces
look much better; adapted code to display gradients equally nice.

Note that most of this patch also applies to ooxml import; note as
well that customshapes from *all* kind of input files (including ODF
docs) now look different than before; no real way of changing this
in a backward-compatible way, since behaviour of custom shapes is
mandated (mostly) by internal tables, and not stored in a file.

Applies patches/dev300/ppt-customshape-shading-fix (much of it was
accepted at OOo already, via i#102797)

Applies patches/dev300/ppt-customshape-shading-fix.diff: fixed prob
with line arrows - the extra-added single point polygons lead to
extra arrows randomly around the custom shape. i#105654
üst 5e1626f2
......@@ -509,10 +509,11 @@ namespace drawinglayer
{
// copy local polygon, it may be changed
basegfx::B2DPolygon aLocalPolygon(getB2DPolygon());
aLocalPolygon.removeDoublePoints();
basegfx::B2DPolyPolygon aArrowA;
basegfx::B2DPolyPolygon aArrowB;
if(!aLocalPolygon.isClosed())
if(!aLocalPolygon.isClosed() && aLocalPolygon.count() > 1)
{
// apply arrows
const double fPolyLength(basegfx::tools::getLength(aLocalPolygon));
......
......@@ -1735,6 +1735,22 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm
if(aNewB2DPolyPolygon.count())
{
if( !bLineGeometryNeededOnly )
{
// hack aNewB2DPolyPolygon to fill logic rect - this is
// needed to produce gradient fills that look like mso
aNewB2DPolygon.clear();
aNewB2DPolygon.append(basegfx::B2DPoint(0,0));
aNewB2DPolygon.setClosed(true);
aNewB2DPolyPolygon.append(aNewB2DPolygon);
aNewB2DPolygon.clear();
aNewB2DPolygon.append(basegfx::B2DPoint(aLogicRect.GetWidth(),
aLogicRect.GetHeight()));
aNewB2DPolygon.setClosed(true);
aNewB2DPolyPolygon.append(aNewB2DPolygon);
}
// #i37011#
bool bForceCreateTwoObjects(false);
......
......@@ -633,7 +633,7 @@ void InsertMissingOutlinePoints( const Polygon& /*rOutlinePoly*/, const std::vec
void GetPoint( const Polygon& rPoly, const std::vector< double >& rDistances, const double& fX, double& fx1, double& fy1 )
{
fy1 = fx1 = 0.0;
if ( rPoly.GetSize() )
if ( rPoly.GetSize() > 1 )
{
std::vector< double >::const_iterator aIter = std::lower_bound( rDistances.begin(), rDistances.end(), fX );
sal_uInt16 nIdx = sal::static_int_cast<sal_uInt16>( std::distance( rDistances.begin(), aIter ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment