GradientShader

class GradientShader

Classes

Flags

Members:

Methods

MakeLinear

Returns a shader that generates a linear gradient between the two specified points.

MakeRadial

Returns a shader that generates a radial gradient given the center and radius.

MakeSweep

Returns a shader that generates a conical gradient given two circles, or returns NULL if the inputs are invalid.

MakeTwoPointConical

Returns a shader that generates a conical gradient given two circles, or returns NULL if the inputs are invalid.

__init__

Attributes

kInterpolateColorsInPremul_Flag

Methods

static GradientShader.MakeLinear(points: list[skia.Point], colors: list[int], positions: object = None, mode: skia.TileMode = skia.TileMode.kClamp, flags: int = 0, localMatrix: skia.Matrix = None) skia.Shader

Returns a shader that generates a linear gradient between the two specified points.

Parameters:
  • points (List[skia.Point]) – The start and end points for the gradient.

  • colors (List[int]) – The array of colors, to be distributed between the two points

  • positions (List[float]) – May be empty list. array of Scalars, or NULL, of the relative position of each corresponding color in the colors array. If this is NULL, the the colors are distributed evenly between the start and end point. If this is not null, the values must begin with 0, end with 1.0, and intermediate values must be strictly increasing.

  • mode (skia.TileMode) – The tiling mode

  • localMatrix – Local matrix

static GradientShader.MakeRadial(center: skia.Point, radius: float, colors: list[int], positions: object = None, mode: skia.TileMode = skia.TileMode.kClamp, flags: int = 0, localMatrix: skia.Matrix = None) skia.Shader

Returns a shader that generates a radial gradient given the center and radius.

Parameters:
  • center (skia.Point) – The center of the circle for this gradient

  • radius (float) – Must be positive. The radius of the circle for this gradient

  • colors (List[int]) – The array of colors, to be distributed between the center and edge of the circle

  • positions (List[float]) – May be empty list. The array of Scalars, or NULL, of the relative position of each corresponding color in the colors array. If this is NULL, the the colors are distributed evenly between the center and edge of the circle. If this is not null, the values must begin with 0, end with 1.0, and intermediate values must be strictly increasing.

  • mode (skia.TileMode) – The tiling mode

  • localMatrix – Local matrix

static GradientShader.MakeSweep(cx: float, cy: float, colors: list[int], positions: object = None, mode: skia.TileMode = skia.TileMode.kClamp, startAngle: float = 0, endAngle: float = 360, flags: int = 0, localMatrix: skia.Matrix = None) skia.Shader

Returns a shader that generates a conical gradient given two circles, or returns NULL if the inputs are invalid.

The gradient interprets the two circles according to the following HTML spec. http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient

static GradientShader.MakeTwoPointConical(start: skia.Point, startRadius: float, end: skia.Point, endRadius: float, colors: list[int], positions: object = None, mode: skia.TileMode = skia.TileMode.kClamp, flags: int = 0, localMatrix: skia.Matrix = None) skia.Shader

Returns a shader that generates a conical gradient given two circles, or returns NULL if the inputs are invalid.

The gradient interprets the two circles according to the following HTML spec. http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient

GradientShader.__init__(*args, **kwargs)

Attributes

GradientShader.kInterpolateColorsInPremul_Flag = <Flags.kInterpolateColorsInPremul_Flag: 1>