question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fill by gradients not supported

See original GitHub issue

Hi, In the beginning, thx for the cool converter. I discovered filling color is null if used any gradient. For example, you can take this SVG and convert it to kt

<svg height="150" width="400">
    <defs>
        <linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
            <stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
            <stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
        </linearGradient>
    </defs>
    <ellipse cx="200" cy="70" rx="85" ry="55" fill="url(#grad1)" />
</svg>
public val ImagesGroup.Gradient: ImageVector
    get() {
        if (_gradient != null) {
            return _gradient!!
        }
        _gradient = Builder(
            name = "Gradient", defaultWidth = 400.0.dp, defaultHeight = 150.0.dp,
            viewportWidth = 400.0f, viewportHeight = 150.0f
        ).apply {
            path(
                fill = null,
                /* expected
                          Brush.linearGradient(
                                              colors = listOf(Color.Yellow, Color.Red),
                                              start = Offset(0f, 0f),
                                              end = Offset(Float.POSITIVE_INFINITY, 0f)
                                          ),
                */
                stroke = null,
                strokeLineWidth = 0.0f,
                strokeLineCap = Butt,
                strokeLineJoin = Miter,
                strokeLineMiter = 4.0f,
                pathFillType = NonZero
            ) {
                moveTo(115.0f, 70.0f)
                arcToRelative(85.0f, 55.0f, 0.0f, true, false, 170.0f, 0.0f)
                arcToRelative(85.0f, 55.0f, 0.0f, true, false, -170.0f, 0.0f)
                close()
            }

        }
            .build()
        return _gradient!!
    }

private var _gradient: ImageVector? = null

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
DevSrSouzacommented, Jul 23, 2021

The PR was merged, thank both @MarioFerreiraStorytel @jershell

2reactions
MarioFerreiraStorytelcommented, Jul 21, 2021

@jershell I’ve created a pull request for this: https://github.com/DevSrSouza/svg-to-compose/pull/6

Read more comments on GitHub >

github_iconTop Results From Across the Web

Re: Gradients not working on Text - Adobe Support Community
Go to the Appearance panel and add a new fill. Change it to a gradient and make sure it is above the Characters...
Read more >
Gradient tool in Adobe Illustrator not working - YouTube
Update: I figured it out, the circle shape was (for some reason) having issues (even after "expanding" or making it a compound shape),...
Read more >
ggplot gradient fill not working - Stack Overflow
1 Answer 1 ... The gradient fill is correct. It's the text values that are incorrect. Note, for example, in the data below...
Read more >
Gradient fill in Page fill not working correctly
I'm having a problem with the gradient effect. I have everything set up properly. Everything prints properly yet when I try to use...
Read more >
Gradient fill dosen't work · Issue #502 · airbnb/lottie-web - GitHub
Hi, I just made a simple shape layer with gradient fill for test. But it doesn't work properly. It just showed black &...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found