Kaydet (Commit) d7fc306c authored tarafından Vort's avatar Vort Kaydeden (comit) Caolán McNamara

fdo#78382 PDF Import: add opacity support for fill and stroke

Change-Id: I76375280ee4726c1d497858165f38f4e8b4224cb
Reviewed-on: https://gerrit.libreoffice.org/9268Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 21e2f5b0
......@@ -72,6 +72,7 @@ namespace pdfi
/// Convert color to "#FEFEFE" color notation
OUString getColorString( const ::com::sun::star::rendering::ARGBColor& );
OUString getPercentString(double value);
double GetAverageTransformationScale(const basegfx::B2DHomMatrix& matrix);
void FillDashStyleProps(PropertyMap& props, const std::vector<double>& dashArray, double scale);
......
......@@ -96,12 +96,17 @@ OUString pdfi::getColorString( const rendering::ARGBColor& rCol )
aBuf.append( '0' );
aBuf.append( sal_Int32(nBlue), 16 );
// TODO(F3): respect alpha transparency (polygons etc.)
OSL_ASSERT(rCol.Alpha == 1.0);
return aBuf.makeStringAndClear();
}
OUString pdfi::getPercentString(double value)
{
OUStringBuffer buf(32);
buf.append(value);
buf.appendAscii("%");
return buf.makeStringAndClear();
}
OUString pdfi::unitMMString( double fMM )
{
OUStringBuffer aBuf( 32 );
......
......@@ -808,6 +808,8 @@ void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< Element* >
}
aGCProps[ "svg:stroke-color" ] = getColorString(rGC.LineColor);
if (rGC.LineColor.Alpha != 1.0)
aGCProps["svg:stroke-opacity"] = getPercentString(rGC.LineColor.Alpha * 100.0);
aGCProps[ "svg:stroke-width" ] = convertPixelToUnitString(rGC.LineWidth * scale);
aGCProps[ "draw:stroke-linejoin" ] = rGC.GetLineJoinString();
aGCProps[ "svg:stroke-linecap" ] = rGC.GetLineCapString();
......@@ -821,7 +823,9 @@ void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< Element* >
if( elem.Action & (PATH_FILL | PATH_EOFILL) )
{
aGCProps[ "draw:fill" ] = "solid";
aGCProps[ "draw:fill-color" ] = getColorString( rGC.FillColor );
aGCProps[ "draw:fill-color" ] = getColorString(rGC.FillColor);
if (rGC.FillColor.Alpha != 1.0)
aGCProps["draw:opacity"] = getPercentString(rGC.FillColor.Alpha * 100.0);
}
else
{
......@@ -904,10 +908,7 @@ void DrawXmlFinalizer::visit( TextElement& elem, const std::list< Element* >::co
if (((textScale >= 1) && (textScale <= 99)) ||
((textScale >= 101) && (textScale <= 999)))
{
OUStringBuffer aBuf(32);
aBuf.append(textScale);
aBuf.appendAscii("%");
aFontProps[ "style:text-scale" ] = aBuf.makeStringAndClear();
aFontProps[ "style:text-scale" ] = getPercentString(textScale);
}
StyleContainer::Style aStyle( "style:style", aProps );
......
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