Skip to content

svg2tvgt: Support for gradient and pattern defs #41

Description

@Kreijstal

Description

svg2tvgt currently lists defs, linearGradient, radialGradient, and pattern as unsupported elements, reporting an error and marking conversion as "not fully supported."

However, TinyVG natively supports both linear and radial gradients. It should be possible to resolve <linearGradient> and <radialGradient> from <defs> and map them to TVG gradient styles when an element references them via fill="url(#id)" or stroke="url(#id)".

Example

<defs>
  <linearGradient id="g1" x1="0" y1="0" x2="100" y2="0">
    <stop offset="0%" stop-color="red" />
    <stop offset="100%" stop-color="blue" />
  </linearGradient>
</defs>
<rect x="0" y="0" width="100" height="50" fill="url(#g1)" />

This currently fails even though TVG can represent it.

Patterns

Patterns (<pattern>) have no TVG equivalent, so those would still need to be flagged as unsupported. But gradients seem like low-hanging fruit since the format already has the primitives for them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions