Android 12 Developer Preview is here! Try it out, and give us your feedback!

AndroidPaint

class AndroidPaint : Paint
kotlin.Any
   ↳ androidx.compose.ui.graphics.AndroidPaint

Summary

Public constructors

Public methods
NativePaint

Properties
Float

Configures the alpha value between 0f to 1f representing fully transparent to fully opaque for the color drawn with this Paint

BlendMode

A blend mode to apply when a shape is drawn or a layer is composited.

Color

The color to use when stroking or filling a shape.

ColorFilter?

A color filter to apply when a shape is drawn or when a layer is composited.

FilterQuality

Controls the performance vs quality trade-off to use when applying when drawing images, as with Canvas.drawImageRect Defaults to FilterQuality.None.

Boolean

Whether to apply anti-aliasing to lines and images drawn on the canvas.

PathEffect?

Specifies the PathEffect applied to the geometry of the shape that is drawn

Shader?

The shader to use when stroking or filling a shape.

StrokeCap

The kind of finish to place on the end of lines drawn when style is set to PaintingStyle.Stroke.

StrokeJoin

The kind of finish to place on the joins between segments.

Float

The limit for miters to be drawn on segments when the join is set to StrokeJoin.Miter and the style is set to PaintingStyle.Stroke.

Float

How wide to make edges drawn when style is set to PaintingStyle.Stroke.

PaintingStyle

Whether to paint inside shapes, the edges of shapes, or both.

Public constructors

<init>

AndroidPaint()

Public methods

asFrameworkPaint

fun asFrameworkPaint(): NativePaint

Properties

alpha

var alpha: Float

Configures the alpha value between 0f to 1f representing fully transparent to fully opaque for the color drawn with this Paint

blendMode

var blendMode: BlendMode

A blend mode to apply when a shape is drawn or a layer is composited. The source colors are from the shape being drawn (e.g. from Canvas.drawPath) or layer being composited (the graphics that were drawn between the Canvas.saveLayer and Canvas.restore calls), after applying the colorFilter, if any. The destination colors are from the background onto which the shape or layer is being composited. Defaults to BlendMode.SrcOver. See also: Canvas.saveLayer, which uses its Paint's blendMode to composite the layer when Canvas.restore is called. BlendMode, which discusses the user of Canvas.saveLayer with blendMode.

color

var color: Color

The color to use when stroking or filling a shape. Defaults to opaque black. See also: style, which controls whether to stroke or fill (or both). colorFilter, which overrides color. shader, which overrides color with more elaborate effects. This color is not used when compositing. To colorize a layer, use colorFilter.

colorFilter

var colorFilter: ColorFilter?

A color filter to apply when a shape is drawn or when a layer is composited. See ColorFilter for details. When a shape is being drawn, colorFilter overrides color and shader.

filterQuality

var filterQuality: FilterQuality

Controls the performance vs quality trade-off to use when applying when drawing images, as with Canvas.drawImageRect Defaults to FilterQuality.None.

isAntiAlias

var isAntiAlias: Boolean

Whether to apply anti-aliasing to lines and images drawn on the canvas. Defaults to true.

pathEffect

var pathEffect: PathEffect?

Specifies the PathEffect applied to the geometry of the shape that is drawn

shader

var shader: Shader?

The shader to use when stroking or filling a shape.

When this is null, the color is used instead.

See also: LinearGradientShader, RadialGradientShader, or SweepGradientShader shaders that paint a color gradient. ImageShader, a shader that tiles an ImageBitmap. colorFilter, which overrides shader. color, which is used if shader and colorFilter are null.

strokeCap

var strokeCap: StrokeCap

The kind of finish to place on the end of lines drawn when style is set to PaintingStyle.Stroke. Defaults to StrokeCap.Butt, i.e. no caps.

strokeJoin

var