roxrook / svg-android

Automatically exported from code.google.com/p/svg-android
0 stars 0 forks source link

Opacity doesn't work in path objects #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to render this:
<svg width="176px" height="208px">
<path opacity="0.5" d="M0,0v67.696h176V0H0z 
M43.925,42.753c-6.324,0-11.451-4.924-11.451-10.998
    c0-6.074,5.127-10.998,11.451-10.998s11.451,4.924,11.451,10.998C55.376,37.829,50.25,42.753,43.925,42.753z"/>
</svg>

What is the expected output? What do you see instead?
expected:A black rectangle with 50% opacity with a fully opaque oval
actual: the rectangle is fully opaque (no transparency at all)

What version of the product are you using? On what operating system?
most recent

Please provide any additional information below.

Original issue reported on code.google.com by lance.gi...@gmail.com on 1 Oct 2011 at 4:16

GoogleCodeExporter commented 8 years ago
* expected result fully transparent oval

Original comment by lance.gi...@gmail.com on 1 Oct 2011 at 4:18

GoogleCodeExporter commented 8 years ago
I solved it by adding:

Float opacity = atts.getFloat("opacity");
if (opacity == null) {
paint.setAlpha(255);
} else {
paint.setAlpha((int) (255 * opacity));
}

at the last "else-if" statemint in doFill()

Original comment by someguy...@gmail.com on 2 Mar 2012 at 3:09

GoogleCodeExporter commented 8 years ago
your patch helps me to achieve transparency. But I have to manually edit the 
document because do not receive the data.

this is an example of the default document:

<g opacity="0.65">
    <g>
        <path fill="#FFFFFF" d="....LARGE AMOUNT OF NUMBERS HERE..."/>
</g>
</g>

Modified manually to:

<g opacity="0.65">
    <g>
        <path opacity="0.65" fill="#FFFFFF" d="....LARGE AMOUNT OF NUMBERS HERE..."/>
</g>
</g>
Iḿ looking how can work without modify the file

Original comment by turboch...@gmail.com on 19 Apr 2012 at 3:38

GoogleCodeExporter commented 8 years ago
I search some info of svg and I look that <g> == group, before that i dont 
understand wath are <g>, XD 
I make some basic changes on the process how the opacity are made, I added a 
counter for the levels of <g>, copy the same mechanism of the levels of 
display="none"; at the moments this patch rules for my needs but I see the 
overlay of opacity more "pure color" than on illustrator.

Sorry for my english; but the only important here is the code XD.

Original comment by turboch...@gmail.com on 21 Apr 2012 at 2:30

Attachments: