-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: read/write transparency (alpha) property on fills #62
Comments
Hi @scanny I wonder what it takes to support this feature. I'd like to help and possibility provide a PR if you can point me a direction. |
Probably the easiest place to start is to create a single slide presentation having a single shape on it, then set the transparency, save, and inspect the XML. You should find an There is some preliminary analysis here: http://python-pptx.readthedocs.io/en/latest/dev/analysis/dml-fill.html and here: http://python-pptx.readthedocs.io/en/latest/dev/analysis/dml-color.html It looks like the MS API has a
Why don't you have a look at these items and then you can ask any more specific questions you have :) |
Transparency options from PowerPoint's Format Shape GUIThe Format Shape pane contains the following Fill strategies. In this comment, I will explore each of the Fill strategies and see how transparency works for each. 1. Solid Fill
--- before/ppt/slides/slide1.xml
+++ solidFillTrans/ppt/slides/slide1.xml
@@ -39,6 +39,11 @@
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
+ <a:solidFill>
+ <a:schemeClr val="accent1">
+ <a:alpha val="45000"/>
+ </a:schemeClr>
+ </a:solidFill>
</p:spPr>
<p:style>
<a:lnRef idx="2"> The above is the Scheme Color only. I've created solidFillTransYellow.pptx with yellow color: --- before/ppt/slides/slide1.xml
+++ solidFillTransYellow/ppt/slides/slide1.xml
@@ -39,6 +39,11 @@
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
+ <a:solidFill>
+ <a:srgbClr val="FFFF00">
+ <a:alpha val="45000"/>
+ </a:srgbClr>
+ </a:solidFill>
</p:spPr>
<p:style>
<a:lnRef idx="2"> 2. No Fill
--- before/ppt/slides/slide1.xml
+++ noFillOrig/ppt/slides/slide1.xml
@@ -39,6 +39,7 @@
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
+ <a:noFill/>
</p:spPr>
<p:style>
<a:lnRef idx="2">
3. Gradient Fill
--- before/ppt/slides/slide1.xml
+++ gradFillOrig/ppt/slides/slide1.xml
@@ -39,6 +39,35 @@
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
+ <a:gradFill>
+ <a:gsLst>
+ <a:gs pos="0">
+ <a:schemeClr val="accent1">
+ <a:lumMod val="5000"/>
+ <a:lumOff val="95000"/>
+ </a:schemeClr>
+ </a:gs>
+
<a:gs pos="74000">
+ <a:schemeClr val="accent1">
+ <a:lumMod val="45000"/>
+ <a:lumOff val="55000"/>
+ </a:schemeClr>
+ </a:gs>
+ <a:gs pos="83000">
+ <a:schemeClr val="accent1">
+
<a:lumMod val="45000"/>
+ <a:lumOff val="55000"/>
+ </a:schemeClr>
+ </a:gs>
+ <a:gs pos="100000">
+ <a:schemeClr val="accent1">
+ <a:lumMod val="30000"/>
+ <a:lumOff val="70000"/>
+
</a:schemeClr>
+ </a:gs>
+ </a:gsLst>
+ <a:lin ang="5400000" scaled="1"/>
+ </a:gradFill>
</p:spPr>
<p:style>
<a:lnRef idx="2">
--- gradFillOrig/ppt/slides/slide1.xml
+++ gradFillTrans/ppt/slides/slide1.xml
@@ -45,6 +45,7 @@
<a:schemeClr val="accent1">
<a:lumMod val="5000"/>
<a:lumOff val="95000"/>
+ <a:alpha val="56000"/>
</a:schemeClr>
</a:gs>
<a:gs pos="74000"> 4. Blip Fill
--- before/ppt/slides/slide1.xml
+++ blipFillOrig/ppt/slides/slide1.xml
@@ -39,6 +39,13 @@
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
+ <a:blipFill dpi="0" rotWithShape="0">
+ <a:blip r:embed="rId2"/>
+ <a:srcRect/>
+ <a:stretch>
+ <a:fillRect/>
+ </a:stretch>
+ </a:blipFill>
</p:spPr>
<p:style>
<a:lnRef idx="2">
--- blipFillOrig/ppt/slides/slide1.xml
+++ blipFillTrans/ppt/slides/slide1.xml
@@ -40,7 +40,9 @@
<a:avLst/>
</a:prstGeom>
<a:blipFill dpi="0" rotWithShape="0">
- <a:blip r:embed="rId2"/>
+ <a:blip r:embed="rId2">
+ <a:alphaModFix amt="45000"/>
+ </a:blip>
<a:srcRect/>
<a:stretch>
<a:fillRect/> 5. Pattern Fill
--- before/ppt/slides/slide1.xml
+++ pattnFillOrig/ppt/slides/slide1.xml
@@ -39,6 +39,14 @@
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
+ <a:pattFill prst="pct5">
+ <a:fgClr>
+ <a:schemeClr val="accent1"/>
+ </a:fgClr>
+ <a:bgClr>
+ <a:schemeClr val="bg1"/>
+ </a:bgClr>
+ </a:pattFill>
</p:spPr>
<p:style>
<a:lnRef idx="2">
6. Background Fill
--- before/ppt/slides/slide1.xml
+++ bkgFillOrig/ppt/slides/slide1.xml
@@ -19,7 +19,7 @@
<a:chExt cx="0" cy="0"/>
</a:xfrm>
</p:grpSpPr>
- <p:sp>
+ <p:sp useBgFill="1">
<p:nvSpPr>
<p:cNvPr id="4" name="Rectangle 3">
<a:extLst>
|
No description provided.
The text was updated successfully, but these errors were encountered: