Akira
Akira copied to clipboard
Linear and Radial Gradients on main branch
Summary / How this PR fixes the problem?
Following features will be implemented in this PR
- [x] Create a Pattern Component to represent different types of Fill a canvas item can have (Solid, Linear and Radial)
- [x] Create widget for choosing between different types of pattern (Widgets.PatternTypeChooser)
- [x] Create widget for adding, removing and modifying stop colors on patterns.
- [x] Render the selected Pattern on Canvas.
- [x] Create Nobs for modifying start and end points of gradients on canvas item.
- [x] Allow saving patterns to colors container
- [x] Show the created pattern on the ColorButton in fills panel.
Blending Cairo.Patterns requires a little bit of math (Linear Interpolation. Will probably implement it in another PR
Steps to Test
- Draw some canvas item (like Rectangle or Ellipse).
- Click on the ColorButton in the Fills Panel. This should open a popover.
- At the top of the popover, you should see the PatternTypeChooser. Select whichever mode you want,
- For linear and radial gradients, you can use the GradientEditor widget below PatternTypeChooser to add stop colors and change their colors.
- With the Popover open, you can also move the gradient nobs around to change position of the pattern.
After creating a pattern, click on the + button to add this pattern to the Global colors. You can then apply the same pattern to any other canvas item by clicking on it.
Screenshots

Known Issues / Things To Do
- Blending Lib.Components.Pattern has not been implemented yet.
This PR fixes/implements the following bugs/features:
- Fixes #605