jaragunde commented on code in PR #990:
URL: https://github.com/apache/poi/pull/990#discussion_r2676526634
##########
poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java:
##########
@@ -225,6 +225,10 @@ public Insets getClipping(){
POIXMLUnits.parsePercent(r.xgetR()));
}
+ public int getAlpha() {
+ return getBlip().sizeOfAlphaModFixArray() > 0 ?
POIXMLUnits.parsePercent(getBlip().getAlphaModFixArray(0).xgetAmt()) : 100000;
Review Comment:
Reporting back, I tested what happens when the document expresses the alpha
value like this: `<a:alphaModFix amt="80%"/>`.
In that case, POIXMLUnits detects it ends with % and returns the integer
value multiplied by 1000:
https://github.com/apache/poi/blob/cc8b6d7591095c4b7e5185541bafcaf05e9ba50a/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/POIXMLUnits.java#L144
So the returned alpha value is 80000 and the document is processed
correctly. This is documented in `POIXMLUnits.parsePercent()`:
```
/**
* Office will read percentages formatted with a trailing percent sign
or formatted
* as 1000th of a percent without a trailing percent sign
*
* @return the percent scaled by 1000, so 100% = 100000
*/
```
The document is also correct for MS Office, displaying the expected alpha
value. Interestingly, LibreOffice doesn't seem to interpret it correctly, and
it sets alpha to 0 (transparent).
I'm going to add a comment clarifying this in `XSLFPictureShape`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]