Paint
A description of the style to use when drawing a shape on the canvas.
Properties
anti_alias- Whether to apply anti-aliasing to lines and images drawn on the canvas.blend_mode- A blend mode to apply when a shape is drawn or a layer is composited.blur_image- Blur image when drawing it on a canvas.color- The color to use when stroking or filling a shape.gradient- Configures gradient paint.stroke_cap- The kind of finish to place on the ends of stroked lines.stroke_dash_pattern- Dash pattern used when painting stroked outlines.stroke_join- The kind of finish to place on joins between stroked segments.stroke_miter_limit- The limit for drawing miter joins whenstroke_joinisStrokeJoin.MITERandstyleisPaintingStyle.STROKE.stroke_width- How wide stroked edges should be, in logical pixels.style- Whether to paint filled interiors or only stroked outlines.
Methods
copy- Returns a copy of this object with the specified properties overridden.
Properties
anti_aliasclass-attributeinstance-attribute
anti_alias: bool | None = NoneWhether to apply anti-aliasing to lines and images drawn on the canvas.
Defaults to True.
blend_modeclass-attributeinstance-attribute
blend_mode: BlendMode | None = NoneA blend mode to apply when a shape is drawn or a layer is composited.
Defaults to BlendMode.SRC_OVER.
blur_imageclass-attributeinstance-attribute
blur_image: BlurValue | None = NoneBlur image when drawing it on a canvas.
colorclass-attributeinstance-attribute
color: ColorValue | None = NoneThe color to use when stroking or filling a shape.
Defaults to opaque black.
gradientclass-attributeinstance-attribute
gradient: PaintGradient | None = NoneConfigures gradient paint.
stroke_capclass-attributeinstance-attribute
stroke_cap: StrokeCap | None = NoneThe kind of finish to place on the ends of stroked lines.
This applies when style is PaintingStyle.STROKE.
If not set, the effective default is StrokeCap.BUTT.
stroke_dash_patternclass-attributeinstance-attribute
stroke_dash_pattern: list[Number] | None = NoneDash pattern used when painting stroked outlines.
Values alternate between painted dash lengths and unpainted gap lengths. For
example, [5, 10] paints a dash 5 logical pixels long, then leaves a gap 10
logical pixels long, repeating the pattern along the stroked path.
This applies only when style is PaintingStyle.STROKE.
stroke_joinclass-attributeinstance-attribute
stroke_join: StrokeJoin | None = NoneThe kind of finish to place on joins between stroked segments.
This applies when style is
PaintingStyle.STROKE. If not set, the effective default is
StrokeJoin.MITER.
See also:
stroke_miter_limitclass-attributeinstance-attribute
stroke_miter_limit: Number | None = NoneThe limit for drawing miter joins when stroke_join is
StrokeJoin.MITER and style is
PaintingStyle.STROKE.
If this limit is exceeded, a bevel join is used instead. If not set, the effective
default is 4.0.
stroke_widthclass-attributeinstance-attribute
stroke_width: Number | None = NoneHow wide stroked edges should be, in logical pixels.
This applies when style is PaintingStyle.STROKE. If not set,
the effective default is 0.0, which corresponds to a hairline width.
styleclass-attributeinstance-attribute
style: PaintingStyle | None = NoneWhether to paint filled interiors or only stroked outlines.
If not set, the effective default is PaintingStyle.FILL.
Methods
copy
copy(
color: ColorValue | None = None,
blend_mode: BlendMode | None = None,
blur_image: BlurValue | None = None,
anti_alias: bool | None = None,
gradient: PaintGradient | None = None,
stroke_cap: StrokeCap | None = None,
stroke_join: StrokeJoin | None = None,
stroke_miter_limit: Number | None = None,
stroke_width: Number | None = None,
stroke_dash_pattern: list[Number] | None = None,
style: PaintingStyle | None = None,
) -> PaintReturns a copy of this object with the specified properties overridden.