deeplook / svglib

Read SVG files and convert them to other formats.
GNU Lesser General Public License v3.0
324 stars 79 forks source link

Override the default fillOpacity and strokeOpacity by the respective color property #308

Closed ChrisBuergi closed 2 years ago

ChrisBuergi commented 2 years ago

Override the fillOpacity and strokeOpacity if the defaults for those properties are set and fillColor or strokeColor has an alpha value (opacity) set.

If this is not done, the default opacity (1) will be used regardless of the alpha values of the corresponding colors.

claudep commented 2 years ago

Thanks Chris, I slightly changed the patch (and added tests) to not need the new applied_default_value dict: #310 Is that new patch looking good for you? Also, I would like to know about the safeApplyShapeAttr of your patch, against what value are you guarding there (would be great to complement the tests with those values)?

ChrisBuergi commented 2 years ago

Regarding your question about safeApplyShapeAttr... the String shape does not have a fillOpacity or strokeOpacity attribute defined.

claudep commented 2 years ago

OK, thanks, then we are safe as there is already a try/except construct in that loop.