Skip to content

Support spread method for gradient#3953

Open
YohYamasaki wants to merge 5 commits intoGraphiteEditor:masterfrom
YohYamasaki:gradient-spread-method
Open

Support spread method for gradient#3953
YohYamasaki wants to merge 5 commits intoGraphiteEditor:masterfrom
YohYamasaki:gradient-spread-method

Conversation

@YohYamasaki
Copy link
Copy Markdown
Contributor

Part of #2304

Demo

Screen.Recording.2026-03-26.at.18.44.05.mp4

Description

This PR adds support for selecting the spread method between Pad, Repeat, and Reflect.
At this moment, fix rendering Table<GradientStops> with the spread method is out of scope since the renderer does not currently handle any spatial information. It will be addressed in PRs for #2779.

The issue of the gradient tool's initially selected gradient type and spread method being out of sync with the selections in the gradient property panel has also been fixed. This occurred when users changed the settings in the property panel without selecting the gradient tool, because GradientToolMessage::UpdateOptions sent from the property panel was not processed when the gradient tool was inactive. The screencast below shows the bug.

Screen.Recording.2026-03-26.at.18.41.39.mp4

* Add GradientSpreadMethod enum (Pad, Repeat, Reflect) to vector-types

* Add radio buttons to gradient tool and fill properties panel

* Convert spread method when importing SVGs via usvg

* Sync backup gradient input when changing spread method

* Table<GradientStops> rendering is not yet updated for spread method
* Sync gradient_type and spread_method from the selected
  layer's existing gradient to the tool options bar when
  switching to the gradient tool

* Refactor has_gradient_on_selected_layers
  to reuse a new get_gradient_on_selected_layer helper
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the gradient functionality by introducing various spread methods, providing users with greater control over how gradients repeat or extend beyond their defined boundaries. It also addresses a critical synchronization bug, ensuring that the gradient tool's settings consistently reflect the selections made in the property panel, thereby improving the overall user experience and reliability of gradient editing.

Highlights

  • Gradient Spread Method Support: Implemented support for 'Pad', 'Repeat', and 'Reflect' spread methods for gradients, allowing for more diverse gradient rendering options.
  • Gradient Tool Sync Fix: Resolved an issue where the gradient tool's selected gradient type and spread method would become out of sync with the property panel when changes were made while the tool was inactive.
  • UI Integration: Added user interface elements in the node properties panel and the gradient tool options to allow users to select and control the gradient spread method.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@YohYamasaki YohYamasaki mentioned this pull request Mar 26, 2026
6 tasks
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the concept of 'gradient spread method' to control how gradients extend beyond their defined boundaries (Pad, Repeat, Reflect). This feature is integrated by adding a new GradientSpreadMethod enum, updating the Gradient struct to include this property, and modifying gradient creation and manipulation logic. User interface controls have been added to both the node graph properties panel and the gradient tool options, allowing users to select the desired spread method. The changes also include implementing the rendering of the spread method in SVG output and within the Vello renderer, along with a new test case to verify the functionality. No feedback is provided as there were no review comments.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@Keavon
Copy link
Copy Markdown
Member

Keavon commented Mar 26, 2026

!build (Run ID 23589300382)

@github-actions
Copy link
Copy Markdown

📦 Web Build Complete for 84925a7
https://bcfd42ca.graphite.pages.dev

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

Successfully merging this pull request may close these issues.

2 participants