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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃寛 Gradient - Tracking issue #2282

Open
9 of 13 tasks
Dherse opened this issue Oct 1, 2023 · 13 comments
Open
9 of 13 tasks

馃寛 Gradient - Tracking issue #2282

Dherse opened this issue Oct 1, 2023 · 13 comments
Labels
tracking-issue An issue that tracks a larger piece of work.

Comments

@Dherse
Copy link
Sponsor Collaborator

Dherse commented Oct 1, 2023

Gradient progress report:

The vast majority of those features (all of them in SVG) are available on my gradient branch. However, in this branch the layout engine is completely broken, which I have fixed in these PRs, but didn't bother to on my experimental branch.

The reason why gradients are split up is because part 1 and 2 already account for close to 5000 lines added, the size and complexity of gradients simply balloons when you consider that we support three different export targets, each with their own quirks and limitations that need to be worked around.

This is just a tracking issue I can point to in other gradient PRs ;)

@laurmaedje laurmaedje added the tracking-issue An issue that tracks a larger piece of work. label Oct 1, 2023
@Dherse Dherse changed the title Gradient - Tracking issue 馃寛 Gradient - Tracking issue Oct 1, 2023
@Dherse
Copy link
Sponsor Collaborator Author

Dherse commented Oct 7, 2023

Also closes #443 (with Part 8).

@Dherse
Copy link
Sponsor Collaborator Author

Dherse commented Oct 7, 2023

Also closes #260. I'd even go as far as stating that it already closes it.

@Dherse
Copy link
Sponsor Collaborator Author

Dherse commented Oct 12, 2023

It was decided in discussion with @laurmaedje that we would not support (at least now) glyph-by-glyph gradients as they're extremely heavy file-size wise, kind of ugly, and difficult to get right.

Starting here on Discord: https://discord.com/channels/1054443721975922748/1088371867913572452/1161943386048188436

@stellarpower
Copy link

This looks fab! Would building it be as simple as pointing rust to a crate from your fork? Afraid I've not much experience with the language. I would like some gradients in my document, so I can do some basic testing.

@laurmaedje
Copy link
Member

@stellarpower Most of the gradient work has already landed on main, so if you just compile Typst from main you can just use it.

@stellarpower
Copy link

Alright, thanks! I will just try building the master branch then.

@stellarpower
Copy link

As of a596663, it seems that I can fill a box with a gradient (fill can take a gradient) - but the stroke for lines doesn't seem to support this; is this worth adding as a subitem above? I imagine single straight lines ought to be a simpler starting point than arbitrary paths or font glyphs, and would enable people to take it for a spin in more situations!

@Dherse
Copy link
Sponsor Collaborator Author

Dherse commented Oct 15, 2023

@stellarpower With regards to line, they generally you work, you can find an example here but I generally recommend keeping simple linear gradients on line as line technically have a zero width which makes other gradient look... funky?

I imagine single straight lines ought to be a simpler starting point than arbitrary paths or font glyphs

Truth be told, there is essentially no difference wrt. the "complexity" of the stroke for gradient fills. Currently, gradient fills in parent mode will work on any path you throw at them, it's only when applied in relative: "self" or relative: "auto" on lines that it can get tricky.

I should also mention that my gradient branch has the entire layout engine broken, I strongly advice not to try using it. It just contains the experimental code I have been working on since June/early July

@stellarpower
Copy link

Okay, so I have to do the 1pt + bit, I presume that turns it from a gradient to a stroke.

It seems that fill accepts a gradient or a color, whilst line accepts a color or a stroke (which can be based off a gradient itself), but not a gradient.

Thanks for the advice on your branch, I'll stay clear then.

@emilyyyylime
Copy link
Contributor

emilyyyylime commented Oct 16, 2023

Okay, so I have to do the 1pt + bit, I presume that turns it from a gradient to a stroke.

Also consider stroke: (paint: gradient(..))

@laurmaedje
Copy link
Member

I think we just need to add the missing gradient -> stroke cast. Seems like an oversight.

@laurmaedje
Copy link
Member

Should we close this?

@Dherse
Copy link
Sponsor Collaborator Author

Dherse commented Nov 14, 2023

I was planning on working on some more features, namely pattern fills in the upcoming weeks just haven't found the motivation just yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracking-issue An issue that tracks a larger piece of work.
Projects
None yet
Development

No branches or pull requests

4 participants