Support SVG2 mask-type
Hello,
I am trying to load the following SVG but the loaded image has an overlay color on top of the image. This is happening for both converting svg to PictureDrawable and Bitmap. This is the file: school_supplies.txt
This overlay issue is only happening in androidsvg-aar:1.4 but not androidsvg:1.2.1
However, using androidsvg:1.2.1 I will run into other issues & prefer to use the latest version.
compileSdkVersion 29
Hi
Thank you for the bug report.
The problem with this file is that it uses <mask mask-type="alpha" ...>, which is a new SVG 2 feature that I don't support yet. If you remove that attribute from the two <mask> elements, and load the file into a browser, you will get the same result as AndroidSVG produces.
To fix this file so it displays properly in AndroidSVG, you can:
- Update the masks to use the default SVG 1.1 type
mask-type="luminance", or - Remove the masks altogether. They don't really do anything in this file AFAI can tell.
To manually apply solution 1, remove the mask-type="alpha" attributes, and change the fill colour of the elements inside the <mask> to fill="#FFFFFF".
For solution 2, remove the <mask>...</mask> elements and the mask="..." attributes.
Regards Paul
Updated bug title to make it a feature request for mask-type support.
Thank you for the quick response and explanation of the problem.