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

Problem with setStrokeWidth in SVGAndroidRenderer #289

Open
ruha9005 opened this issue Dec 20, 2024 · 0 comments
Open

Problem with setStrokeWidth in SVGAndroidRenderer #289

ruha9005 opened this issue Dec 20, 2024 · 0 comments

Comments

@ruha9005
Copy link

SVGAndroidRenderer::2385
Code:
state.strokePaint.setStrokeWidth(state.style.strokeWidth.floatValue(this));
The method "Paint.setStrokeWidth" has one unpleasant feature:

Set the width for stroking.
Pass 0 to stroke in hairline mode.
Hairlines always draws a single pixel independent of the canvas's matrix.

Because of this, we may see a border even where we set it to zero width.
I have temporary solution for this, adding:

if (state.style.strokeWidth.isZero()) {
    state.style.strokeOpacity = 0f;
}

after setStrokeWidth and modifying state.hasStroke = with:

state.hasStroke = (style.stroke != null && style.stroke != Colour.TRANSPARENT &&
             (!style.strokeWidth.isZero() || state.style.strokeOpacity != 0f));

in several places

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant