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 = TrueWhether to apply anti-aliasing to lines and images drawn on the canvas.
blend_modeclass-attributeinstance-attribute
blend_mode: BlendMode = BlendMode.SRC_OVERA blend mode to apply when a shape is drawn or a layer is composited.
blur_imageclass-attributeinstance-attribute
blur_image: BlurValue | None = NoneBlur image when drawing it on a canvas.
colorclass-attributeinstance-attribute
color: ColorValue = Colors.BLACKThe color to use when stroking or filling a shape.
gradientclass-attributeinstance-attribute
gradient: PaintGradient | None = NoneConfigures gradient paint.
stroke_capclass-attributeinstance-attribute
stroke_cap: StrokeCap = StrokeCap.BUTTThe kind of finish to place on the ends of stroked lines.
This applies when style is PaintingStyle.STROKE.
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 = StrokeJoin.MITERThe kind of finish to place on joins between stroked segments.
This applies when style is PaintingStyle.STROKE.
See also:
stroke_miter_limitclass-attributeinstance-attribute
stroke_miter_limit: Number = 4.0The 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.
stroke_widthclass-attributeinstance-attribute
stroke_width: Number = 0.0How wide stroked edges should be, in logical pixels.
This applies when style is PaintingStyle.STROKE.
A width of 0.0 corresponds to a hairline.
styleclass-attributeinstance-attribute
style: PaintingStyle = PaintingStyle.FILLWhether to paint filled interiors or only stroked outlines.
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.