jaragunde commented on code in PR #990:
URL: https://github.com/apache/poi/pull/990#discussion_r2676090103


##########
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:
   Good question, I first found this in the code that applies alpha to bitmap 
fill in shapes: 
https://github.com/apache/poi/blob/fd66689944132934845f177bdd52b17822f600d1/poi/src/main/java/org/apache/poi/sl/draw/DrawPaint.java#L279
   
   It obtains the alpha value from TexturePaint which expresses it in "100k 
percentage". I basically copied the getAlpha implementation from 
XSLFTexturePaint: 
https://github.com/apache/poi/blob/6670c48c305fca2aa30c4bdd01763c696f8f698e/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTexturePaint.java#L105
   
   Opening up an OOXML file, alpha information is stored like this: 
`<a:alphaModFix amt="80000"/>`. This example is 80%. I guess it all comes down 
to "we do what OOXML does".
   
   I've just taken a look at the standard, and I understood it's also possible 
to express it like a percentage string, like "80%" but I haven't found 
documents using it. I will forge one and come back.



-- 
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]

Reply via email to