transparency <-> opacity in import from MS Office

Regina Henschel rb.henschel at t-online.de
Thu Dec 15 19:25:29 UTC 2022


Hi all,

if a MS Office user sets 80% Transparency for a stroke, MS Office writes 
this as
    <a:alpha val="20000" />.
That means, that MS Office writes it out as opacity (which corresponds 
to the OOXML spec).

Our oox::drawingml::Color has for example
    void Color::clearTransparence() {mnAlpha = MAX_PERCENT;}
or
    sal_Int16 Color::getTransparency() const
{
       return sal_Int16(std::round((1.0 *(MAX_PERCENT - mnAlpha)) / 
PER_PERCENT) );
}

So mnAlpha means opacity too and there are no problems.


But if a MS Office user sets 80% Transparency for the fill or outline of 
a character, MS Office writes this as
<w14:alpha val="80000" />.
That means, that the value means transparency.

Up to now there was no problem as the character outline cannot be 
rendered at all in LibreOffice and character fill transparency could be 
rendered but is not imported yet.

But with implementing Fontwork this <w14:alpha> element will be rendered 
as stroke transparency. So somewhere a conversion from transparency to 
opacity has to be done.

I could do this in Color::addTransformation() in general or I could do 
this isolated in my new Fontwork import.

I would like to do this in Color::addTransformation().  What is your 
opinion on this?

Kind regards,
Regina


More information about the LibreOffice mailing list