Skip to content
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

Transparent fill property from 'g' was not overriding inner elements … #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions library/src/main/java/com/pixplicity/sharp/Sharp.java
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,7 @@ public static class SvgHandler extends DefaultHandler {

private Paint mFillPaint;
private boolean mFillSet = false;
private int mFillColor;
private Stack<Paint> mFillPaintStack = new Stack<>();
private Stack<Boolean> mFillSetStack = new Stack<>();

Expand Down Expand Up @@ -1393,6 +1394,7 @@ private boolean doFill(Properties atts, RectF boundingBox) {
}
} else {
if (mFillSet) {
mFillPaint.setColor(mFillColor);
// If fill is set, inherit from parent
// optimization: return false if transparent
return mFillPaint.getColor() != Color.TRANSPARENT;
Expand Down Expand Up @@ -1794,6 +1796,9 @@ public void startElement(String namespaceURI, String localName, String qName, At
doStroke(props, null);

mFillSet |= (props.getString("fill") != null);
if(mFillSet) {
mFillColor = mFillPaint.getColor();
}
mStrokeSet |= (props.getString("stroke") != null);

SvgGroup group = new SvgGroup(id);
Expand Down