Skip to content

Gradients other than linear do not seem to work #296

@chaosparrot

Description

@chaosparrot

Talon v0.1.5 - Windows 10

In the Skia.Shader api, the only gradients I have managed to make work is the linear gradient. Sweep, radial and two point conical do not seem to work properly when I look at the interface files. Any type of configuration seems to result in the following error: IndexError: too many initializers for 'sk_point_t[1]' (got 2)

Steps to reproduce - Put this as a python file in your user folder, this should generate a circle in the topleft part of the screen. You can uncomment a line to check the other gradients

from talon import app, canvas, skia

class GradientExample:
    canvas = None

    def __init__(self):
        self.canvas = canvas.Canvas(10, 10, 110, 110)
        self.canvas.register('draw', self.draw_cycle)
        self.canvas.freeze()

    def draw_cycle(self, canvas):
        paint = canvas.paint
        #paint.shader = skia.Shader.linear_gradient(10, 10, 10, 110, ['FF0000', '00FF00', '0000FF'], None)
        paint.shader = skia.Shader.radial_gradient(60, 60, 50, ['FF0000', '00FF00', '0000FF'], None)
        #paint.shader = skia.Shader.sweep_gradient(60, 60, 50, ['FF0000', '00FF00', '0000FF'], None)
        #paint.shader = skia.Shader.two_point_conical_gradient(10, 10, 50, 70, 70, 50, ['FF0000', '00FF00', '0000FF'], None)
        
        canvas.draw_circle(60, 60, 50, paint)

def open_example():
    GradientExample()

app.register('ready', open_example)```

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    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