androidsvg icon indicating copy to clipboard operation
androidsvg copied to clipboard

Support SVG2 mask-type

Open nannandenden opened this issue 5 years ago • 3 comments

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

Screen Shot 2020-11-02 at 10 06 05 PM

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

nannandenden avatar Nov 03 '20 06:11 nannandenden

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:

  1. Update the masks to use the default SVG 1.1 type mask-type="luminance", or
  2. 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

BigBadaboom avatar Nov 03 '20 08:11 BigBadaboom

Updated bug title to make it a feature request for mask-type support.

BigBadaboom avatar Nov 03 '20 08:11 BigBadaboom

Thank you for the quick response and explanation of the problem.

nannandenden avatar Nov 03 '20 16:11 nannandenden